Skip to content

Commit

Permalink
chore: use new features of uv
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelotduarte committed Jan 9, 2025
1 parent 96f01a0 commit 775156a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 87 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build-wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
84 changes: 9 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:

Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 2 additions & 4 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions ci/build-wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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='')")
Expand All @@ -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
Expand Down

0 comments on commit 775156a

Please sign in to comment.