From 04eff854ffd497ab14259f765ada4d50fab08b4a Mon Sep 17 00:00:00 2001 From: luoyaoming Date: Tue, 7 May 2024 10:51:59 +0800 Subject: [PATCH] Import Upstream version 1.0.3 --- .github/workflows/cd.yml | 17 + .../workflows/reusable-change-detection.yml | 59 +++ .../{check.yml => reusable-docs.yml} | 15 +- .github/workflows/reusable-pytest.yml | 102 +++++ .github/workflows/reusable-type.yml | 26 ++ .github/workflows/test.yml | 153 ++----- .pre-commit-config.yaml | 50 +-- CHANGELOG.rst | 277 ++++++------ README.md | 5 +- debian/changelog | 5 - debian/control | 34 -- debian/copyright | 114 ----- debian/patches/series | 1 - debian/rules | 20 - debian/source/format | 1 - debian/upstream/metadata | 5 - debian/watch | 4 - docs/changelog.rst | 2 +- docs/conf.py | 9 + docs/index.rst | 6 +- docs/installation.rst | 33 +- docs/release.rst | 27 ++ pyproject.toml | 132 +++++- setup.cfg | 74 ---- setup.py | 5 - src/build/__init__.py | 394 ++++++------------ src/build/__main__.py | 121 +++--- src/build/_exceptions.py | 70 ++++ src/build/_importlib.py | 14 + src/build/_util.py | 88 ++++ src/build/env.py | 244 +++++------ src/build/util.py | 58 +-- tests/conftest.py | 32 +- tests/constraints.txt | 11 +- .../test-bad-wheel/backend_bad_wheel.py | 2 +- .../backend_bad_sdist.py | 3 +- .../test-no-prepare/backend_no_prepare.py | 3 +- tests/test_env.py | 32 +- tests/test_integration.py | 13 +- tests/test_main.py | 53 ++- tests/test_main_helpers.py | 11 + tests/test_projectbuilder.py | 179 +++----- tests/test_self_packaging.py | 50 ++- tests/test_util.py | 12 +- tox.ini | 83 ++-- 45 files changed, 1298 insertions(+), 1351 deletions(-) create mode 100644 .github/workflows/cd.yml create mode 100644 .github/workflows/reusable-change-detection.yml rename .github/workflows/{check.yml => reusable-docs.yml} (65%) create mode 100644 .github/workflows/reusable-pytest.yml create mode 100644 .github/workflows/reusable-type.yml delete mode 100644 debian/changelog delete mode 100644 debian/control delete mode 100644 debian/copyright delete mode 100644 debian/patches/series delete mode 100755 debian/rules delete mode 100644 debian/source/format delete mode 100644 debian/upstream/metadata delete mode 100644 debian/watch mode change 120000 => 100644 docs/changelog.rst create mode 100644 docs/release.rst delete mode 100644 setup.cfg delete mode 100644 setup.py create mode 100644 src/build/_exceptions.py create mode 100644 src/build/_importlib.py create mode 100644 src/build/_util.py create mode 100644 tests/test_main_helpers.py diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..f4e80bc --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,17 @@ +name: CD + +on: + workflow_dispatch: + pull_request: + branches: + - main + release: + types: + - published + +jobs: + dist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: hynek/build-and-inspect-python-package@v1 diff --git a/.github/workflows/reusable-change-detection.yml b/.github/workflows/reusable-change-detection.yml new file mode 100644 index 0000000..fa2bfcb --- /dev/null +++ b/.github/workflows/reusable-change-detection.yml @@ -0,0 +1,59 @@ +name: change detection +on: + workflow_call: + outputs: + run-docs: + description: Whether or not build the docs + value: ${{ jobs.change-detection.outputs.run-docs || false }} + run-tests: + description: Whether or not run the tests + value: ${{ jobs.change-detection.outputs.run-tests || false }} + +jobs: + change-detection: + name: Identify source changes + runs-on: ubuntu-latest + timeout-minutes: 1 + outputs: + run-docs: ${{ steps.docs-changes.outputs.run-docs || false }} + run-tests: ${{ steps.tests-changes.outputs.run-tests || false }} + steps: + - uses: actions/checkout@v4 + - name: Get a list of the changed runtime-related files + if: github.event_name == 'pull_request' + id: changed-testable-files + uses: Ana06/get-changed-files@v2.2.0 + with: + filter: | + src/** + tests/** + tox.ini + pyproject.toml + .github/workflows/test.yml + .github/workflows/reusable-type.yml + .github/workflows/reusable-pytest.yml + - name: Set a flag for running the tests + if: >- + github.event_name != 'pull_request' + || steps.changed-testable-files.outputs.added_modified_renamed != '' + id: tests-changes + run: >- + echo "run-tests=true" >> "${GITHUB_OUTPUT}" + - name: Get a list of the changed documentation-related files + if: github.event_name == 'pull_request' + id: changed-docs-files + uses: Ana06/get-changed-files@v2.2.0 + with: + filter: | + docs/** + CHANGELOG.rst + README.md + .github/workflows/test.yml + .github/workflows/reusable-check.yml + - name: Set a flag for building the docs + if: >- + github.event_name != 'pull_request' + || steps.changed-docs-files.outputs.added_modified_renamed != '' + id: docs-changes + run: >- + echo "run-docs=true" >> "${GITHUB_OUTPUT}" diff --git a/.github/workflows/check.yml b/.github/workflows/reusable-docs.yml similarity index 65% rename from .github/workflows/check.yml rename to .github/workflows/reusable-docs.yml index c6e9bfb..b0216c4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/reusable-docs.yml @@ -1,13 +1,6 @@ name: check on: - push: - branches: - - main - pull_request: - branches: - - main - schedule: - - cron: "0 8 * * *" + workflow_call: jobs: docs: @@ -16,12 +9,12 @@ jobs: PY_COLORS: 1 TOX_PARALLEL_NO_SPINNER: 1 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Setup Python 3.9 + - name: Setup Python 3.10 uses: actions/setup-python@v4 with: - python-version: 3.9 + python-version: "3.10" - name: Install tox run: python -m pip install tox diff --git a/.github/workflows/reusable-pytest.yml b/.github/workflows/reusable-pytest.yml new file mode 100644 index 0000000..48eda8d --- /dev/null +++ b/.github/workflows/reusable-pytest.yml @@ -0,0 +1,102 @@ +name: pytest +on: + workflow_call: + +jobs: + pytest: + runs-on: ${{ matrix.os }}-latest + env: + PYTEST_ADDOPTS: "--run-integration --showlocals -vv --durations=10 --reruns 5 --only-rerun subprocess.CalledProcessError" + strategy: + fail-fast: false + matrix: + os: + - ubuntu + - macos + - windows + py: + - "pypy-3.7" + - "pypy-3.8" + - "pypy-3.9" + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + - "3.7" + tox-target: + - "tox" + - "min" + + continue-on-error: >- # jobs not required in branch protection + ${{ + ( + startsWith(matrix.py, 'pypy-') + && (!endsWith(matrix.py, '-3.7') || matrix.os == 'windows') + ) + && true + || false + }} + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup python for test ${{ matrix.py }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.py }} + allow-prereleases: true + + - name: Pick environment to run + run: | + import platform + import os + import sys + + if platform.python_implementation() == "PyPy": + base = f"pypy{sys.version_info.major}{sys.version_info.minor}" + else: + base = f"py{sys.version_info.major}{sys.version_info.minor}" + env = f"BASE={base}\n" + print(f"Picked:\n{env}for {sys.version}") + with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as file: + file.write(env) + shell: python + + - name: Setup python for tox + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install tox + run: python -m pip install tox + + - name: Run test suite via tox + if: matrix.tox-target == 'tox' + run: | + tox -vv --notest -e ${{env.BASE}} + tox -e ${{env.BASE}} --skip-pkg-install + + - name: Run minimum version test + if: matrix.tox-target == 'min' + run: tox -e ${{env.BASE}}-${{ matrix.tox-target }} + + - name: Run path test + if: matrix.tox-target == 'tox' && matrix.py == '3.10' + run: tox -e path + + - name: Combine coverage files + if: always() + run: tox -e coverage + + - uses: codecov/codecov-action@v3 + if: always() + env: + PYTHON: ${{ matrix.python }} + with: + file: ./.tox/coverage.xml + flags: tests + env_vars: PYTHON + name: ${{ matrix.py }} - ${{ matrix.os }} diff --git a/.github/workflows/reusable-type.yml b/.github/workflows/reusable-type.yml new file mode 100644 index 0000000..76e78d7 --- /dev/null +++ b/.github/workflows/reusable-type.yml @@ -0,0 +1,26 @@ +name: type +on: + workflow_call: + +jobs: + type: + runs-on: ubuntu-latest + env: + PY_COLORS: 1 + TOX_PARALLEL_NO_SPINNER: 1 + steps: + - uses: actions/checkout@v4 + + - name: Setup Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install tox + run: python -m pip install tox + + - name: Setup run environment + run: tox -vv --notest -e type + + - name: Run check for type + run: tox -e type --skip-pkg-install diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 21e1321..8edc0ca 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,15 +3,9 @@ on: push: branches: - main - paths-ignore: - - "docs/**" - - "*.md" pull_request: branches: - main - paths-ignore: - - "docs/**" - - "*.md" schedule: - cron: "0 8 * * *" workflow_dispatch: @@ -21,111 +15,54 @@ concurrency: cancel-in-progress: true jobs: + change-detection: + uses: ./.github/workflows/reusable-change-detection.yml + + check-docs: + needs: change-detection + if: fromJSON(needs.change-detection.outputs.run-docs) + uses: ./.github/workflows/reusable-docs.yml + pytest: - runs-on: ${{ matrix.os }}-latest - env: - PYTEST_ADDOPTS: "--run-integration --showlocals -vv --durations=10 --reruns 5 --only-rerun subprocess.CalledProcessError" - strategy: - fail-fast: false - matrix: - os: - - ubuntu - - macos - - windows - py: - - "pypy-3.7" - - "pypy-3.8" - - "pypy-3.9" - - "3.11" - - "3.10" - - "3.9" - - "3.8" - - "3.7" - - "3.6" - tox-target: - - "tox" - - "min" - - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Setup python for test ${{ matrix.py }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.py }} - - - name: Pick environment to run - run: | - import platform - import os - import sys - - if platform.python_implementation() == "PyPy": - base = f"pypy{sys.version_info.major}{sys.version_info.minor}" - else: - base = f"py{sys.version_info.major}{sys.version_info.minor}" - env = f"BASE={base}\n" - print(f"Picked:\n{env}for {sys.version}") - with open(os.environ["GITHUB_ENV"], "a", encoding="utf-8") as file: - file.write(env) - shell: python - - - name: Setup python for tox - uses: actions/setup-python@v4 - with: - python-version: 3.9 - - - name: Install tox - run: python -m pip install tox - - - name: Run test suite via tox - if: matrix.tox-target == 'tox' - run: | - tox -vv --notest -e ${{env.BASE}} - tox -e ${{env.BASE}} --skip-pkg-install - - - name: Run minimum version test - if: matrix.tox-target == 'min' - run: tox -e ${{env.BASE}}-${{ matrix.tox-target }} - - - name: Run path test - if: matrix.tox-target == 'tox' && matrix.py == '3.10' - run: tox -e path - - - name: Combine coverage files - if: always() - run: tox -e coverage - - - uses: codecov/codecov-action@v3 - if: always() - env: - PYTHON: ${{ matrix.python }} - with: - file: ./.tox/coverage.xml - flags: tests - env_vars: PYTHON - name: ${{ matrix.py }} - ${{ matrix.os }} + needs: change-detection + if: fromJSON(needs.change-detection.outputs.run-tests) + uses: ./.github/workflows/reusable-pytest.yml type: + needs: change-detection + if: fromJSON(needs.change-detection.outputs.run-tests) + uses: ./.github/workflows/reusable-type.yml + + # https://github.com/marketplace/actions/alls-green#why + required-checks-pass: # This job does nothing and is only used for the branch protection + if: always() + + needs: + - change-detection # transitive + - check-docs + - pytest + - type + runs-on: ubuntu-latest - env: - PY_COLORS: 1 - TOX_PARALLEL_NO_SPINNER: 1 + steps: - - uses: actions/checkout@v3 - - - name: Setup Python 3.9 - uses: actions/setup-python@v4 + - name: Decide whether the needed jobs succeeded or failed + uses: re-actors/alls-green@release/v1 with: - python-version: 3.9 - - - name: Install tox - run: python -m pip install tox - - - name: Setup run environment - run: tox -vv --notest -e type - - - name: Run check for type - run: tox -e type --skip-pkg-install + allowed-skips: >- + ${{ + fromJSON(needs.change-detection.outputs.run-docs) + && '' + || ' + check-docs, + ' + }} + ${{ + fromJSON(needs.change-detection.outputs.run-tests) + && '' + || ' + pytest, + type, + ' + }} + jobs: ${{ toJSON(needs) }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c72733..59f7c34 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,7 +4,7 @@ ci: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-ast - id: check-builtin-literals @@ -17,52 +17,40 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - id: double-quote-string-fixer - - repo: https://github.com/asottile/pyupgrade - rev: v3.1.0 + - repo: https://github.com/abravalheri/validate-pyproject + rev: v0.14 hooks: - - id: pyupgrade - args: ["--py36-plus"] - - repo: https://github.com/psf/black - rev: 22.10.0 + - id: validate-pyproject + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 23.7.0 hooks: - id: black - repo: https://github.com/asottile/blacken-docs - rev: v1.12.1 + rev: 1.16.0 hooks: - id: blacken-docs - additional_dependencies: [black==22.6] + additional_dependencies: [black==23.7.0] - repo: https://github.com/pre-commit/mirrors-prettier - rev: "v3.0.0-alpha.2" + rev: "v3.0.3" hooks: - id: prettier - - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.0.287 hooks: - - id: isort - - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.1.0 - hooks: - - id: setup-cfg-fmt - args: [--include-version-classifiers, --max-py-version=3.11] - - repo: https://github.com/PyCQA/flake8 - rev: "5.0.4" - hooks: - - id: flake8 - additional_dependencies: ["flake8-bugbear==22.7.1"] - language_version: python3.9 + - id: ruff + args: [--fix, --format, grouped, --show-fixes] - repo: https://github.com/codespell-project/codespell - rev: "v2.2.2" + rev: "v2.2.5" hooks: - id: codespell args: ["-L", "sur"] - repo: https://github.com/pre-commit/pygrep-hooks - rev: "v1.9.0" + rev: "v1.10.0" hooks: - - id: python-check-blanket-noqa - - id: python-check-blanket-type-ignore - - id: python-no-log-warn - - id: python-no-eval - - id: python-use-type-annotations - id: rst-backticks - id: rst-directive-colons - id: rst-inline-touching-normal + - repo: https://github.com/tox-dev/tox-ini-fmt + rev: "1.3.1" + hooks: + - id: tox-ini-fmt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3e6bde6..b3210f6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,257 +2,224 @@ Changelog +++++++++ +1.0.3 (2023-09-06) +================== + +- Avoid CPython 3.8.17, 3.9.17, 3.10.12, and 3.11.4 tarfile symlink bug + triggered by adding ``data_filter`` in 1.0.0. + (PR :pr:`675`, fixes issue :issue:`674`) + + +1.0.0 (2023-09-01) +================== + +- Removed the ``toml`` library fallback; ``toml`` can no longer be used + as a substitute for ``tomli`` + (PR :pr:`567`) +- Added ``runner`` parameter to ``util.project_wheel_metadata`` + (PR :pr:`566`, fixes issue :issue:`553`) +- Modified ``ProjectBuilder`` constructor signature, added alternative + ``ProjectBuilder.from_env`` constructor, redefined ``env.IsolatedEnv`` + interface, and exposed ``env.DefaultIsolatedEnv``, replacing + ``env.IsolatedEnvBuilder``. The aim has been to shift responsibility for + modifying the environment from the project builder to the ``IsolatedEnv`` + entirely and to ensure that the builder will be initialised from an + ``IsolatedEnv`` in a consistent manner. Mutating the project builder is no + longer supported. + (PR :pr:`537`) +- ``virtualenv`` is no longer imported when using ``-n``, for faster builds + (PR :pr:`636`, fixes issue :issue:`510`) +- The SDist now contains the repository contents, including tests. Flit-core + 3.8+ required. + (PR :pr:`657`, :pr:`661`, fixes issue :issue:`656`) +- The minimum version of ``importlib-metadata`` has been increased to 4.6 and + Python 3.10 due to a bug in the standard library version with URL + requirements in extras. This is still not required for 3.8 when bootstrapping + (as long as you don't have URL requirements in extras). + (PR :pr:`631`, fixes issue :issue:`630`) +- Docs now built with Sphinx 7 + (PR :pr:`660`) +- Tests now contain a ``network`` marker + (PR :pr:`649`, fixes issue :issue:`648`) +- Config-settings are now passed to ``get_requires*`` hooks, fixing a long + standing bug. If this affects your setuptools build, you can use + ``-C--build-option= -C--build-option=