diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ed155de..9187348 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,8 @@ jobs: python -m pip install --upgrade pip pip install -r requirements.txt pip install pytest pytest-cov - + pip install . + - name: Run tests run: | pytest --cov=STL_main tests/ diff --git a/.gitignore b/.gitignore index 8169364..59ac963 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__/ docs/build/ *.pyc my_tests.ipynb +STL.egg-info/ \ No newline at end of file diff --git a/STL_main/__init__.py b/STL_main/__init__.py index e69de29..4cc0f26 100644 --- a/STL_main/__init__.py +++ b/STL_main/__init__.py @@ -0,0 +1,12 @@ +import warnings +from importlib.metadata import PackageNotFoundError, version + +try: + __version__ = version("STL") +except PackageNotFoundError: + __version__ = None + + warnings.warn( + "In development mode: Please run 'pip install -e .' in the root directory of the STL repository to properly install the package, its dependencies and enable proper version tracking.", + UserWarning, + ) diff --git a/pyproject.toml b/pyproject.toml index f730438..4d1924f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,18 @@ +[build-system] +requires = ["setuptools>=64", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "STL" +dynamic = ["version"] + +[tool.setuptools.packages.find] +include = ["STL_main*"] + +[tool.setuptools_scm] +version_scheme = "post-release" +local_scheme = "no-local-version" + [tool.isort] profile = "black" line_length = 88 diff --git a/tests/test_2D_FFT_Torch.py b/tests/test_2D_FFT_Torch.py index e9a4fef..7c04220 100644 --- a/tests/test_2D_FFT_Torch.py +++ b/tests/test_2D_FFT_Torch.py @@ -14,6 +14,7 @@ print(f"Parent directory already in sys.path: ...\\{PARENT_DIR.name}") DATA_TEST_PATH = Path(__file__).parent.parent / "data" / "test" +import STL_main from STL_main.STL_2D_FFT_Torch import STL_2D_FFT_Torch as DataClass