Skip to content

Commit 48cd9ef

Browse files
move version from pyproject.toml to __init__ (#132)
move version from pyproject.toml to __init__
1 parent 75eb7e4 commit 48cd9ef

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

molpipeline/__init__.py

+3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
SetDefaultPickleProperties(PropertyPickleOptions.AllProps)
1313

1414
__all__ = [
15+
"__version__",
1516
"Pipeline",
1617
"ErrorFilter",
1718
"FilterReinserter",
1819
"PostPredictionWrapper",
1920
]
21+
22+
__version__ = "0.9.2"

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@ requires = ["setuptools"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
6-
dynamic = ["dependencies", "optional-dependencies"]
6+
dynamic = ["dependencies", "optional-dependencies", "version"]
77
name = "molpipeline"
88
authors = [
99
{name = "Christian W. Feldmann"},
1010
{name = "Jennifer Hemmerich"},
1111
{name = "Jochen Sieg"}
1212
]
1313
description = "Integration of rdkit functionality into sklearn pipelines."
14-
version = "0.9.2"
1514
readme = "README.md"
1615

1716
[tool.setuptools.dynamic]
1817
dependencies = {file = "requirements.txt"}
18+
version = {attr = "molpipeline.__version__"}
1919

2020
[tool.setuptools.dynamic.optional-dependencies]
2121
all = {file = ["requirements_chemprop.txt", "requirements_notebooks.txt"]}

tests/test_init.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
"""Test functionality set at package init."""
2+
3+
import unittest
4+
5+
from molpipeline import __version__
6+
7+
8+
class TestInit(unittest.TestCase):
9+
"""Test functionality set at package init."""
10+
11+
def test_version(self) -> None:
12+
"""Test that the package has a version."""
13+
self.assertIsInstance(__version__, str)
14+
splitted = __version__.split(".")
15+
self.assertEqual(len(splitted), 3)
16+
major, minor, patch = splitted
17+
self.assertTrue(major.isdigit())
18+
self.assertTrue(minor.isdigit())
19+
self.assertTrue(patch.isdigit())

0 commit comments

Comments
 (0)