From f8cdb63e6bec6f80edc5c1d821594e0aefe91780 Mon Sep 17 00:00:00 2001 From: Tommy <10076072+tommyod@users.noreply.github.com> Date: Sun, 1 Sep 2024 21:21:23 +0200 Subject: [PATCH] Add pyproject.toml (#40) * pyproject * ignore version * add deps * build without setup.py * increment version --------- Co-authored-by: tommyod --- .github/workflows/build.yml | 7 +-- deploy.sh | 5 -- pyproject.toml | 47 ++++++++++++++++ setup.cfg | 2 - setup.py | 104 ------------------------------------ streprogen/__init__.py | 2 +- 6 files changed, 52 insertions(+), 115 deletions(-) delete mode 100644 deploy.sh create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f309fb..0e35d95 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,8 +33,8 @@ jobs: run: | sudo apt-get install pandoc -y pip install pip jupyter matplotlib pytest black wheel setuptools twine flake8 --quiet --upgrade - pip install -e . # Install the package - black . --check -l 120 + pip install . # Install the package + black . --check -l 120 --exclude="_version.py" flake8 streprogen --select=F811,F841,F401,E711,E712,E731 pytest streprogen --doctest-modules --color=yes # Run tests pytest docs/examples --verbose --doctest-modules --color=yes # Run test_notebooks.py @@ -45,7 +45,8 @@ jobs: - name: Build package ${{ matrix.python-version }} run: | - python setup.py sdist bdist_wheel; + python -m pip install build; + python -m build; - name: Publish Python distribution to PyPI if: github.ref == 'refs/heads/master' diff --git a/deploy.sh b/deploy.sh deleted file mode 100644 index 701a88b..0000000 --- a/deploy.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -pip install twine -python setup.py sdist -twine check dist/* -python -m twine upload dist/* --username tommyod --password $TWINE --skip-existing \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..78e0499 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,47 @@ +[build-system] +requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"] +build-backend = "setuptools.build_meta" + +[project] +name = "streprogen" +dynamic = ["version", "readme"] +description = "The Python strength program generator." +authors = [ + {name = "Tommy Odland", email = "tommy.odland@gmail.com"}, +] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: End Users/Desktop", + "Intended Audience :: Healthcare Industry", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "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", +] +keywords = ["strength", "training", "health", "fitness", "generator", "weightlifting", "powerlifting", "exercise"] +requires-python = ">=3.8" +dependencies = [ + "jinja2>=2.11.2", + "ortools>=7.7.7810", +] + +[project.urls] +Homepage = "https://github.com/tommyod/streprogen" +Repository = "https://github.com/tommyod/streprogen.git" + +[tool.setuptools_scm] +write_to = "streprogen/_version.py" + +[tool.setuptools.dynamic] +readme = {file = ["README.rst"], content-type = "text/x-rst"} + +[tool.setuptools.packages.find] +where = ["."] +include = ["streprogen*"] +exclude = ["contrib", "docs", "tests"] + +[tool.setuptools.package-data] +"streprogen" = ["templates/*", "*.tex", "*.html"] diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index b88034e..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -description-file = README.md diff --git a/setup.py b/setup.py deleted file mode 100644 index c03d25e..0000000 --- a/setup.py +++ /dev/null @@ -1,104 +0,0 @@ -"""A setuptools based setup module. - -See: -https://packaging.python.org/en/latest/distributing.html -https://github.com/pypa/sampleproject -""" - -import re - -# Always prefer setuptools over distutils -from setuptools import setup, find_packages - -# To use a consistent encoding -from codecs import open -from os import path - -here = path.abspath(path.dirname(__file__)) - -# Get version -with open(path.join(here, "streprogen/__init__.py"), encoding="utf-8") as file: - VERSION = re.search(r"__version__ = \"(.*?)\"", file.read()).group(1) - - -def read(fname): - return open(path.join(here, fname)).read() - - -setup( - name="streprogen", - # Versions should comply with PEP440. For a discussion on single-sourcing - # the version across setup.py and the project code, see - # https://packaging.python.org/en/latest/single_source_version.html - version=VERSION, - description="The Python strength program generator.", - long_description=read("README.rst"), - # The project's main homepage. - url="https://github.com/tommyod/streprogen", - # Author details - author="Tommy Odland", - author_email="tommy.odland@gmail.com", - # Choose your license - license="GPLv3", - # See https://pypi.python.org/pypi?%3Aaction=list_classifiers - classifiers=[ - # How mature is this project? Common values are - # 3 - Alpha - # 4 - Beta - # 5 - Production/Stable - "Development Status :: 4 - Beta", - # Indicate who your project is intended for - "Intended Audience :: End Users/Desktop", - "Intended Audience :: Healthcare Industry", - # Pick your license as you wish (should match "license" above) - "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", - # Specify the Python versions you support here. In particular, ensure - # that you indicate whether you support Python 2, Python 3 or both. - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - # What does your project relate to? - keywords="strength training program health fitness generator weightlifting powerlifting exercise", - # You can just specify the packages manually here if your project is - # simple. Or you can use find_packages(). - packages=find_packages(".", exclude=["contrib", "docs", "tests"]), - package_dir={"": "."}, - # Alternatively, if you want to distribute just a my_module.py, uncomment - # this: - # py_modules=["my_module"], - python_requires=">=3.6", - # List run-time dependencies here. These will be installed by pip when - # your project is installed. For an analysis of "install_requires" vs pip's - # requirements files see: - # https://packaging.python.org/en/latest/requirements.html - install_requires=["jinja2>=2.11.2", "ortools>=7.7.7810"], - # List additional groups of dependencies here (e.g. development - # dependencies). You can install these using the following syntax, - # for example: - # $ pip install -e .[dev,test] - # extras_require={ - # 'dev': ['check-manifest'], - # 'test': ['coverage'], - # }, - # If there are data files included in your packages that need to be - # installed, specify them here. If using Python 2.6 or less, then these - # have to be included in MANIFEST.in as well. - # include_package_data=True, - package_data={"": ["templates/*", "*.tex", "*.html"]}, - # Although 'package_data' is the preferred approach, in some case you may - # need to place data files outside of your packages. See: - # http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files # noqa - # In this case, 'data_file' will be installed into '/my_data' - # data_files=[('my_data', ['data/data_file'])], - # To provide executable scripts, use entry points in preference to the - # "scripts" keyword. Entry points provide cross-platform support and allow - # pip to create the appropriate form of executable for the target platform. - # entry_points={ - # 'console_scripts': [ - # 'sample=sample:main', - # ], - # } -) diff --git a/streprogen/__init__.py b/streprogen/__init__.py index d817fdb..bf1d325 100644 --- a/streprogen/__init__.py +++ b/streprogen/__init__.py @@ -18,7 +18,7 @@ from streprogen.program import Program from streprogen.sampling import sample_markov_ladder, sample_markov_loop -__version__ = "4.0.0" +__version__ = "4.0.1" __all__ = [ "StaticExercise",