Skip to content

Commit

Permalink
Use setuptools-scm for Vamb versioning
Browse files Browse the repository at this point in the history
This tool will automatically set the correct Vamb version based on Git info.
This is useful for several reasons:
* It makes it harder for us to mess up the versions on release
* When testing Vamb, the log file will tell us the exact commit used
  • Loading branch information
jakobnissen committed Nov 27, 2023
1 parent b10b2cc commit d3ea938
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 110 deletions.
10 changes: 7 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ authors = [
url = "https://github.com/RasmussenLab/vamb"
description = "Variational and Adversarial autoencoders for Metagenomic Binning"
license = "MIT"
[tool.setuptools.dynamic]
version = {attr = "vamb.__version__"}
readme = {file = "README.md"}

[build-system]
requires = ["setuptools ~= 63.0", "Cython ~= 0.29.5"]
requires = [
"setuptools ~= 64.0",
"setuptools-scm >= 8.0",
"Cython ~= 0.29.5"
]
build-backend = "setuptools.build_meta"

[tool.ruff]
Expand All @@ -43,3 +45,5 @@ filterwarnings = [
"error",
"ignore::UserWarning",
]

[tool.setuptools_scm]
102 changes: 0 additions & 102 deletions test/ci.py

This file was deleted.

4 changes: 2 additions & 2 deletions vamb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Documentation: https://github.com/RasmussenLab/vamb/
"""

__version__ = (4, 1, 3)

from . import vambtools
from . import parsebam
from . import parsecontigs
Expand All @@ -15,8 +13,10 @@
from . import taxvamb_encode
from . import reclustering

from importlib.metadata import version as get_version
from loguru import logger

__version_str__ = get_version("vamb")
logger.remove()

__all__ = [
Expand Down
6 changes: 3 additions & 3 deletions vamb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ def run(self):
)
logger.add(sys.stderr, format=format_log)
begintime = time.time()
logger.info("Starting Vamb version " + ".".join(map(str, vamb.__version__)))
logger.info("Starting Vamb version " + vamb.__version_str__)
logger.info("Random seed is " + str(self.vamb_options.seed))
self.run_inner()
logger.info(f"Completed Vamb in {round(time.time() - begintime, 2)} seconds.")
Expand Down Expand Up @@ -2071,7 +2071,7 @@ def add_reclustering_arguments(subparser):

def main():
doc = f"""
Version: {'.'.join([str(i) for i in vamb.__version__])}
Version: {vamb.__version_str__}
Default use, good for most datasets:
vamb bin default --outdir out --fasta my_contigs.fna --bamfiles *.bam -o C
Expand All @@ -2091,7 +2091,7 @@ def main():
helpos.add_argument(
"--version",
action="version",
version=f'Vamb {".".join(map(str, vamb.__version__))}',
version=f"Vamb {vamb.__version_str__}",
)

if len(sys.argv) == 1:
Expand Down

0 comments on commit d3ea938

Please sign in to comment.