Skip to content

Commit

Permalink
Switch to hatchling build backend
Browse files Browse the repository at this point in the history
  • Loading branch information
theOehrly committed Dec 28, 2023
1 parent 7f1a856 commit f51b6df
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 14 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build setuptools setuptools_scm twine
python -m pip install --upgrade build hatch twine
# if this is a release, upload to PyPI
- name: Build and publish release
Expand All @@ -28,7 +28,7 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
PACKAGE_VERSION=$(python -m setuptools_scm)
PACKAGE_VERSION=$(hatch version)
echo "Creating package with version $PACKAGE_VERSION"
python -m build
twine upload dist/*
Expand All @@ -41,9 +41,8 @@ jobs:
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN}}
# override setuptools_scm config to remove local version, else PyPI will not accept the package
# this allows to push development releases to the test index from any repository state
SETUPTOOLS_SCM_OVERRIDES_FOR_FASTF1: local_scheme="no-local-version"
run: |
PACKAGE_VERSION=$(python -m setuptools_scm)
PACKAGE_VERSION=$(hatch version)
echo "Creating package with version $PACKAGE_VERSION"
python -m build
twine upload --repository testpypi dist/*
42 changes: 32 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,41 @@ dependencies = [
"Documentation" = "https://docs.fastf1.dev"

[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[tool.setuptools.packages.find]
where = [""]
include = ["fastf1*"]
exclude = ["fastf1/testing*"]
namespaces = false
[tool.hatch.version]
source = "vcs"

[tool.setuptools_scm]
version_file = "fastf1/_version.py"
[tool.hatch.build.targets.wheel]
ignore-vcs = true
include = [
"fastf1/**",
]
exclude = [
"fastf1/tests/**",
"fastf1/testing/**",
]

[tool.hatch.build.targets.sdist]
ignore-vcs = true
include = [
"fastf1/**",
"requirements/**",
"examples/**"
]
exclude = [
"fastf1/tests/**",
"fastf1/testing/**",
]

[tool.hatch.build.hooks.vcs]
version-file = "fastf1/_version.py"

[tool.hatch.version.raw-options]
# configures setuptools_scm within the hatchling build backend
version_scheme = "release-branch-semver"
local_scheme = "node-and-date"
local_scheme = "no-local-version" # needed for PyPI support for dev releases; hatch-vcs ignores setuptools_scm overrides through env vars
fallback_version = "0.0+UNKNOWN"

[tool.ruff]
Expand Down

0 comments on commit f51b6df

Please sign in to comment.