From 775156a0394d3f5da422794df60c37d875a88daa Mon Sep 17 00:00:00 2001 From: Marcelo Duarte Date: Thu, 9 Jan 2025 01:31:58 -0300 Subject: [PATCH] chore: use new features of uv --- .github/workflows/build-wheel.yml | 4 +- .github/workflows/ci.yml | 84 ++++--------------------------- .readthedocs.yaml | 6 +-- Makefile | 6 +-- ci/build-wheel.sh | 4 +- 5 files changed, 17 insertions(+), 87 deletions(-) diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index a3060f69c..51477cc7b 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -70,9 +70,7 @@ jobs: - uses: astral-sh/setup-uv@v5 with: enable-cache: true - cache-dependency-glob: | - requirements.txt - requirements-dev.txt + cache-dependency-glob: "pyproject.toml" - name: Set up QEMU if: runner.os == 'Linux' && matrix.arch != 'x86_64' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e40268871..ff87e5cac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-14] - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.13t'] include: - os: macos-13 # macos-13 is x86_64 python-version: '3.9' @@ -70,11 +70,12 @@ jobs: python-version: '3.10' - os: macos-14 python-version: '3.11' + - os: windows-latest # provisional + python-version: '3.13t' defaults: run: shell: bash env: - UV_SYSTEM_PYTHON: true UV_NO_PROGRESS: true steps: @@ -88,77 +89,14 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + if: matrix.python-version != '3.13t' - uses: astral-sh/setup-uv@v5 with: enable-cache: true - cache-dependency-glob: | - requirements.txt - tests/requirements.txt - - - name: Download the wheel - uses: actions/download-artifact@v4 - with: - merge-multiple: true - pattern: cx-freeze-whl-${{ matrix.os }}* - path: wheelhouse - - - name: Install dependencies to test - run: | - uv pip install -r requirements.txt -r tests/requirements.txt - uv pip install cx_Freeze --no-index --no-deps -f wheelhouse --reinstall - - - name: Generate coverage report - env: - COVERAGE_FILE: ".coverage.${{ matrix.python-version }}.${{ matrix.os }}" - run: pytest -nauto --cov="cx_Freeze" - - - name: Upload coverage reports - uses: actions/upload-artifact@v4 - with: - name: cov-${{ matrix.python-version }}.${{ matrix.os }} - path: .coverage.* - include-hidden-files: true - - test_free_threaded: - needs: - - build_wheel - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, macos-14] - python-version: ['3.13t'] - fail-fast: false - defaults: - run: - shell: bash - env: - UV_NO_PROGRESS: true - steps: - - - name: Install dependencies (Linux) - if: runner.os == 'Linux' - run: sudo apt-get install -qy alien fakeroot rpm - - - uses: actions/checkout@v4 - with: - ref: ${{ inputs.branch }} - repository: marcelotduarte/cx_Freeze - - - uses: astral-sh/setup-uv@v5 - with: - enable-cache: true - cache-dependency-glob: | - requirements.txt - tests/requirements.txt + cache-dependency-glob: "pyproject.toml" python-version: ${{ matrix.python-version }} - - name: Env - run: env | sort - - - name: Sysconfig - run: uv run --no-project -m sysconfig - - name: Download the wheel uses: actions/download-artifact@v4 with: @@ -213,9 +151,7 @@ jobs: - uses: astral-sh/setup-uv@v5 with: enable-cache: true - cache-dependency-glob: | - requirements.txt - tests/requirements.txt + cache-dependency-glob: "pyproject.toml" - name: Download the wheel uses: actions/download-artifact@v4 @@ -226,7 +162,7 @@ jobs: - name: Install dependencies to test run: | - uv pip install -r requirements.txt -r tests/requirements.txt + uv pip install --extra tests --upgrade -r pyproject.toml uv pip install cx_Freeze --no-index --no-deps -f wheelhouse --reinstall - name: Generate coverage report @@ -273,9 +209,7 @@ jobs: - uses: astral-sh/setup-uv@v5 with: enable-cache: true - cache-dependency-glob: | - requirements.txt - tests/requirements.txt + cache-dependency-glob: "pyproject.toml" - name: Download the wheel uses: actions/download-artifact@v4 @@ -286,7 +220,7 @@ jobs: - name: Install dependencies to test run: | - uv pip install -r requirements.txt -r tests/requirements.txt + uv pip install --extra tests --upgrade -r pyproject.toml uv pip install cx_Freeze --no-index --no-deps -f wheelhouse --reinstall - name: Install dependencies - extra diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 59aa932d8..3ebb5f1d9 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -10,8 +10,6 @@ build: - asdf plugin add uv - asdf install uv latest - asdf global uv latest - - rm .python-version - - uv venv - - uv sync --extra doc - - uv run -m sphinx + - uv sync -p $(which python) --no-install-project --extra doc + - uv run -p .venv/bin/python -m sphinx doc/src $READTHEDOCS_OUTPUT/html -j auto -T -W --keep-going -n -b html diff --git a/Makefile b/Makefile index 524e6bb6d..2219a0079 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ else env UV_INSTALL_DIR="$(HOME)/bin" INSTALLER_NO_MODIFY_PATH=1 sh endif if ! which pre-commit || ! [ -f .git/hooks/pre-commit ]; then\ - uv sync --extra dev --extra doc --upgrade &&\ + uv pip install --extra dev --extra doc --upgrade -r pyproject.toml &&\ pre-commit install --install-hooks --overwrite -t pre-commit;\ fi @@ -53,11 +53,11 @@ upgrade: clean install .PHONY: html html: + uv pip install --extra doc --upgrade -r pyproject.toml @if which pre-commit && [ -f .git/hooks/pre-commit ]; then\ pre-commit run blacken-docs $(PRE_COMMIT_OPTIONS);\ pre-commit run build-docs $(PRE_COMMIT_OPTIONS);\ else\ - uv sync --no-install-project --extra doc --upgrade && \ $(MAKE) -C doc html;\ fi @@ -72,7 +72,7 @@ doc: html .PHONY: install_pytest install_pytest: - uv sync --no-install-project --extra tests --upgrade + uv pip install --extra tests --upgrade -r pyproject.toml ./ci/build-wheel.sh .PHONY: tests diff --git a/ci/build-wheel.sh b/ci/build-wheel.sh index 62d20af3a..b8cb6d511 100755 --- a/ci/build-wheel.sh +++ b/ci/build-wheel.sh @@ -90,7 +90,7 @@ _cibuildwheel () { } echo "::group::Install dependencies and build tools" -uv pip install -r requirements.txt +uv pip install --upgrade -r pyproject.toml VERSION=$(_bump_my_version show current_version) if [[ $VERSION == *-* ]]; then VERSION_OK=$($PYTHON -c "print(''.join('$VERSION'.replace('-','.').rsplit('.',1)), end='')") @@ -112,7 +112,7 @@ if [ "$BUILD_TAG" == "--only" ]; then FILEEXISTS=$(ls "wheelhouse/$FILEMASK.whl" 2>/dev/null || echo '') if [ "$DIRTY" != "False" ] || [ -z "$FILEEXISTS" ]; then if [[ $PY_PLATFORM == win* ]]; then - uv build --no-build-isolation --wheel -o wheelhouse + uv build -p $PY_VERSION$PY_ABI_THREAD --wheel -o wheelhouse else _cibuildwheel --only "$PYTHON_TAG-$PLATFORM_TAG" fi