Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] support python 3.10 and sklearn 1.x #43

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a4aeb8a
Switch from pipenv/Pipfile to poetry/pyproject.toml
ig248 Mar 10, 2021
2d35582
Hard-code __version__. NB: consider poetry+versioneer or similar
ig248 Mar 10, 2021
1f7cea5
Remove s3-specific code in favour of generic fsspec URIs
ig248 Mar 10, 2021
ce8e970
Ignore docs/ in lint
ig248 Mar 10, 2021
95a2354
Use poetry in CI
ig248 Mar 10, 2021
430eb91
Requier tensorflow 2 and use it in tests
ig248 Mar 10, 2021
98dc739
Update doctest to match tf2 output
ig248 Mar 10, 2021
9749f66
Enforce v2 models
ig248 Mar 11, 2021
c12b76a
Use v2 context for testing
ig248 Mar 11, 2021
3416307
Fix missing metrics in test_evaluate
ig248 Mar 11, 2021
eaa096d
Deprecate fit_generator() and use fit() instead
ig248 Mar 11, 2021
6dbae0f
Remove legacy test
ig248 Mar 11, 2021
bbc9ec7
Use tanh activation in tests to avoid descent getting stuck randomly
ig248 Mar 11, 2021
047075c
Merge pull request #3 from ig248/fix/recompile-metrics
ig248 Mar 11, 2021
1d54168
Revert to having TF as optional/dev-only dependency
ig248 Mar 12, 2021
73960de
Merge pull request #4 from ig248/fix/tf-optional
ig248 Mar 12, 2021
986b788
Update tf and related deps for py39
ig248 Dec 31, 2021
2c4dffa
Update sklearn
ig248 Dec 31, 2021
9347210
Update sklearn to latest <1
ig248 Dec 31, 2021
77f43de
add classifier tests; remove usage of deprecated predict_classes
ig248 Feb 4, 2022
06b31ba
Add isort to dev dependencies
ig248 Feb 4, 2022
45d27bc
Remove deprecated predict_generator/evaluate_generator usage
ig248 Feb 4, 2022
0feaaa6
Update CI image
ig248 Feb 4, 2022
2e374cc
Lint
ig248 Feb 4, 2022
6f17f6a
Merge pull request #5 from ig248/fix/tf2_7
ig248 Feb 4, 2022
a557749
jg/adapt_timeserio_for_python_3.10_and_sklearn_1.1
JakubGrzegorek Jun 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 62 additions & 33 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,70 +5,80 @@ orbs:
jobs:
sync-lint:
docker:
- image: circleci/python:3.6.9
- image: cimg/python:3.8.12

working_directory: ~/timeserio

environment:
PIPENV_VENV_IN_PROJECT: true
environment: # these don't get interpolated
POETRY_VERSION: 1.1.2
POETRY_HOME: /home/circleci/.poetry
POETRY_VIRTUALENVS_IN_PROJECT: "true"

steps:
- checkout

- restore_cache:
keys:
# when lock file changes, use increasingly general patterns to restore cache
- pip-packages-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-packages-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "poetry.lock" }}
- pip-packages-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- pip-packages-{{ .Environment.CACHE_VERSION }}-

- run:
name: Update pip
name: Set up build tools
command: |
pipenv run pip install --upgrade pip
mkdir -p $POETRY_HOME
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
cat $POETRY_HOME/env >> $BASH_ENV

- run:
# we remove untracked to avoid issues with stail/removed dependencies
name: Install dependencies
command: |
make sync
poetry install -vvv --remove-untracked

- save_cache:
paths:
- ./.venv/
key: pip-packages-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
key: pip-packages-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "poetry.lock" }}

- run:
name: Run lint
command: |
make lint

- persist_to_workspace:
root: . # absolute, or relative from working directory
root: /home/circleci # absolute, or relative from working directory
paths: # Must be relative path from root
- ./.venv
- timeserio/.venv
- .poetry

test:
docker:
- image: circleci/python:3.6.9
- image: cimg/python:3.8.12
parallelism: 4

working_directory: ~/timeserio

environment:
PIPENV_VENV_IN_PROJECT: true
POETRY_VIRTUALENVS_IN_PROJECT: "true"

steps:

- checkout

- attach_workspace:
at: . # Must be absolute path or relative path from working_directory

at: /home/circleci # Must be absolute path or relative path from working_directory

- run:
name: Configure poetry
command: cat ~/.poetry/env >> $BASH_ENV

- run:
name: Run tests
command: |
TESTFILES=$(circleci tests glob "tests/**/*.py" | circleci tests split --split-by=timings)
pipenv run pytest --cov=./timeserio/ --cov-report xml --junitxml=junit/pytest/results.xml --keep-duplicates $TESTFILES
poetry run pytest --cov=./timeserio/ --cov-report xml --junitxml=junit/pytest/results.xml --keep-duplicates $TESTFILES

- store_test_results:
path: ./junit
Expand All @@ -78,19 +88,24 @@ jobs:

doctest:
docker:
- image: circleci/python:3.6.9
- image: cimg/python:3.8.12

working_directory: ~/timeserio

environment:
PIPENV_VENV_IN_PROJECT: true
POETRY_VIRTUALENVS_IN_PROJECT: "true"

steps:

- checkout

- attach_workspace:
at: . # Must be absolute path or relative path from working_directory
at: /home/circleci # Must be absolute path or relative path from working_directory

- run:
name: Configure poetry
command: cat ~/.poetry/env >> $BASH_ENV


- run:
name: Run doctests
Expand All @@ -101,24 +116,28 @@ jobs:

build-release-test:
docker:
- image: circleci/python:3.6.9
- image: cimg/python:3.8.12

working_directory: ~/timeserio

environment:
PIPENV_VENV_IN_PROJECT: true
TWINE_NON_INTERACTIVE: true
TWINE_NON_INTERACTIVE: "true"

steps:

- checkout

- attach_workspace:
at: . # Must be absolute path or relative path from working_directory
at: /home/circleci # Must be absolute path or relative path from working_directory

- run:
name: Configure poetry
command: cat ~/.poetry/env >> $BASH_ENV

- run:
name: Create source and wheel distribution
command: make package
command: |
make package

- run:
name: Release to PyPI
Expand All @@ -130,25 +149,30 @@ jobs:

- persist_to_workspace:
root: .
paths: ./build
paths:
- ./build

release-prod:
docker:
- image: circleci/python:3.6.9
- image: cimg/python:3.8.12

working_directory: ~/timeserio

environment:
PIPENV_VENV_IN_PROJECT: true
TWINE_NON_INTERACTIVE: true
TWINE_NON_INTERACTIVE: "true"
POETRY_VIRTUALENVS_IN_PROJECT: "true"

steps:

- checkout

- attach_workspace:
at: . # Must be absolute path or relative path from working_directory
at: /home/circleci # Must be absolute path or relative path from working_directory

- run:
name: Configure poetry
command: cat ~/.poetry/env >> $BASH_ENV

- run:
name: Release to PyPI
command: |
Expand All @@ -159,12 +183,12 @@ jobs:

docs-build:
docker:
- image: circleci/python:3.6.9
- image: cimg/python:3.8.12

working_directory: ~/timeserio

environment:
PIPENV_VENV_IN_PROJECT: true
POETRY_VIRTUALENVS_IN_PROJECT: "true"

steps:

Expand All @@ -177,7 +201,11 @@ jobs:
sudo dpkg -i pandoc-2.7.3-1-amd64.deb

- attach_workspace:
at: . # Must be absolute path or relative path from working_directory
at: /home/circleci # Must be absolute path or relative path from working_directory

- run:
name: Configure poetry
command: cat ~/.poetry/env >> $BASH_ENV

- run:
name: Build sphinx docs
Expand All @@ -186,7 +214,8 @@ jobs:

- persist_to_workspace:
root: docs/_build
paths: html
paths:
- html

docs-deploy:
docker:
Expand Down
37 changes: 19 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,43 @@ CPU_IMAGE?="timeserio:latest"
.PHONY: yapf lint clean sync lock test test-parallel docs-build docs-clean circle build-cpu build-gpu release

yapf:
pipenv run yapf -vv -ir .
pipenv run isort -y
poetry run yapf -vv -ir .
poetry run isort .

lint:
pipenv run flake8 .
pipenv run pydocstyle .
pipenv run mypy .
poetry run flake8 .
poetry run pydocstyle .
poetry run mypy .

clean:
find . | grep -E '(__pycache__|\.pyc|\.pyo$$)' | xargs rm -rf
rm -rf dist/
rm -rf build/

sync:
pipenv sync --dev
poetry install

lock:
pipenv lock --dev
poetry lock

test:
pipenv run pytest tests/
poetry run pytest tests/

test-parallel:
pipenv run pytest -n auto tests/
poetry run pytest -n auto tests/

doctest:
pipenv run pytest --doctest-modules timeserio/
poetry run pytest --doctest-modules timeserio/

docs-build:
pipenv run $(MAKE) -C docs html
poetry run $(MAKE) -C docs html

docs-clean:
pipenv run $(MAKE) -C docs clean
poetry run $(MAKE) -C docs clean
rm -rf docs/source/api

docs-serve:
pipenv run $(SHELL) -c "cd docs/_build/html; python -m http.server 8000"
poetry run $(SHELL) -c "cd docs/_build/html; python -m http.server 8000"

circle:
circleci config validate
Expand All @@ -51,14 +53,13 @@ build-gpu:
docker build -t ${GPU_IMAGE} . --build-arg gpu_tag="-gpu"

version:
@pipenv run python -c "import timeserio; print(timeserio.__version__)"
@poetry run python -c "import timeserio; print(timeserio.__version__)"

package:
pipenv run python setup.py sdist
pipenv run python setup.py bdist_wheel
poetry buil

test-release: package
pipenv run twine upload --repository-url https://test.pypi.org/legacy/ dist/*
poetry run twine upload --repository-url https://test.pypi.org/legacy/ dist/*

release: package
pipenv run twine upload dist/*
poetry run twine upload dist/*
41 changes: 0 additions & 41 deletions Pipfile

This file was deleted.

Loading