Skip to content

Commit

Permalink
Merge pull request #480 from WenjieDu/dev
Browse files Browse the repository at this point in the history
Add pyproject.toml, gather dependency files, and fix flake8 with toml config file
  • Loading branch information
WenjieDu authored Jul 26, 2024
2 parents e0d4d4f + 02adf5f commit 60391e9
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 212 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:

- name: Install Flake8
run: |
pip install flake8
pip install flake8 flake8-pyproject
- name: Run linting
run: |
flake8 .
flake8 .
2 changes: 1 addition & 1 deletion .github/workflows/publish_to_PyPI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install build wheel
pip install -r requirements.txt
pip install -r requirements/requirements.txt
- name: Fetch the test environment details
run: |
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/testing_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,29 @@ jobs:
check-latest: true
cache: pip
cache-dependency-path: |
setup.cfg
requirements/requirements.txt
requirements/requirements_dev.txt
- name: Install PyTorch ${{ matrix.pytorch-version }}+cpu
# we have to install torch in advance because torch_sparse needs it for compilation,
# refer to https://github.com/rusty1s/pytorch_sparse/issues/156#issuecomment-1304869772 for details
run: |
which python
which pip
pip install numpy==1.24 torch==${{ matrix.pytorch-version }} -f https://download.pytorch.org/whl/cpu
pip install torch==${{ matrix.pytorch-version }} -f https://download.pytorch.org/whl/cpu
python -c "import torch; print('PyTorch:', torch.__version__)"
- name: Install other dependencies
run: |
pip install -r requirements.txt
pip install -r requirements/requirements.txt
pip install numpy==1.24 # many libs not compatible with numpy 2.0. Note 3.12 requests for numpy>=2.0
pip install pandas==1.5 # fix pandas version to avoid installing pandas 2.0, the same reason with numpy
- name: Test building package
# we need to know if the package can be built successfully without optional dependencies
run: |
pip install build wheel
python -m build --no-isolation
python -m build
- name: Continue to install torch-geometric dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ build:
- python -m pip install --upgrade pip
- pip install torch==1.13.1 -f https://download.pytorch.org/whl/cpu
- pip install torch-geometric==2.3.1 torch-scatter==2.1.1 torch-sparse==0.6.17 -f "https://data.pyg.org/whl/torch-1.13.1+cpu.html"
- pip install -r requirements.txt
- pip install -r requirements/requirements.txt
- pip install pypots
- pip install sphinx==6.2.1 docutils==0.19 sphinxcontrib-bibtex==2.1.4 sphinxcontrib-gtagjs sphinx-autodoc-typehints furo==2023.07.26
- git clone https://github.com/WenjieDu/TSDB TSDB_repo --depth 1 && pip install ./TSDB_repo
Expand Down
3 changes: 0 additions & 3 deletions MANIFEST.in

This file was deleted.

30 changes: 10 additions & 20 deletions pypots/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,16 @@
# License: BSD-3-Clause


# PyPOTS version
#
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha release
# X.YbN # Beta release
# X.YrcN # Release Candidate
# X.Y # Final release
#
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
__version__ = "0.7"


from . import imputation, classification, clustering, forecasting, optim, data, utils
from . import (
imputation,
classification,
clustering,
forecasting,
optim,
data,
utils,
)
from .version import __version__

__all__ = [
"imputation",
Expand Down
25 changes: 25 additions & 0 deletions pypots/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
"""

# Created by Wenjie Du <[email protected]>
# License: BSD-3-Clause


# PyPOTS version
#
# PEP0440 compatible formatted version, see:
# https://www.python.org/dev/peps/pep-0440/
# Generic release markers:
# X.Y
# X.Y.Z # For bugfix releases
#
# Admissible pre-release markers:
# X.YaN # Alpha release
# X.YbN # Beta release
# X.YrcN # Release Candidate
# X.Y # Final release
#
# Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer.
# 'X.Y.dev0' is the canonical version of 'X.Y.dev'
__version__ = "0.7"
91 changes: 91 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
[build-system]
requires = ["setuptools>=71"]

[project]
name = "pypots"
description = "A Python Toolbox for Machine Learning on Partially-Observed Time Series"
authors = [{ name = "Wenjie Du", email = "[email protected]" }]
dynamic = ["version", "readme", "dependencies", "optional-dependencies"]
license = { file = "LICENSE" }
requires-python = ">=3.8"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"Intended Audience :: Healthcare Industry",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development :: Libraries :: Application Frameworks",
]
keywords = [
"data science",
"data mining",
"neural networks",
"machine learning",
"deep learning",
"artificial intelligence",
"time-series analysis",
"time series",
"imputation",
"interpolation",
"classification",
"clustering",
"forecasting",
"partially observed",
"irregular sampled",
"partially-observed time series",
"incomplete time series",
"missing data",
"missing values",
]

[project.scripts]
pypots-cli = "pypots.cli.pypots_cli:main"

[project.urls]
Source = "https://github.com/WenjieDu/PyPOTS"
Homepage = "https://pypots.com"
Documentation = "https://docs.pypots.com"
"Bug Tracker" = "https://github.com/WenjieDu/PyPOTS/issues"
Download = "https://github.com/WenjieDu/PyPOTS/archive/main.zip"

[tool.setuptools.packages.find]
exclude = [
"*template",
"*README.md",
"docs*",
"test*",
"requirements*",
]

[tool.setuptools.dynamic]
version = { attr = "pypots.version.__version__" }
readme = { file = "README.md", content-type = "text/markdown" }
dependencies = { file = "requirements/requirements.txt" }
optional-dependencies.dev = { file = "requirements/requirements_dev.txt" }

[tool.flake8]
# People may argue that coding style is personal. This may be true if the project is personal and one works like a
# hermit, but to PyPOTS and its community, the answer is NO.
# We use Black and Flake8 to lint code style and keep the style consistent across all commits and pull requests.
# Black only reformats the code, and Flake8 is necessary for checking for some other issues not covered by Black.

# The Black line length is default as 88, while the default of Flake8 is 79. However, considering our monitors are
# much more advanced nowadays, I extend the maximum line length to 120, like other project e.g. transformers. People
# who prefer the default setting can keep using 88 or 79 while coding. Please ensure your code lines not exceeding 120.
max-line-length = 120
# why ignore E203? Refer to https://github.com/PyCQA/pycodestyle/issues/373
extend-ignore = """
E203
"""
# ignore some errors that are not important in template files
exclude = [
"*/template"
]
16 changes: 0 additions & 16 deletions requirements.txt

This file was deleted.

9 changes: 5 additions & 4 deletions environment-dev.yml → requirements/conda_env.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pypots-dev
name: pypots

channels:
- conda-forge
Expand All @@ -16,11 +16,12 @@ dependencies:
- conda-forge::python
- conda-forge::einops
- conda-forge::pandas
- conda-forge::seaborn
- conda-forge::matplotlib
- conda-forge::tensorboard
- conda-forge::scikit-learn
- conda-forge::tsdb >=0.4
- conda-forge::pygrinder >=0.6
- conda-forge::tsdb >=0.6
- conda-forge::benchpots >=0.2
- pytorch::pytorch >=1.10.0
## Below we install the latest pypots because we need pypots-cli in it for development.
Expand Down Expand Up @@ -49,7 +50,7 @@ dependencies:
- conda-forge::jupyterlab

- pip:
# building
- build
# doc
- sphinxcontrib-gtagjs
# hyperparameter tuning
- nni
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ dependencies:
- conda-forge::numpy
- conda-forge::einops
- conda-forge::pandas
- conda-forge::seaborn
- conda-forge::matplotlib
- conda-forge::tensorboard
- conda-forge::scikit-learn
- conda-forge::tsdb >=0.4
- conda-forge::tsdb >=0.6
- conda-forge::pygrinder >=0.6
- conda-forge::benchpots >=0.2
- conda-forge::protobuf <=4.21.12
Expand All @@ -46,5 +47,5 @@ dependencies:
- conda-forge::flake8

- pip:
# doc
- sphinxcontrib-gtagjs
# doc
- sphinxcontrib-gtagjs
14 changes: 14 additions & 0 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
h5py
numpy
scipy
sympy
einops
pandas
seaborn
matplotlib
tensorboard
scikit-learn
torch>=1.10.0
tsdb>=0.6
pygrinder>=0.6
benchpots>=0.2
16 changes: 16 additions & 0 deletions requirements/requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
build
torch-sparse
torch-scatter
torch-geometric
pre-commit
jupyterlab
black
flake8
flake8-pyproject
pytest-cov
pytest-xdist
furo
sphinx
sphinxcontrib-bibtex
sphinxcontrib-gtagjs
sphinx-autodoc-typehints
Loading

0 comments on commit 60391e9

Please sign in to comment.