From d4ad737ac390b31838ea6d2243b22c495bac78f1 Mon Sep 17 00:00:00 2001 From: Olaf Mersmann Date: Tue, 31 Jan 2023 23:54:46 +0100 Subject: [PATCH 1/4] Add basic CI/CD. --- .github/workflows/test.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..15b7e48 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,23 @@ +name: test + +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + version: ["3.10", "3.11"] + runs-on: ${{matrix.os}} + defaults: + run: + working-directory: ${{github.workspace}} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{matrix.version}} + - run: python -m pip install --upgrade pip build pytest + - run: python -m build . + - run: python -m pip install . + - run: pytest test/ From 67d54c50b9db7af7843f645264501edd1e4ee42a Mon Sep 17 00:00:00 2001 From: Olaf Mersmann Date: Wed, 1 Feb 2023 00:04:53 +0100 Subject: [PATCH 2/4] Remove .DS_Store --- src/spotRiver/data/synth/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/spotRiver/data/synth/.DS_Store diff --git a/src/spotRiver/data/synth/.DS_Store b/src/spotRiver/data/synth/.DS_Store deleted file mode 100644 index a292f56e49e07b1b584c4550f1aadb55b0d12f63..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ8r`;3?&;60kUMws4L_KLXe&y2XONPG8k}yqC+=NIaiL>$IoK8-JB(O1gIxb zd=m5q(-aZieP6aBYY|z(4drgb)NJ2;Vs9ByARK3$tC`N@F;svGyp96)eJF6lnm7ddrvrnx0Kf)e zH_W}402T`XYvK@y2uy*H-`E;s5miV-i Date: Wed, 1 Feb 2023 00:05:11 +0100 Subject: [PATCH 3/4] Cleanup pyproject.toml --- .github/workflows/test.yml | 4 ++-- .gitignore | 9 +-------- MANIFEST.in | 4 ---- pyproject.toml | 31 ++++++++++++++++++------------- src/spotRiver/__init__.py | 4 ++++ src/spotRiver/fun/__init__.py | 0 src/spotRiver/utils/__init__.py | 0 7 files changed, 25 insertions(+), 27 deletions(-) delete mode 100644 MANIFEST.in create mode 100644 src/spotRiver/__init__.py create mode 100644 src/spotRiver/fun/__init__.py create mode 100644 src/spotRiver/utils/__init__.py diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15b7e48..40bc37b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{matrix.version}} - - run: python -m pip install --upgrade pip build pytest + - run: python -m pip install --upgrade pip build - run: python -m build . - - run: python -m pip install . + - run: python -m pip install '.[tests]' - run: pytest test/ diff --git a/.gitignore b/.gitignore index af19c75..4f41dd7 100644 --- a/.gitignore +++ b/.gitignore @@ -127,15 +127,8 @@ dmypy.json # Pyre type checker .pyre/ -docs/.DS_Store -notebooks/.DS_Store -src/spotRiver/data/.DS_Store -src/spotRiver/.DS_Store -src/spotRiver/fun/.DS_Store -test/.DS_Store -src/.DS_Store -spotRiver.code-workspace .DS_Store +spotRiver.code-workspace notebooks/data/opm_2001-2020.csv notebooks/opm.csv notebooks/opm_cat.csv diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index a00c089..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,4 +0,0 @@ -include src/spotRiver/data/*.rst -include src/spotRiver/data/*.tar -include src/spotRiver/data/*.c -include src/spotRiver/data/*.csv diff --git a/pyproject.toml b/pyproject.toml index c8608e6..1a76846 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,15 +1,12 @@ [build-system] -requires = ["scipy", - "setuptools>=61.0", - "graphviz", - "numpy", - "scikit-learn", - "matplotlib"] +requires = [ + "setuptools>=61.0", + "setuptools_scm[toml]", +] build-backend = "setuptools.build_meta" [project] name = "spotRiver" -version = "0.0.10" authors = [ { name="T. Bartz-Beielstein", email="tbb@bartzundbartz.de" } ] @@ -21,19 +18,20 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Operating System :: OS Independent", ] -# PEP 621 dependencies declaration -# adapt to your dependencies manager dependencies = [ - "mkdocstrings-python" + "numpy", + "river >= 0.15.0", + "pytest [tests]", + "spotPython [docs] >= 0.0.2", ] +dynamic=["version"] [project.urls] "Homepage" = "https://www.spotseven.de" +Issues = "https://github.com/sequential-parameter-optimization/spotRiver/issues" +Repository = "https://github.com/sequential-parameter-optimization/spotRiver" [tool.setuptools] -# ... -# By default, include-package-data is true in pyproject.toml, so you do -# NOT have to specify this line. include-package-data = true [tool.setuptools.packages.find] @@ -43,3 +41,10 @@ where = ["src"] line-length = 120 target-version = ["py310"] +[tool.setuptools_scm] +write_to = "src/spotRiver/_version.py" + +[tool.pytest.ini_options] +addopts = [ + "--import-mode=importlib", +] diff --git a/src/spotRiver/__init__.py b/src/spotRiver/__init__.py new file mode 100644 index 0000000..9ee1e88 --- /dev/null +++ b/src/spotRiver/__init__.py @@ -0,0 +1,4 @@ +try: + from ._version import __version__ +except ModuleNotFoundError: + __version__ = "0.0.0dev" diff --git a/src/spotRiver/fun/__init__.py b/src/spotRiver/fun/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/spotRiver/utils/__init__.py b/src/spotRiver/utils/__init__.py new file mode 100644 index 0000000..e69de29 From c5b0e2c6d75d4d9952098ad1df7af2e930d2dbd3 Mon Sep 17 00:00:00 2001 From: Olaf Mersmann Date: Wed, 1 Feb 2023 00:14:38 +0100 Subject: [PATCH 4/4] Fix tests --- .gitignore | 1 + test/test_features.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 4f41dd7..d44860e 100644 --- a/.gitignore +++ b/.gitignore @@ -132,3 +132,4 @@ spotRiver.code-workspace notebooks/data/opm_2001-2020.csv notebooks/opm.csv notebooks/opm_cat.csv +src/spotRiver/_version.py diff --git a/test/test_features.py b/test/test_features.py index ef15fc4..546b048 100644 --- a/test/test_features.py +++ b/test/test_features.py @@ -1,5 +1,5 @@ from spotRiver import data -from spotPython.utils.features import get_hour_distances, get_month_distances, get_ordinal_date, get_weekday_distances +from spotRiver.utils.features import get_hour_distances, get_month_distances, get_ordinal_date, get_weekday_distances def test_features(): @@ -13,4 +13,4 @@ def test_features(): assert(get_hour_distances(x)["0"] == 1.0) assert(get_weekday_distances(x)["Saturday"] == 1.0) assert(get_month_distances(x)["January"] == 1.0) - break \ No newline at end of file + break