Skip to content

Commit

Permalink
Update dependencies and drop python <3.11
Browse files Browse the repository at this point in the history
This commit switches to pyproject.toml with Hatch/uv and drops support
for Python 3.8-3.10.

- Replace setup.py with pyproject.toml using Hatch/UV.
- Migrate project metadata and dependencies into pyproject.toml.
- Use Hatch and uv for building and dependency management.
- Update requires-python to ">=3.11" and remove support for Python 3.8-3.10.
- Removes tox and updates testing configurations to match.

TODO: Run pyupgrade --py311 plus
  • Loading branch information
jstvz committed Nov 12, 2024
1 parent a8d31ae commit 4bfae70
Show file tree
Hide file tree
Showing 31 changed files with 1,558 additions and 581 deletions.
15 changes: 0 additions & 15 deletions .coveragerc

This file was deleted.

22 changes: 22 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
changelog:
exclude:
labels:
- ignore-for-release
- auto-pr
- dependencies
authors:
- app/github-actions
categories:
- title: Critical Changes 🛠
labels:
- critical-change
- title: Changes 🎉
labels:
- enhancement
- "*"
exclude:
labels:
- bug
- title: Issues Fixed 🩴
labels:
- bug
98 changes: 41 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,101 +3,112 @@ name: CI
on: [push, workflow_dispatch]

env:
COVERALLS_PARALLEL: true
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
SF_MKDOCS_BUILD_LOCALES: "False"

jobs:
test:
name: "Python ${{ matrix.python-version }}"
runs-on: sfdc-ubuntu-latest
name: "Unit tests: ${{ matrix.os }}-${{ matrix.python-version }}"
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [macos-latest, SFDO-Tooling-Ubuntu, SFDO-Tooling-Windows]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"

- name: Install a specific version of uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true
- name: "Install dependencies"
run: |
python -VV
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: "Run tox targets for ${{ matrix.python-version }}"
run: python -m tox
uv sync -p ${{ matrix.python-version }}
- name: Report Coverage
run: coveralls
- name: "Run pytest"
run: uv run pytest

- name: Test snowbench
run: |
python setup.py install
snowbench snowfakery/tools/benchmark_1.yml --num-records 10_000 --num-records-tablename Account --number-of-processes 4
snowbench | tee bench.txt
uv run snowbench snowfakery/tools/benchmark_1.yml --num-records 10_000 --num-records-tablename Account --number-of-processes 4
uv run snowbench | tee bench.txt
tail -n 7 bench.txt >> $GITHUB_STEP_SUMMARY
with_cci:
name: With CumulusCI
runs-on: sfdc-ubuntu-latest
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: "actions/checkout@v4"
- run: |
git fetch --no-tags origin main:_remote_main_
- uses: "actions/setup-python@v5"
with:
python-version: "3.9"
python-version: "3.11"

- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true

- name: Install dependencies
run: |
python -VV
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
python -m pip install git+https://github.com/SFDO-Tooling/CumulusCI.git@main
uv sync -p 3.11
uv add git+https://github.com/SFDO-Tooling/CumulusCI.git@main
- name: Run Tests
run: |
python -m coverage run -m pytest
uv run coverage run -m pytest
- name: Check Coverage
run: |
coverage xml
coverage report
uv run coverage xml
uv run coverage report
git diff HEAD.._remote_main_
diff-cover coverage.xml --fail-under 100 --compare-branch=_remote_main_ --diff-range-notation=.. --show-uncovered --markdown-report coverage.md
uv run diff-cover coverage.xml --fail-under 100 --compare-branch=_remote_main_ --diff-range-notation=.. --show-uncovered --markdown-report coverage.md
cat coverage.md >> $GITHUB_STEP_SUMMARY
- name: Type Check
run: pyright
run: uv run pyright

faker_docs:
name: Faker Docs
runs-on: sfdc-ubuntu-latest
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.9"
python-version: "3.11"

- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true

- name: Install dependencies
run: |
python -VV
pip install -r requirements_dev.txt
pip install -r docs/requirements.txt
# docs build requires a proper install
python setup.py install
pip install .
- name: Make Docs
run: make docs

pip:
name: "Install from Pip ${{ matrix.python-version }}"
runs-on: sfdc-ubuntu-latest
runs-on: SFDO-Tooling-Ubuntu
strategy:
matrix:
python-version: ["3.8", "3.10"]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
Expand All @@ -117,30 +128,3 @@ jobs:
run: |
python -m snowfakery --version
windows:
name: Windows ${{ matrix.python-version }}
runs-on: sfdc-windows-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"

- name: "Install dependencies"
run: |
python -VV
python -m pip install --upgrade pip
pip install -r requirements_dev.txt
- name: Run Tests
run: python -m pytest

coveralls_done:
name: Finalize coveralls
needs: [test]
runs-on: sfdc-ubuntu-latest
steps:
- run: curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]=$GITHUB_SHA&payload[status]=done"
14 changes: 10 additions & 4 deletions .github/workflows/extra-checks-after-pull-request-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,25 @@ on:
jobs:
faker_docs:
name: Faker Docs I18N
runs-on: sfdc-ubuntu-latest
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: "actions/checkout@v4"
- uses: "actions/setup-python@v5"
with:
python-version: "3.9"
python-version: "3.11"

- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true

- name: Install dependencies
run: |
python -VV
pip install -r requirements_dev.txt
pip install -r mkdocs mkdocs-exclude-search
# docs build requires a proper install
python setup.py install
pip install .
- name: Make Docs
run: make docs
38 changes: 24 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,40 @@ on:
branches:
- main
paths:
- snowfakery/version.txt
- snowfakery/__about__.py
workflow_dispatch:

concurrency: publishing

jobs:
publish-to-pypi:
name: Publish new release to PyPI
runs-on: sfdc-ubuntu-latest
runs-on: SFDO-Tooling-Ubuntu
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install build tools
run: python -m pip install twine wheel
python-version: 3.11
cache: pip
- name: Set up uv
uses: SFDO-Tooling/setup-uv@main
with:
version: "0.5.0"
enable-cache: true
- name: Build source tarball and binary wheel
run: python setup.py sdist bdist_wheel
run: uv tool run hatch build -c
- name: Upload to PyPI
run: twine upload dist/*
run: uv tool run hatch publish
env:
HATCH_INDEX_USER: "__token__"
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
- name: Create release
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
- name: Create tag
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s -X POST https://api.github.com/repos/$GITHUB_REPOSITORY/git/refs -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d @- << EOF
{"ref": "refs/tags/v$(python setup.py --version)", "sha": "$GITHUB_SHA"}
EOF
VERSION="$(hatch version)"
gh release create "v$VERSION" \
dist/*.whl \
dist/*.tar.gz \
--title $VERSION
6 changes: 0 additions & 6 deletions .isort.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions .pyup.yml

This file was deleted.

14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
update-deps:
pip-compile --upgrade --allow-unsafe requirements/prod.in
pip-compile --upgrade --allow-unsafe requirements/dev.in
uv lock --upgrade
uv pip compile docs/requirements.in -o docs/requirements.txt --universal -p 3.11

dev-install:
pip install --upgrade pip-tools
pip-sync requirements/*.txt
pip install -e .
uv sync

# set SF_MKDOCS_BUILD_LOCALES=False to skip building all locales
docs: .FORCE
python -m mkdocs build --clean --site-dir build/html --config-file mkdocs.yml
mkdocs build --clean --site-dir build/html --config-file mkdocs.yml

coverage:
pytest --cov --cov-report=html
uv run pytest --cov --cov-report=html
open htmlcov/index.html

.FORCE:
.FORCE:
2 changes: 2 additions & 0 deletions docs/requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
mkdocs>=1.6.1
mkdocs-exclude-search>=0.6.6
49 changes: 49 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This file was autogenerated by uv via the following command:
# uv pip compile docs/requirements.in -o docs/requirements.txt --universal -p 3.11
click==8.1.7
# via mkdocs
colorama==0.4.6 ; platform_system == 'Windows'
# via
# click
# mkdocs
ghp-import==2.1.0
# via mkdocs
jinja2==3.1.4
# via mkdocs
markdown==3.7
# via mkdocs
markupsafe==3.0.2
# via
# jinja2
# mkdocs
mergedeep==1.3.4
# via
# mkdocs
# mkdocs-get-deps
mkdocs==1.6.1
# via
# -r docs/requirements.in
# mkdocs-exclude-search
mkdocs-exclude-search==0.6.6
# via -r docs/requirements.in
mkdocs-get-deps==0.2.0
# via mkdocs
packaging==24.2
# via mkdocs
pathspec==0.12.1
# via mkdocs
platformdirs==4.3.6
# via mkdocs-get-deps
python-dateutil==2.9.0.post0
# via ghp-import
pyyaml==6.0.2
# via
# mkdocs
# mkdocs-get-deps
# pyyaml-env-tag
pyyaml-env-tag==0.1
# via mkdocs
six==1.16.0
# via python-dateutil
watchdog==6.0.0
# via mkdocs
Loading

0 comments on commit 4bfae70

Please sign in to comment.