Skip to content

Commit

Permalink
implement new versioning scheme
Browse files Browse the repository at this point in the history
The pyproject.toml file is now the single location for the version to be declared. It will be read by __init__.py automatically.
The old system used setuptools-scm but apparently that has the unintended side-effect of adding all files tracked by version control to the sdist! yikes
Refer to pypa/setuptools-scm#190 for more details
  • Loading branch information
aryarm committed Nov 24, 2023
1 parent fb7df11 commit 4802488
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions .readthedocs_conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies:
- sphinx=3.0.4
- pytest
- pytest-cov
- importlib-metadata
- numpy
- pybedtools
- matplotlib-base
Expand Down
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
name = "trtools"
version = "5.1.1"
authors = [
{name = "Melissa Gymrek", email = "[email protected]"},
{name = "Gymrek Lab"},
Expand All @@ -20,6 +21,7 @@ classifiers = [
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
dependencies = [
"importlib-metadata", # required as long as we support py<3.8
"cyvcf2",
"matplotlib",
"numpy",
Expand All @@ -31,16 +33,13 @@ dependencies = [
"statsmodels",
"pyfaidx",
]
dynamic = ["version"]

[tool.setuptools]
packages = ["trtools"]
script-files = ["trtools/testsupport/test_trtools.sh", "scripts/trtools_prep_beagle_vcf.sh"]
license-files = ["LICENSE.txt"]

[tool.setuptools_scm]
# generated automatically by setuptools when running pip install -e or python -m build
version_file = "trtools/version.py"
[tool.setuptools.packages.find]
exclude = ["trtools.testsupport.*", "doc"]

[project.scripts]
dumpSTR = "trtools.dumpSTR:run"
Expand Down
10 changes: 8 additions & 2 deletions trtools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
try:
from .version import __version__
except ModuleNotFoundError:
from importlib.metadata import version, PackageNotFoundError
except ImportError:
# handles py3.7, since importlib.metadata was introduced in py3.8
from importlib_metadata import version, PackageNotFoundError

try:
__version__ = version(__name__)
except PackageNotFoundError:
__version__ = "unknown"

0 comments on commit 4802488

Please sign in to comment.