Skip to content

Commit

Permalink
Introduce versioningit (#36)
Browse files Browse the repository at this point in the history
* versioningit setup

Signed-off-by: Jose Borreguero <[email protected]>

* versioningit invoked when package is installed

Signed-off-by: Jose Borreguero <[email protected]>

---------

Signed-off-by: Jose Borreguero <[email protected]>
  • Loading branch information
jmborr authored Jul 26, 2024
1 parent 73a5953 commit 569ac33
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 8 deletions.
12 changes: 6 additions & 6 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ channels:
- conda-forge
- defaults
dependencies:
- lmfit
- mantid=6.10
- matplotlib
# development dependencies
- boa
- codecov
- conda-build
- conda-verify
- pre-commit
- pytest
- pytest-cov
- numpy
- lmfit
- codecov
- conda-build
- python-build
- versioningit
- boa
- conda-verify
27 changes: 26 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "lr_reduction"
authors = [{name = "Mat", email = "[email protected]"}]
description = "Reduction scripts for the Liquids Reflectometer. This includes both automated reduction scripts and useful scripts to reprocess data."
version = "0.1.0" # initial version, dynamically overriden
version = ["version"] # initial version, dynamically overriden
license = {file = "LICENSE"}
readme = "README.md"
requires-python = ">=3.8"
Expand All @@ -18,6 +18,16 @@ dependencies = [
"mantid"
]

# versioningit will generate file _version.py when installing this package, even if installing from sources
[build-system]
requires = [
"setuptools >= 40.6.0",
"wheel",
"toml",
"versioningit"
]
build-backend = "setuptools.build_meta"

[project.optional-dependencies]
tests = [
"pytest"
Expand All @@ -41,6 +51,21 @@ ignore = [
"F405", "F821" # unknown names from probably from wild imports
]

[tool.versioningit.vcs]
method = "git"
default-tag = "0.0.1"

[tool.versioningit.next-version]
method = "minor"

[tool.versioningit.format]
distance = "{next_version}.dev{distance}"
dirty = "{version}+d{build_date:%Y%m%d}"
distance-dirty = "{next_version}.dev{distance}+d{build_date:%Y%m%d%H%M}"

[tool.versioningit.write]
file = "src/usansred/_version.py"

[tool.coverage.run]
branch = true

Expand Down
5 changes: 4 additions & 1 deletion reduction/lr_reduction/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
__version__ = '2.0.28'
try:
from ._version import __version__ # noqa: F401
except ImportError:
__version__ = "unknown"

0 comments on commit 569ac33

Please sign in to comment.