Skip to content

Commit

Permalink
Chore/upgrade dependencies (#188)
Browse files Browse the repository at this point in the history
* docs: clarify styling comment

Signed-off-by: F.N. Claessen <[email protected]>

* feat: `make test` tests optional parts, too

Signed-off-by: F.N. Claessen <[email protected]>

* chore: add classifiers for Python 3.10 and 3.11

Signed-off-by: F.N. Claessen <[email protected]>

* chore: move requirements to python-version-specific folder

Signed-off-by: F.N. Claessen <[email protected]>

* feature: make command to upgrade deps

Signed-off-by: F.N. Claessen <[email protected]>

* chore: missing commands from listing, and define commands in the same order as the listing

Signed-off-by: F.N. Claessen <[email protected]>

* feature: add requirements.txt for Python 3.11

Signed-off-by: F.N. Claessen <[email protected]>

* chore: update dev docs

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: `make test` uses all tests straightaway

Signed-off-by: F.N. Claessen <[email protected]>

* feature: ensure dependencies folder

Signed-off-by: F.N. Claessen <[email protected]>

* fix: installation dependencies for all tests

Signed-off-by: F.N. Claessen <[email protected]>

* docs: obsolete comment

Signed-off-by: F.N. Claessen <[email protected]>

* feature: allow skipping test when upgrading dependencies

Signed-off-by: F.N. Claessen <[email protected]>

* refactor: move test dependencies to `make install-for-test`

Signed-off-by: F.N. Claessen <[email protected]>

* feature: test the core with fewer pinned dependencies, and then test everything with share dependencies

Signed-off-by: F.N. Claessen <[email protected]>

* chore: unpin numpy and scipy in optional forecast dependencies

Signed-off-by: F.N. Claessen <[email protected]>

* chore: unpin pandas for 3.11 and higher

Signed-off-by: F.N. Claessen <[email protected]>

* feature: automate test pipeline for Python 3.11

Signed-off-by: F.N. Claessen <[email protected]>

* fix: AttributeError: `np.NaN` was removed in the NumPy 2.0 release. Use `np.nan` instead.

Signed-off-by: F.N. Claessen <[email protected]>

* Revert "chore: unpin pandas for 3.11 and higher"

This reverts commit c574364.

* feature: automate test pipeline for Python 3.12 (#190)

Signed-off-by: F.N. Claessen <[email protected]>

* fix(deps): pin only from 3.11 onwards

Signed-off-by: F.N. Claessen <[email protected]>

* Revert "fix(deps): pin only from 3.11 onwards"

This reverts commit e9ffb4d.

---------

Signed-off-by: F.N. Claessen <[email protected]>
  • Loading branch information
Flix6x authored Sep 20, 2024
1 parent f0b9053 commit 62e1a76
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: false
matrix:
py_version: [ '3.7', '3.8', '3.9', '3.10' ]
py_version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
include:
- py_version: '3.7'
skip-viz: true
Expand Down
48 changes: 38 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,33 +1,61 @@
# Note: use tabs
# Check Python major and minor version
# For more information, see https://stackoverflow.com/a/22105036
PYV = $(shell python -c "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));sys.stdout.write(t)")

# Note: use tabs (not spaces) for indentation
# actions which are virtual, i.e. not a script
.PHONY: install-deps install-tb freeze-deps test
.PHONY: install install-deps install-tb install-for-test freeze-deps upgrade-deps test test-core test-forecast test-viz ensure-deps-folder

install: install-deps install-tb

install-for-test:
pip install setuptools_scm pytest

install-deps:
pip install --upgrade pip-tools
pip-sync dev/requirements.txt
pip-sync dev/${PYV}/requirements.txt
pip install pre-commit

freeze-deps:
pip install --upgrade pip-tools
pip-compile -o dev/requirements.txt # use --upgrade or --upgrade-package to actually change versions

install-tb:
pip install -e .
pre-commit install

freeze-deps:
make ensure-deps-folder
pip install --upgrade pip-tools
pip-compile -o dev/${PYV}/requirements.txt

upgrade-deps:
make ensure-deps-folder
pip install --upgrade pip-tools
pip-compile -o dev/${PYV}/requirements.txt --upgrade
ifneq ($(skip-test), yes)
make test
endif

test:
make test-core # test just the core, which may have fewer pinned dependencies
make test-all # test everything sharing the same dependencies

test-all:
pip install -e .[forecast,viz]
make install-for-test
pytest

test-core:
pip install -e .
pip install setuptools_scm pytest
make install-for-test
pytest --ignore test_forecast__ --ignore test_viz__

test-forecast:
pip install -e .[forecast]
pip install setuptools_scm pytest
make install-for-test
pytest -k test_forecast__

test-viz:
pip install -e .[viz]
pip install setuptools_scm pytest
make install-for-test
pytest -k test_viz__

ensure-deps-folder:
mkdir -p dev/${PYV}
52 changes: 52 additions & 0 deletions dev/3.11/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --output-file=dev/3.11/requirements.txt
#
dill==0.3.8
# via openturns
greenlet==3.1.0
# via sqlalchemy
importlib-metadata==8.5.0
# via timely-beliefs (setup.py)
isodate==0.6.1
# via timely-beliefs (setup.py)
numpy==1.26.4 ; python_version > "3.7"
# via
# pandas
# properscoring
# scipy
# timely-beliefs (setup.py)
openturns==1.23
# via timely-beliefs (setup.py)
pandas==2.2.1 ; python_version > "3.7"
# via timely-beliefs (setup.py)
properscoring==0.1
# via timely-beliefs (setup.py)
psutil==6.0.0
# via openturns
psycopg2-binary==2.9.9
# via timely-beliefs (setup.py)
python-dateutil==2.9.0.post0
# via pandas
pytz==2024.2
# via
# pandas
# timely-beliefs (setup.py)
scipy==1.14.1 ; python_version > "3.7"
# via
# properscoring
# timely-beliefs (setup.py)
six==1.16.0
# via
# isodate
# python-dateutil
sqlalchemy==2.0.35
# via timely-beliefs (setup.py)
typing-extensions==4.12.2
# via sqlalchemy
tzdata==2024.1
# via pandas
zipp==3.20.2
# via importlib-metadata
2 changes: 1 addition & 1 deletion dev/requirements.txt → dev/3.9/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=dev/requirements.txt
# pip-compile --output-file=dev/3.9/requirements.txt
#
altair==4.1.0
# via timely-beliefs (setup.py)
Expand Down
4 changes: 2 additions & 2 deletions dev/dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ And run tests:

To update dependencies run:

pip-compile -o dev/requirements.txt -U
make upgrade-deps

To install dependencies run:

pip install -r dev/requirements.txt
make install-deps
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
Expand Down Expand Up @@ -65,8 +67,7 @@ viz = [
]
forecast = [
"sktime",
"numpy<1.25,>=1.21.0; python_version > '3.7'", # required by sktime==0.15.0
"scipy<2.0.0; python_version > '3.7'", # required by sktime==0.15.0
"numpy>=1.21.0; python_version > '3.7'", # required by sktime==0.15.0
]

[project.readme]
Expand Down
2 changes: 1 addition & 1 deletion timely_beliefs/tests/test_df_resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def test_downsample_once_upsample_once_around_dst(
df = df_wxyz(
time_slot_sensor, 25, 1, 1, 1, start
) # 1 deterministic belief per event
df.iloc[0] = np.NaN # introduce 1 NaN value
df.iloc[0] = np.nan # introduce 1 NaN value
print(df)

# Downsample the original frame
Expand Down

0 comments on commit 62e1a76

Please sign in to comment.