From 5471908123ceb530680f0c5cb9885516405db1e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20St=C3=B6lzle?= Date: Fri, 20 Jun 2025 21:15:40 +0200 Subject: [PATCH 1/2] Replace `setup.py` with `pyproject.toml` --- README.md | 4 +- pyproject.toml | 108 ++++++++++++++++++++++++++++++++++++++ requirements.txt | 2 - requirements_examples.txt | 6 --- setup.cfg | 5 -- setup.py | 42 --------------- 6 files changed, 110 insertions(+), 57 deletions(-) create mode 100644 pyproject.toml delete mode 100755 requirements.txt delete mode 100644 requirements_examples.txt delete mode 100755 setup.cfg delete mode 100755 setup.py diff --git a/README.md b/README.md index 95a4d289..56a73c49 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,8 @@ git clone https://github.com/VincentStimper/normalizing-flows.git and then install the dependencies. -``` -pip install -r requirements_examples.txt +```bash +pip install -e ".[examples]" ``` ## Usage diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..f3630c2f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,108 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "normflows" +version = "1.7.3" +description = "Pytorch implementation of normalizing flows" +readme = "README.md" +requires-python = ">=3.8" +license = {text = "MIT"} +authors = [ + {name = "Vincent Stimper", email = "vincent.stimper@tuebingen.mpg.de"} +] +maintainers = [ + {name = "Vincent Stimper", email = "vincent.stimper@tuebingen.mpg.de"} +] +keywords = ["pytorch", "normalizing flows", "machine learning", "deep learning"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Topic :: Scientific/Engineering :: Artificial Intelligence", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dependencies = [ + "numpy", + "torch", +] + +[project.optional-dependencies] +docs = [ + "mkdocs", + "mkdocstrings[python]", + "mkdocs-jupyter", +] +dev = [ + "pytest", + "pytest-cov", + "black", + "flake8", + "isort", +] +examples = [ + "matplotlib", + "jupyterlab", + "tqdm", + "scikit-learn", + "ipywidgets", + "pandas" +] + +[project.urls] +Homepage = "https://github.com/VincentStimper/normalizing-flows" +Documentation = "https://vincentstimper.github.io/normalizing-flows/" +Repository = "https://github.com/VincentStimper/normalizing-flows" +Download = "https://github.com/VincentStimper/normalizing-flows/archive/refs/heads/master.zip" +"Bug Reports" = "https://github.com/VincentStimper/normalizing-flows/issues" +"Paper" = "https://doi.org/10.21105/joss.05361" + +[tool.setuptools] +packages = ["normflows"] +include-package-data = true + +[tool.setuptools.package-dir] +"" = "." + +[tool.setuptools.exclude-package-data] +"*" = ["docs/*", "tests/*"] + +[tool.black] +line-length = 88 +target-version = ['py38'] +include = '\.pyi?$' +extend-exclude = ''' +/( + # directories + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | build + | dist +)/ +''' + +[tool.isort] +profile = "black" +multi_line_output = 3 +line_length = 88 +known_first_party = ["normflows"] + +[tool.pytest.ini_options] +testpaths = ["normflows"] +python_files = ["*_test.py"] +python_classes = ["Test*"] +python_functions = ["test_*"] +addopts = "--cov=normflows --cov-report=term-missing --cov-report=xml" diff --git a/requirements.txt b/requirements.txt deleted file mode 100755 index 54b70577..00000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -numpy -torch \ No newline at end of file diff --git a/requirements_examples.txt b/requirements_examples.txt deleted file mode 100644 index 51649071..00000000 --- a/requirements_examples.txt +++ /dev/null @@ -1,6 +0,0 @@ -matplotlib -jupyterlab -tqdm -scikit-learn -ipywidgets -pandas diff --git a/setup.cfg b/setup.cfg deleted file mode 100755 index cb4a338e..00000000 --- a/setup.cfg +++ /dev/null @@ -1,5 +0,0 @@ -[bdist_wheel] -universal=1 - -[metadata] -description-file=README.md \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100755 index 561a217b..00000000 --- a/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -from setuptools import setup, find_packages -from codecs import open -from os import path - -__version__ = "1.7.3" - -here = path.abspath(path.dirname(__file__)) - -# Get the long description from the README file -with open(path.join(here, "README.md"), encoding="utf-8") as f: - long_description = f.read() - -# get the dependencies and installs -with open(path.join(here, "requirements.txt"), encoding="utf-8") as f: - all_reqs = f.read().split("\n") - -install_requires = [x.strip() for x in all_reqs] - -setup( - name="normflows", - version=__version__, - description="Pytorch implementation of normalizing flows", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/VincentStimper/normalizing-flows", - download_url="https://github.com/VincentStimper/normalizing-flows/archive/refs/heads/master.zip", - license="MIT", - classifiers=[ - "Development Status :: 3 - Alpha", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3", - ], - keywords="", - packages=find_packages(exclude=["docs", "tests*"]), - include_package_data=True, - author="Vincent Stimper", - author_email="vincent.stimper@tuebingen.mpg.de", - install_requires=install_requires, - extras_require={ - "docs": ["mkdocs","mkdocstrings[python]","mkdocs-jupyter"] - }, -) From a71162c00d772a51f05eda9a0e539ccc3c74182b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20St=C3=B6lzle?= Date: Fri, 20 Jun 2025 21:15:52 +0200 Subject: [PATCH 2/2] Bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f3630c2f..f515c2d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "normflows" -version = "1.7.3" +version = "1.7.4" description = "Pytorch implementation of normalizing flows" readme = "README.md" requires-python = ">=3.8"