From 4400544100f647a6f833e6c90dc28f86969c637c Mon Sep 17 00:00:00 2001 From: Wenjie Du Date: Wed, 24 Jul 2024 00:17:29 +0800 Subject: [PATCH] refactor: config the project with pyproject.toml; --- .github/workflows/linting.yml | 2 +- .github/workflows/publish_to_PyPI.yml | 7 +-- pygrinder/__init__.py | 19 +------- pygrinder/version.py | 24 ++++++++++ pyproject.toml | 69 +++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 24 deletions(-) create mode 100644 pygrinder/version.py create mode 100644 pyproject.toml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index c28fbc8..8601e29 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -24,7 +24,7 @@ jobs: - name: Install Flake8 run: | - pip install flake8 + pip install flake8 flake8-pyproject - name: Run linting run: | diff --git a/.github/workflows/publish_to_PyPI.yml b/.github/workflows/publish_to_PyPI.yml index 845e48b..fee8826 100644 --- a/.github/workflows/publish_to_PyPI.yml +++ b/.github/workflows/publish_to_PyPI.yml @@ -31,14 +31,11 @@ jobs: with: python-version: '3.10' check-latest: true - cache-dependency-path: | - requirements.txt - name: Install dependencies run: | python -m pip install --upgrade pip - pip install build wheel - pip install -r requirements.txt + pip install build - name: Fetch the test environment details run: | @@ -47,7 +44,7 @@ jobs: - name: Build package run: | - python -m build --no-isolation + python -m build - name: Publish the new package to PyPI uses: pypa/gh-action-pypi-publish@v1.8.7 diff --git a/pygrinder/__init__.py b/pygrinder/__init__.py index 447b8f1..3af8e3c 100644 --- a/pygrinder/__init__.py +++ b/pygrinder/__init__.py @@ -5,24 +5,6 @@ # Created by Wenjie Du # License: BSD-3-Clause -# PyGrinder 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.6.1" - from .missing_at_random import mar_logistic from .missing_completely_at_random import mcar, mcar_little_test from .missing_not_at_random import mnar_x, mnar_t @@ -36,6 +18,7 @@ fill_and_get_mask_torch, fill_and_get_mask_numpy, ) +from .version import __version__ __all__ = [ "__version__", diff --git a/pygrinder/version.py b/pygrinder/version.py new file mode 100644 index 0000000..ac8304d --- /dev/null +++ b/pygrinder/version.py @@ -0,0 +1,24 @@ +""" + +""" + +# Created by Wenjie Du +# License: BSD-3-Clause + +# PyGrinder 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.6.2" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0bae6b2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,69 @@ +[build-system] +requires = ["setuptools>=71"] + +[project] +name = "pygrinder" +description = "A Python toolkit for introducing missing values into datasets" +authors = [{ name = "Wenjie Du", email = "wenjay.du@gmail.com" }] +dynamic = ["version", "readme", "dependencies"] +license = { file = "LICENSE" } +requires-python = ">=3.8" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: BSD License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Software Development :: Libraries :: Application Frameworks", +] +keywords = [ + "data corruption", + "incomplete data", + "data mining", + "pypots", + "missingness", + "partially observed", + "irregular sampled", + "partially-observed time series", + "incomplete time series", + "missing data", + "missing values", + "simulation", + "pypots", +] + +[project.urls] +Source = "https://github.com/WenjieDu/PyGrinder" +Homepage = "https://pypots.com" +Documentation = "https://docs.pypots.com" +"Bug Tracker" = "https://github.com/WenjieDu/PyGrinder/issues" +Download = "https://github.com/WenjieDu/PyGrinder/archive/main.zip" + +[tool.setuptools.packages.find] +exclude = [ + "docs*", + "test*", +] + +[tool.setuptools.dynamic] +version = { attr = "pygrinder.version.__version__" } +readme = { file = "README.md", content-type = "text/markdown" } +dependencies = { file = "requirements.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 +""" \ No newline at end of file