docs: rename source-app (#16863)
* docs: rename source-app * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ci * group check * trigger * param * fix * cleaning --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
|
@ -161,13 +161,17 @@ def load_readme_description(path_dir: str, homepage: str, version: str) -> str:
|
|||
text = open(path_readme, encoding="utf-8").read()
|
||||
|
||||
# drop images from readme
|
||||
text = text.replace("![PT to PL](docs/source/_static/images/general/pl_quick_start_full_compressed.gif)", "")
|
||||
text = text.replace(
|
||||
"![PT to PL](docs/source-pytorch/_static/images/general/pl_quick_start_full_compressed.gif)", ""
|
||||
)
|
||||
|
||||
# https://github.com/Lightning-AI/lightning/raw/master/docs/source/_static/images/lightning_module/pt_to_pl.png
|
||||
github_source_url = os.path.join(homepage, "raw", version)
|
||||
# replace relative repository path to absolute link to the release
|
||||
# do not replace all "docs" as in the readme we reger some other sources with particular path to docs
|
||||
text = text.replace("docs/source/_static/", f"{os.path.join(github_source_url, 'docs/source/_static/')}")
|
||||
text = text.replace(
|
||||
"docs/source-pytorch/_static/", f"{os.path.join(github_source_url, 'docs/source-app/_static/')}"
|
||||
)
|
||||
|
||||
# readthedocs badge
|
||||
text = text.replace("badge/?version=stable", f"badge/?version={version}")
|
||||
|
|
|
@ -310,7 +310,7 @@ subprojects:
|
|||
- ".actions/**"
|
||||
- "src/lightning/app/**"
|
||||
- "src/lightning_app/*"
|
||||
- "docs/source/**"
|
||||
- "docs/source-app/**"
|
||||
- ".github/workflows/docs-checks.yml"
|
||||
- "requirements/docs.txt"
|
||||
- "requirements/app/**"
|
||||
|
@ -319,8 +319,8 @@ subprojects:
|
|||
- "!*.md"
|
||||
- "!**/*.md"
|
||||
checks:
|
||||
- "make-doctest (lightning)"
|
||||
- "make-html (lightning)"
|
||||
- "make-doctest (app)"
|
||||
- "make-html (app)"
|
||||
|
||||
# SECTION: common
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ app:
|
|||
- 'tests/integrations_app/**'
|
||||
- 'tests/integrations_app_examples/**'
|
||||
- 'examples/app_*/**'
|
||||
- 'docs/source/**'
|
||||
- 'docs/source-app/**'
|
||||
- 'requirements/app/**'
|
||||
|
||||
pl:
|
||||
|
|
|
@ -39,7 +39,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pkg-name: ["lightning", "pytorch"]
|
||||
pkg-name: ["app", "pytorch"]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -47,14 +47,14 @@ jobs:
|
|||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- uses: aws-actions/configure-aws-credentials@v1
|
||||
if: ${{ matrix.pkg-name == 'lightning' }}
|
||||
if: ${{ matrix.pkg-name == 'app' }}
|
||||
with:
|
||||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_ID }}
|
||||
aws-region: us-east-1
|
||||
|
||||
- run: aws s3 sync s3://sphinx-packages/ pypi/
|
||||
if: ${{ matrix.pkg-name == 'lightning' }}
|
||||
if: ${{ matrix.pkg-name == 'app' }}
|
||||
|
||||
# Note: This uses an internal pip API and may not always work
|
||||
# https://github.com/actions/cache/blob/master/examples.md#multiple-oss-in-a-workflow
|
||||
|
@ -65,28 +65,15 @@ jobs:
|
|||
key: docs-test-${{ matrix.pkg-name }}-${{ hashFiles('requirements/${{ matrix.pkg-name }}/*.txt') }}
|
||||
restore-keys: docs-test-${{ matrix.pkg-name }}-
|
||||
|
||||
- name: Adjust docs refs
|
||||
if: ${{ matrix.pkg-name == 'lightning' }}
|
||||
run: |
|
||||
pip install -q -r .actions/requirements.txt
|
||||
python .actions/assistant.py copy_replace_imports --source_dir="./docs" \
|
||||
--source_import="pytorch_lightning,lightning_fabric" \
|
||||
--target_import="lightning.pytorch,lightning.fabric"
|
||||
|
||||
- name: adjust paths
|
||||
run: |
|
||||
python -c "n = '${{ matrix.pkg-name }}' ; print('DOCS_DIR=source' + {'lightning': '', 'pytorch': '-pytorch'}.get(n))" >> $GITHUB_ENV
|
||||
python -c "n = '${{ matrix.pkg-name }}' ; print('REQ_DIR=' + {'lightning': 'app'}.get(n, n))" >> $GITHUB_ENV
|
||||
|
||||
- name: Install this package
|
||||
run: |
|
||||
pip install -e .[extra,cloud,ui] -U -r requirements/${{ env.REQ_DIR }}/docs.txt -f pypi -f ${TORCH_URL}
|
||||
pip install -e .[extra,cloud,ui] -U -r requirements/${{ matrix.pkg-name }}/docs.txt -f pypi -f ${TORCH_URL}
|
||||
pip list
|
||||
|
||||
- name: Test Documentation
|
||||
env:
|
||||
SPHINX_MOCK_REQUIREMENTS: 0
|
||||
working-directory: ./docs/${{ env.DOCS_DIR }}
|
||||
working-directory: ./docs/source-${{ matrix.pkg-name }}
|
||||
run: |
|
||||
make doctest
|
||||
make coverage
|
||||
|
@ -98,7 +85,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pkg-name: ["lightning", "pytorch"]
|
||||
pkg-name: ["app", "pytorch"]
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
|
@ -124,24 +111,19 @@ jobs:
|
|||
key: docs-make-${{ hashFiles('requirements/${{ matrix.pkg-name }}/*.txt') }}
|
||||
restore-keys: docs-make-
|
||||
|
||||
- name: adjust paths
|
||||
run: |
|
||||
python -c "n = '${{ matrix.pkg-name }}' ; print('DOCS_DIR=source' + {'lightning': '', 'pytorch': '-pytorch'}.get(n))" >> $GITHUB_ENV
|
||||
python -c "n = '${{ matrix.pkg-name }}' ; print('REQ_DIR=' + {'lightning': 'app'}.get(n, n))" >> $GITHUB_ENV
|
||||
|
||||
- name: Install package & dependencies
|
||||
run: |
|
||||
pip --version
|
||||
pip install -e . -U -r requirements/${{ env.REQ_DIR }}/docs.txt -f pypi -f ${TORCH_URL}
|
||||
pip install -e . -U -r requirements/${{ matrix.pkg-name }}/docs.txt -f pypi -f ${TORCH_URL}
|
||||
pip list
|
||||
shell: bash
|
||||
|
||||
- name: Make Documentation
|
||||
working-directory: ./docs/${{ env.DOCS_DIR }}
|
||||
working-directory: ./docs/source-${{ matrix.pkg-name }}
|
||||
run: make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
|
||||
|
||||
- name: Check External Links in Sphinx Documentation (Optional)
|
||||
working-directory: ./docs/${{ env.DOCS_DIR }}
|
||||
working-directory: ./docs/source-${{ matrix.pkg-name }}
|
||||
run: make linkcheck
|
||||
continue-on-error: true
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ jobs:
|
|||
pip list
|
||||
|
||||
- name: Make Documentation
|
||||
working-directory: ./docs/source
|
||||
working-directory: ./docs/source-app
|
||||
run: |
|
||||
# First run the same pipeline as Read-The-Docs
|
||||
make clean
|
||||
|
|
|
@ -7,8 +7,8 @@ lightning_logs/
|
|||
.vscode/
|
||||
|
||||
# Documentations
|
||||
docs/source/generated
|
||||
docs/source/*/generated
|
||||
docs/source-app/generated
|
||||
docs/source-app/*/generated
|
||||
docs/source-pytorch/api
|
||||
docs/source-pytorch/*.md
|
||||
docs/source-pytorch/generated
|
||||
|
|
|
@ -71,21 +71,21 @@ repos:
|
|||
hooks:
|
||||
- id: isort
|
||||
name: Format imports
|
||||
exclude: docs/source
|
||||
exclude: docs/source-app
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 22.12.0
|
||||
hooks:
|
||||
- id: black
|
||||
name: Format code
|
||||
exclude: docs/source
|
||||
exclude: docs/source-app
|
||||
|
||||
- repo: https://github.com/asottile/blacken-docs
|
||||
rev: 1.13.0
|
||||
hooks:
|
||||
- id: blacken-docs
|
||||
args: [--line-length=120]
|
||||
exclude: docs/source
|
||||
exclude: docs/source-app
|
||||
|
||||
- repo: https://github.com/executablebooks/mdformat
|
||||
rev: 0.7.16
|
||||
|
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
@ -136,8 +136,8 @@ master_doc = "index"
|
|||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# List of patterns, relative to source-app directory, that match files and
|
||||
# directories to ignore when looking for source-app files.
|
||||
# This pattern also affects html_static_path and html_extra_path.
|
||||
exclude_patterns = [
|
||||
"PULL_REQUEST_TEMPLATE.md",
|
||||
|
@ -208,7 +208,7 @@ latex_elements = {
|
|||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# (source-app start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, project + ".tex", project + " Documentation", author, "manual"),
|
||||
|
@ -217,13 +217,13 @@ latex_documents = [
|
|||
# -- Options for manual page output ------------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
# (source-app start file, name, description, authors, manual section).
|
||||
man_pages = [(master_doc, project, project + " Documentation", [author], 1)]
|
||||
|
||||
# -- Options for Texinfo output ----------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# (source-app start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(
|
||||
|
@ -324,7 +324,7 @@ autodoc_mock_imports = MOCK_PACKAGES
|
|||
|
||||
|
||||
# Resolve function
|
||||
# This function is used to populate the (source) links in the API
|
||||
# This function is used to populate the (source-app) links in the API
|
||||
def linkcode_resolve(domain, info):
|
||||
def find_source():
|
||||
# try to find the file and line number, based on code from numpy:
|
|
@ -229,7 +229,7 @@ from lightning.app.testing import run_app_in_cloud
|
|||
|
||||
def test_file_server_in_cloud():
|
||||
# You need to provide the directory containing the app file.
|
||||
app_dir = "docs/source/examples/file_server"
|
||||
app_dir = "docs/source-app/examples/file_server"
|
||||
with run_app_in_cloud(app_dir) as (admin_page, view_page, get_logs_fn, name):
|
||||
"""# 1. `admin_page` and `view_page` are playwright Page Objects.
|
||||
|