🔧 Refactor package manager, move from Flit to PDM, remove private pip extras for `test`, `doc`, `dev` (#764)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Sebastián Ramírez · committed by GitHub · parent 0fc00e2 · Browse files · 8 files·+124 added−81 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
8 files+124 added−81 removed
- other:+124 added−81 removed
Provenance
- Commit
207e868- Tree
31e6d8d- Author
Sebastián Ramírez <tiangolo@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
0fc00e2
8 files changed+124 added−81 removed
modified:.github/workflows/build-docs.yml+14 added-14 removed
15 unmodified lines161718192021222021222324252627282930313233348 unmodified lines4344454646474848495051525354555556575856575861596063646162636465666768697071727373747576767778798013 unmodified lines15 unmodified lines # Set job outputs to values from filter step outputs: docs: ${{ steps.filter.outputs.docs }} steps: - uses: actions/checkout@v3 # For pull requests it's not necessary to checkout the code but for the main branch it is - uses: dorny/paths-filter@v2 - uses: actions/checkout@v4 # For pull requests it's not necessary to checkout the code but for master it is - uses: dorny/paths-filter@v3 id: filter with: filters: | docs: - README.md - docs/** - docs_src/** - requirements-docs.txt - pyproject.toml - mkdocs.yml - mkdocs.insiders.yml - .github/workflows/build-docs.yml8 unmodified lines - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v3 - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 uses: actions/setup-python@v5 with: python-version: "3.11" - uses: actions/cache@v3 id: cache with: path: ${{ env.pythonLocation }} key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-v01 - name: Install Flit if: steps.cache.outputs.cache-hit != 'true' run: python -m pip install flit key: ${{ runner.os }}-python-docs-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-docs.txt') }}-v01 - name: Install docs extras if: steps.cache.outputs.cache-hit != 'true' run: python -m flit install --extras doc run: pip install -r requirements-docs.txt - name: Install Material for MkDocs Insiders if: ( github.event_name != 'pull_request' || github.secret_source == 'Actions' ) && steps.cache.outputs.cache-hit != 'true' run: python -m pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git if: ( github.event_name != 'pull_request' || github.secret_source != 'Actions' ) && steps.cache.outputs.cache-hit != 'true' run: | pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/squidfunk/mkdocs-material-insiders.git pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/griffe-typing-deprecated.git pip install git+https://${{ secrets.TYPER_MKDOCS_MATERIAL_INSIDERS }}@github.com/pawamoy-insiders/mkdocstrings-python.git - uses: actions/cache@v3 with: key: mkdocs-cards-${{ github.ref }}-v1 path: .cache - name: Build Docs if: github.event_name == 'pull_request' && github.secret_source != 'Actions' run: python -m mkdocs build - name: Build Docs with Insiders if: github.event_name != 'pull_request' || github.secret_source == 'Actions' if: ( github.event_name != 'pull_request' || github.secret_source != 'Actions' ) run: python -m mkdocs build --config-file mkdocs.insiders.yml
- uses: actions/upload-artifact@v3 with: name: docs-site path: ./site/**13 unmodified linesmodified:.github/workflows/deploy-docs.yml+2 added-2 removed
12 unmodified lines13141516171718192021222324242526272820 unmodified lines12 unmodified lines - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v3 - uses: actions/checkout@v4 - name: Clean site run: | rm -rf ./site mkdir ./site - name: Download Artifact Docs id: download uses: dawidd6/action-download-artifact@v2.27.0 uses: dawidd6/action-download-artifact@v3.1.4 with: if_no_artifact_found: ignore github_token: ${{ secrets.GITHUB_TOKEN }} workflow: build-docs.yml20 unmodified linesmodified:.github/workflows/publish.yml+26 added-10 removed
7 unmodified lines891011121314151216171418191617181920202122232425262728293031323334353637383923242540417 unmodified linesjobs: publish: runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v3 - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 uses: actions/setup-python@v5 with: python-version: "3.7" - name: Install Flit run: pip install flit - name: Install Dependencies run: flit install --symlink python-version: "3.10" # Issue ref: https://github.com/actions/setup-python/issues/436 # cache: "pip" # cache-dependency-path: pyproject.toml - uses: actions/cache@v3 id: cache with: path: ${{ env.pythonLocation }} key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} - name: Install build dependencies if: steps.cache.outputs.cache-hit != 'true' run: pip install build - name: Build distribution run: python -m build - name: Publish uses: pypa/gh-action-pypi-publish@v1.8.11 with: password: ${{ secrets.PYPI_API_TOKEN }} - name: Dump GitHub context env: FLIT_USERNAME: ${{ secrets.FLIT_USERNAME }} FLIT_PASSWORD: ${{ secrets.FLIT_PASSWORD }} run: bash scripts/publish.sh GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT"modified:.github/workflows/test.yml+29 added-16 removed
3 unmodified lines4 push:5 branches:6 - master7 pull_request:8- types: [opened, synchronize]8+ types:9+ - opened10+ - synchronize11 12 jobs:13 test:12- runs-on: ubuntu-20.0414+ runs-on: ubuntu-latest15 strategy:16 matrix:17 python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]18 fail-fast: false17-19 steps:20+ - name: Dump GitHub context21+ env:22+ GITHUB_CONTEXT: ${{ toJson(github) }}23+ run: echo "$GITHUB_CONTEXT"19- - uses: actions/checkout@v324+ - uses: actions/checkout@v425 - name: Set up Python21- uses: actions/setup-python@v426+ uses: actions/setup-python@v527 with:28 python-version: ${{ matrix.python-version }}24- - name: Install Flit25- run: pip install flit29+ # Issue ref: https://github.com/actions/setup-python/issues/43630+ # cache: "pip"31+ # cache-dependency-path: pyproject.toml32+ - uses: actions/cache@v333+ id: cache34+ with:35+ path: ${{ env.pythonLocation }}36+ key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml', 'requirements-tests.txt') }}37 - name: Install Dependencies27- run: python -m flit install --symlink38+ if: steps.cache.outputs.cache-hit != 'true'39+ run: pip install -r requirements-tests.txt40 - name: Lint41 run: bash scripts/lint.sh42 - run: mkdir coverage43 - name: Test9 unmodified lines53 54 coverage-combine:55 needs: [test]56 runs-on: ubuntu-latest45-57 steps:47- - uses: actions/checkout@v348-49- - uses: actions/setup-python@v458+ - name: Dump GitHub context59+ env:60+ GITHUB_CONTEXT: ${{ toJson(github) }}61+ run: echo "$GITHUB_CONTEXT"62+ - uses: actions/checkout@v463+ - uses: actions/setup-python@v564 with:65 python-version: '3.8'52-66+ # Issue ref: https://github.com/actions/setup-python/issues/43667+ # cache: "pip"68+ # cache-dependency-path: pyproject.toml69 - name: Get coverage files70 uses: actions/download-artifact@v371 with:72 name: coverage73 path: coverage58-74 - run: pip install coverage[toml]60-75 - run: ls -la coverage76 - run: coverage combine coverage77 - run: coverage report78 - run: coverage html --show-contexts --title "Coverage for ${{ github.sha }}"65-79 - name: Store coverage HTML80 uses: actions/upload-artifact@v381 with:82 name: coverage-html17 unmodified linesmodified:pyproject.toml+20 added-39 removed
1 [build-system]2-requires = ["flit_core >=2,<3"]3-build-backend = "flit_core.buildapi"2+requires = ["pdm-backend"]3+build-backend = "pdm.backend"4 5-[tool.flit.metadata]6-module = "typer"7-author = "Sebastián Ramírez"8-author-email = "tiangolo@gmail.com"9-home-page = "https://github.com/tiangolo/typer"5+[project]6+name = "typer"7+dynamic = ["version"]8+description = "Typer, build great CLIs. Easy to code. Based on Python type hints."9+authors = [10+ {name = "Sebastián Ramírez", email = "tiangolo@gmail.com"},11+]12+readme = "README.md"13+requires-python = ">=3.7"14 classifiers = [15 "Intended Audience :: Information Technology",16 "Intended Audience :: System Administrators",17 "Operating System :: OS Independent",11 unmodified lines29 "Programming Language :: Python :: 3.8",30 "Programming Language :: Python :: 3.9",31 "Programming Language :: Python :: 3.10",32 "Programming Language :: Python :: 3.11",29- "License :: OSI Approved :: MIT License"30- ]31-requires = [33+ "License :: OSI Approved :: MIT License",34+]35+dependencies = [36 "click >= 8.0.0",37 "typing-extensions >= 3.7.4.3",38 ]35-description-file = "README.md"36-requires-python = ">=3.7"39 38-[tool.flit.metadata.urls]40+[project.urls]41 Documentation = "https://typer.tiangolo.com/"42+homepage = "https://github.com/tiangolo/typer"43 41-[tool.flit.metadata.requires-extra]42-test = [43- "shellingham >=1.3.0,<2.0.0",44- "pytest >=4.4.0,<8.0.0",45- "pytest-cov >=2.10.0,<5.0.0",46- "coverage >=6.2,<7.0",47- "pytest-xdist >=1.32.0,<4.0.0",48- "pytest-sugar >=0.9.4,<0.10.0",49- "mypy ==0.971",50- "black >=22.3.0,<23.0.0",51- "isort >=5.0.6,<6.0.0",52- "rich >=10.11.0,<14.0.0",53-]54-doc = [55- "mkdocs >=1.1.2,<2.0.0",56- "mkdocs-material >=8.1.4,<9.0.0",57- "mdx-include >=1.4.1,<2.0.0",58- "pillow >=9.3.0,<10.0.0",59- "cairosvg >=2.5.2,<3.0.0",60-]61-dev = [62- "autoflake >=1.3.1,<2.0.0",63- "flake8 >=3.8.3,<4.0.0",64- "pre-commit >=2.17.0,<3.0.0",65-]44+[project.optional-dependencies]45 all = [46 "colorama >=0.4.3,<0.5.0",47 "shellingham >=1.3.0,<2.0.0",48 "rich >=10.11.0,<14.0.0",49 ]50 51+[tool.pdm]52+version = { source = "file", path = "typer/__init__.py" }53+54 [tool.isort]55 profile = "black"56 known_third_party = ["typer", "click"]57 skip_glob = [12 unmodified lines70 filterwarnings = [71 "error",72 # TODO: until I refactor completion to use the new shell_complete73 "ignore:'autocompletion' is renamed to 'shell_complete'. The old name is deprecated and will be removed in Click 8.1. See the docs about 'Parameter' for information about new behavior.:DeprecationWarning:typer",92- 'ignore:starlette.middleware.wsgi is deprecated and will be removed in a future release\..*:DeprecationWarning:starlette',74 # For pytest-xdist75 'ignore::DeprecationWarning:xdist',76 ]added:requirements-docs.txt+17 added
1+-e .2+3+mkdocs-material==9.4.74+mdx-include >=1.4.1,<2.0.05+mkdocs-markdownextradata-plugin >=0.1.7,<0.3.06+mkdocs-redirects>=1.2.1,<1.3.07+pyyaml >=5.3.1,<7.0.08+# For Material for MkDocs, Chinese search9+jieba==0.42.110+# For image processing by Material for MkDocs11+pillow==10.1.012+# For image processing by Material for MkDocs13+cairosvg==2.7.014+mkdocstrings[python]==0.23.015+griffe-typingdoc==0.2.216+# For griffe, it formats with black17+black==23.3.0added:requirements-tests.txt+10 added
1+-e .[all]2+3+pytest >=4.4.0,<8.0.04+pytest-cov >=2.10.0,<5.0.05+coverage[toml] >=6.2,<7.06+pytest-xdist >=1.32.0,<4.0.07+pytest-sugar >=0.9.4,<0.10.08+mypy ==0.9719+black >=22.3.0,<23.0.010+isort >=5.0.6,<6.0.0added:requirements.txt+6 added
1+-e .[all]2+3+-r requirements-tests.txt4+-r requirements-docs.txt5+6+pre-commit >=2.17.0,<4.0.0