diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml deleted file mode 100644 index db9cfa1..0000000 --- a/.github/workflows/pytest.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Pytest - -jobs: - test: - strategy: - matrix: - python-version: - - "3.10" - - "3.11" - - "3.12" - - runs-on: ubuntu-latest - steps: - - name: Check out the repository - uses: actions/checkout@v4 - with: - show-progress: true - - name: Install uv - uses: astral-sh/setup-uv@v7 - - name: Install corrlib - run: uv sync --locked --all-extras --dev - - name: Run tests - # For example, using `pytest` - run: uv run pytest tests diff --git a/corrlib/__init__.py b/corrlib/__init__.py index ee2b66c..91b07f4 100644 --- a/corrlib/__init__.py +++ b/corrlib/__init__.py @@ -20,3 +20,4 @@ from .import input as input from .initialization import * from .meas_io import * from .find import * +from .version import __version__ diff --git a/corrlib/cli.py b/corrlib/cli.py index 56b0221..b808c13 100644 --- a/corrlib/cli.py +++ b/corrlib/cli.py @@ -1,6 +1,6 @@ from typing import Optional import typer -from corrlib import __app_name__ +from corrlib import __app_name__, __version__ from .initialization import create from .toml import import_tomls, update_project, reimport_project from .find import find_record, list_projects @@ -8,7 +8,6 @@ from .tools import str2list from .main import update_aliases from .meas_io import drop_cache as mio_drop_cache import os -from importlib.metadata import version, PackageNotFoundError app = typer.Typer() @@ -16,7 +15,7 @@ app = typer.Typer() def _version_callback(value: bool) -> None: if value: - print(__app_name__, version(__app_name__)) + typer.echo(f"{__app_name__} v{__version__}") raise typer.Exit() diff --git a/corrlib/tools.py b/corrlib/tools.py index f9c216d..14bfc05 100644 --- a/corrlib/tools.py +++ b/corrlib/tools.py @@ -2,24 +2,24 @@ import os import datalad.api as dl -def str2list(string: str): +def str2list(string): return string.split(",") def list2str(mylist): s = ",".join(mylist) return s -cached: bool = True +cached = True -def m2k(m: float) -> float: +def m2k(m): return 1/(2*m+8) -def k2m(k: float) -> float: +def k2m(k): return (1/(2*k))-4 -def get_file(path: str, file: str): +def get_file(path, file): if file == "backlogger.db": print("Downloading database...") else: diff --git a/pyproject.toml b/pyproject.toml index 4551237..ed2df7b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,35 +1,6 @@ [build-system] -requires = ["setuptools >= 63.0.0", "wheel", "setuptools-scm"] +requires = ["setuptools >= 63.0.0", "wheel"] build-backend = "setuptools.build_meta" -[project] -name = "corrlib" -dynamic = ["version"] -dependencies = [ - "gitpython>=3.1.45", - 'pyerrors>=2.11.1', - 'datalad>=1.1.0', - 'typer>=0.12.5' -] -description = "Python correlation library" -authors = [ - { name = 'Justus Kuhlmann', email = 'j_kuhl19@uni-muenster.de'} -] - -[project.scripts] -pcl = "corrlib.cli:app" - -[tool.setuptools.packages.find] -include = ["corrlib", "corrlib.*"] - -[tool.setuptools.dynamic] -version = { file = "corrlib/version.py" } - [tool.ruff.lint] -ignore = ["F403"] - -[dependency-groups] -dev = [ - "pytest>=9.0.1", - "pytest-pretty>=1.3.0", -] +ignore = ["F403"] \ No newline at end of file diff --git a/tests/import_project_test.py b/tests/import_project_test.py index 2dea06f..ec8272c 100644 --- a/tests/import_project_test.py +++ b/tests/import_project_test.py @@ -14,4 +14,4 @@ def test_toml_check_measurement_data(): "names": ['list', 'of', 'names'] } } - t.check_measurement_data(measurements, "sfcf") + t.check_measurement_data(measurements) diff --git a/tests/tools_test.py b/tests/tools_test.py deleted file mode 100644 index 71c5267..0000000 --- a/tests/tools_test.py +++ /dev/null @@ -1,25 +0,0 @@ - - -from corrlib import tools as tl - - -def test_m2k(): - assert tl.m2k(0.1) == 1/(2*0.1+8) - assert tl.m2k(0.5) == 1/(2*0.5+8) - assert tl.m2k(1.0) == 1/(2*1.0+8) - - -def test_k2m(): - assert tl.k2m(0.1) == (1/(2*0.1))-4 - assert tl.k2m(0.5) == (1/(2*0.5))-4 - assert tl.k2m(1.0) == (1/(2*1.0))-4 - - -def test_str2list(): - assert tl.str2list("a,b,c") == ["a", "b", "c"] - assert tl.str2list("1,2,3") == ["1", "2", "3"] - - -def test_list2str(): - assert tl.list2str(["a", "b", "c"]) == "a,b,c" - assert tl.list2str(["1", "2", "3"]) == "1,2,3"