diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a6f31c106..8252a9fc6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,14 +40,19 @@ jobs: with: persist-credentials: false + - name: Install build + run: python -Im pip install build -c test-requirements.txt + - name: Get the dist version id: dist-version - run: >- - echo "version=$( - grep ^__version__ src/trio/_version.py - | sed 's#__version__ = "\([^"]\+\)"#\1#' - )" - >> "${GITHUB_OUTPUT}" + shell: python + run: | + import os + import build.util + version = build.util.project_wheel_metadata(".")["version"] + + with open(os.environ["GITHUB_OUTPUT"], mode="a", encoding="utf8") as f: + f.write(f"version={version}") - name: Set the expected dist artifact names id: artifact-name @@ -58,9 +63,6 @@ jobs: DIST_NAME: ${{ env.dist-name }} VERSION: ${{ steps.dist-version.outputs.version }} - - name: Install build - run: python -Im pip install build - - name: Build dists run: python -Im build - name: Verify that the artifacts with expected names got created diff --git a/ci.sh b/ci.sh index 83ec65748..5138c2da4 100755 --- a/ci.sh +++ b/ci.sh @@ -41,7 +41,7 @@ python -m pip install -U pip uv -c test-requirements.txt python -m pip --version python -m uv --version -python -m uv pip install build +python -m uv pip install build -c test-requirements.txt python -m build wheel_package=$(ls dist/*.whl) diff --git a/test-requirements.in b/test-requirements.in index 809e171e3..b578ca825 100644 --- a/test-requirements.in +++ b/test-requirements.in @@ -10,6 +10,7 @@ jedi; implementation_name == "cpython" # for jedi code completi cryptography>=41.0.0 # cryptography<41 segfaults on pypy3.10 # Tools +build black; implementation_name == "cpython" mypy # Would use mypy[faster-cache], but orjson has build issues on pypy orjson; implementation_name == "cpython" diff --git a/test-requirements.txt b/test-requirements.txt index a5c17a256..09ce81fe1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -16,6 +16,8 @@ babel==2.16.0 # via sphinx black==24.10.0 ; implementation_name == 'cpython' # via -r test-requirements.in +build==1.2.2.post1 + # via -r test-requirements.in certifi==2024.8.30 # via requests cffi==1.17.1 ; platform_python_implementation != 'PyPy' or os_name == 'nt' @@ -28,8 +30,9 @@ click==8.1.7 ; implementation_name == 'cpython' # via black codespell==2.3.0 # via -r test-requirements.in -colorama==0.4.6 ; (implementation_name != 'cpython' and sys_platform == 'win32') or (platform_system != 'Windows' and sys_platform == 'win32') or (implementation_name == 'cpython' and platform_system == 'Windows') +colorama==0.4.6 ; (implementation_name != 'cpython' and sys_platform == 'win32') or (platform_system != 'Windows' and sys_platform == 'win32') or (implementation_name == 'cpython' and platform_system == 'Windows') or os_name == 'nt' # via + # build # click # pylint # pytest @@ -57,8 +60,10 @@ idna==3.10 # trustme imagesize==1.4.1 # via sphinx -importlib-metadata==8.5.0 ; python_full_version < '3.10' - # via sphinx +importlib-metadata==8.5.0 ; python_full_version < '3.10.2' + # via + # build + # sphinx iniconfig==2.0.0 # via pytest isort==5.13.2 @@ -87,6 +92,7 @@ outcome==1.3.0.post0 packaging==24.2 # via # black + # build # pytest # sphinx parso==0.8.4 ; implementation_name == 'cpython' @@ -107,6 +113,8 @@ pylint==3.3.1 # via -r test-requirements.in pyopenssl==24.2.1 # via -r test-requirements.in +pyproject-hooks==1.2.0 + # via build pyright==1.1.389 # via -r test-requirements.in pytest==8.3.3 @@ -138,6 +146,7 @@ sphinxcontrib-serializinghtml==2.0.0 tomli==2.2.1 ; python_full_version < '3.11' # via # black + # build # mypy # pylint # pytest @@ -168,5 +177,5 @@ urllib3==2.2.3 # via requests uv==0.5.5 # via -r test-requirements.in -zipp==3.21.0 ; python_full_version < '3.10' +zipp==3.21.0 ; python_full_version < '3.10.2' # via importlib-metadata