Skip to content

Commit

Permalink
Migrate to setuptools_scm>=8.0 for dynamic __version__
Browse files Browse the repository at this point in the history
  • Loading branch information
wookayin committed Nov 6, 2023
1 parent 16491f3 commit 874c8d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
[build-system]
requires = [
"setuptools >= 64.0",
"setuptools_scm[toml]>=6.2",
"setuptools_scm[toml]>=8.0",
"wheel",
"setuptools-rust",
]

[tool.setuptools_scm]

[tool.isort]
# https://pycqa.github.io/isort/docs/configuration/options.html
profile = "google"
Expand Down
11 changes: 2 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,10 @@ def read_readme():
import setuptools_scm
except ImportError as ex:
raise ImportError("setuptools_scm not found. When running setup.py directly, "
"setuptools_scm needs to be installed manually. "
"setuptools_scm>=8.0 needs to be installed manually. "
"Or consider running `pip install -e .` instead.") from ex


def read_version():
return setuptools_scm.get_version()


__version__ = read_version()


# brought from https://github.com/kennethreitz/setup.py
class DeployCommand(Command):
description = 'Build and deploy the package to PyPI.'
Expand Down Expand Up @@ -158,7 +151,7 @@ def next_semver(version: setuptools_scm.version.ScmVersion):

setup(
name='expt',
version=__version__,
# version=__version__, # setuptools_scm sets version automatically
use_scm_version=dict(
write_to='expt/_version.py',
version_scheme=next_semver,
Expand Down

0 comments on commit 874c8d9

Please sign in to comment.