diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 3e1ee9689..6e23c61d2 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -51,7 +51,7 @@ jobs: with: python-version: 3.8 cache: "pip" - cache-dependency-path: "setup.py" + cache-dependency-path: "pyproject.toml" - name: Install testing dependencies run: | python -m pip install --upgrade pip diff --git a/_delphi_utils_python/.bumpversion.cfg b/_delphi_utils_python/.bumpversion.cfg index 722a91e30..af22c56eb 100644 --- a/_delphi_utils_python/.bumpversion.cfg +++ b/_delphi_utils_python/.bumpversion.cfg @@ -4,6 +4,6 @@ commit = True message = chore: bump delphi_utils to {new_version} tag = False -[bumpversion:file:setup.py] +[bumpversion:file:pyproject.toml] [bumpversion:file:delphi_utils/__init__.py] diff --git a/_delphi_utils_python/DEVELOP.md b/_delphi_utils_python/DEVELOP.md index 2407e29a8..53ffde93f 100644 --- a/_delphi_utils_python/DEVELOP.md +++ b/_delphi_utils_python/DEVELOP.md @@ -9,7 +9,7 @@ To install the module in your default version of Python, run the following from this directory: ``` -pip install . +pip install -e '.[dev]' ``` As described in each of the indicator code directories, you will want to install diff --git a/_delphi_utils_python/Makefile b/_delphi_utils_python/Makefile index 79d7f7943..60f7d2af0 100644 --- a/_delphi_utils_python/Makefile +++ b/_delphi_utils_python/Makefile @@ -6,12 +6,12 @@ venv: install: venv . env/bin/activate; \ pip install wheel ; \ - pip install -e . + pip install -e '.[dev]' install-ci: venv . env/bin/activate; \ - pip install wheel ; \ - pip install . + pip install 'build[virtualenv]' pylint pytest pydocstyle wheel twine ; \ + pip install '.[dev]' lint: . env/bin/activate; pylint delphi_utils --rcfile=../pyproject.toml @@ -30,4 +30,5 @@ clean: release: lint test . env/bin/activate ; \ - python setup.py sdist bdist_wheel + pip install 'build[virtualenv]' ; \ + python -m build --sdist --wheel \ No newline at end of file diff --git a/_delphi_utils_python/pyproject.toml b/_delphi_utils_python/pyproject.toml new file mode 100644 index 000000000..d6480baf0 --- /dev/null +++ b/_delphi_utils_python/pyproject.toml @@ -0,0 +1,57 @@ +[build-system] +requires = ["setuptools", "setuptools-scm>=8.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "delphi-utils" +version = "0.3.24" +description = "Shared Utility Functions for Indicators" +readme = "README.md" +requires-python = "== 3.8.*" +license = { text = "MIT License" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3.8", + "License :: MIT", +] +dependencies = [ + "boto3", + "covidcast", + "cvxpy", + "epiweeks", + "gitpython", + "importlib_resources>=1.3", + "numpy", + "pandas>=1.1.0", + "requests", + "slackclient", + "scs<3.2.6", # TODO: remove this ; it is a cvxpy dependency, and the excluded version appears to break our jenkins build. see: https://github.com/cvxgrp/scs/issues/283 + "structlog", + "xlrd", # needed by Pandas to read Excel files +] + +[project.urls] +Homepage = "https://github.com/cmu-delphi/covidcast-indicators" + +[project.optional-dependencies] +dev = [ + "darker[isort]~=2.1.1", + "pylint==2.8.3", + "pytest", + "pydocstyle", + "pytest-cov", + "mock", + "moto~=4.2.14", + "requests-mock", + "freezegun", +] +flash = ["scipy"] + +[tool.setuptools.packages.find] +where = ["."] +include = ["delphi_utils"] +namespaces = true + +[tool.setuptools.package-data] +"delphi_utils.data" = ["20*/*.csv"] diff --git a/_delphi_utils_python/setup.py b/_delphi_utils_python/setup.py deleted file mode 100644 index 3dee89b53..000000000 --- a/_delphi_utils_python/setup.py +++ /dev/null @@ -1,48 +0,0 @@ -from setuptools import setup -from setuptools import find_packages - -with open("README.md", "r") as f: - long_description = f.read() - -required = [ - "boto3", - "covidcast", - "cvxpy", - "scs<3.2.6", # TODO: remove this ; it is a cvxpy dependency, and the excluded version appears to break our jenkins build. see: https://github.com/cvxgrp/scs/issues/283 - "darker[isort]~=2.1.1", - "epiweeks", - "freezegun", - "gitpython", - "importlib_resources>=1.3", - "mock", - "moto~=4.2.14", - "numpy", - "pandas>=1.1.0", - "pydocstyle", - "pylint==2.8.3", - "pytest-cov", - "pytest", - "requests-mock", - "slackclient", - "structlog", - "xlrd" -] - -setup( - name="delphi_utils", - version="0.3.24", - description="Shared Utility Functions for Indicators", - long_description=long_description, - long_description_content_type="text/markdown", - author="", - author_email="", - url="https://github.com/cmu-delphi/", - install_requires=required, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", - ], - packages=find_packages(), - package_data={'': ['data/20*/*.csv']} -) diff --git a/_template_python/pyproject.toml b/_template_python/pyproject.toml new file mode 100644 index 000000000..c29d9650e --- /dev/null +++ b/_template_python/pyproject.toml @@ -0,0 +1,42 @@ +[build-system] +requires = ["setuptools", "setuptools-scm>=8.0"] +build-backend = "setuptools.build_meta" + +[project] +name = "delphi_NAME" +version = "0.1.0" +description = "SHORT DESCRIPTION" +readme = "README.md" +requires-python = "== 3.8.*" +license = { text = "MIT License" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Programming Language :: Python :: 3.8", + "License :: MIT", +] +dependencies = [ + "delphi-utils", + "numpy", + "pandas>=1.1.0", +] + +[project.urls] +Homepage = "https://github.com/cmu-delphi/covidcast-indicators" + +[project.optional-dependencies] +dev = [ + "darker[isort]~=2.1.1", + "pylint==2.8.3", + "pytest", + "pydocstyle", + "pytest-cov", + "mock", + "moto~=4.2.14", + "requests-mock", + "freezegun", +] + +[tool.setuptools.packages.find] +where = ["."] +namespaces = true diff --git a/_template_python/setup.py b/_template_python/setup.py deleted file mode 100644 index d7bc44078..000000000 --- a/_template_python/setup.py +++ /dev/null @@ -1,30 +0,0 @@ -from setuptools import setup -from setuptools import find_packages - -required = [ - "covidcast", - "darker[isort]~=2.1.1", - "delphi-utils", - "numpy", - "pandas", - "pydocstyle", - "pylint==2.8.3", - "pytest-cov", - "pytest", -] - -setup( - name="delphi_NAME", - version="0.1.0", - description="SHORT DESCRIPTION", - author="", - author_email="", - url="https://github.com/cmu-delphi/covidcast-indicators", - install_requires=required, - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3.8", - ], - packages=find_packages(), -) diff --git a/changehc/setup.py b/changehc/setup.py index d95beb771..f386e9613 100644 --- a/changehc/setup.py +++ b/changehc/setup.py @@ -6,6 +6,7 @@ "covidcast", "darker[isort]~=2.1.1", "delphi-utils", + "mock", "moto~=4.2.14", "numpy", "pandas", diff --git a/jenkins/build-indicator.sh b/jenkins/build-indicator.sh index 3d2315741..84006767c 100755 --- a/jenkins/build-indicator.sh +++ b/jenkins/build-indicator.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # -# Jenkins build +# Jenkins build # set -eo pipefail @@ -17,4 +17,4 @@ source env/bin/activate pip install pip==23.0.1 --retries 10 --timeout 20 pip install numpy --retries 10 --timeout 20 pip install ../_delphi_utils_python/. --retries 10 --timeout 20 -[ ! -f setup.py ] || pip install . --retries 10 --timeout 20 +[ ! -f pyproject.toml ] || pip install . --retries 10 --timeout 20 diff --git a/nchs_mortality/setup.py b/nchs_mortality/setup.py index 3fe354ba4..142db6f35 100644 --- a/nchs_mortality/setup.py +++ b/nchs_mortality/setup.py @@ -2,10 +2,12 @@ from setuptools import find_packages required = [ + "boto3", "darker[isort]~=2.1.1", "delphi-utils", "epiweeks", "freezegun", + "moto~=4.2.14", "numpy", "pandas", "pydocstyle", diff --git a/quidel_covidtest/setup.py b/quidel_covidtest/setup.py index c2791930f..82c80832a 100644 --- a/quidel_covidtest/setup.py +++ b/quidel_covidtest/setup.py @@ -2,6 +2,7 @@ from setuptools import find_packages required = [ + "boto3", "covidcast", "darker[isort]~=2.1.1", "delphi-utils", @@ -14,7 +15,7 @@ "pylint==2.8.3", "pytest-cov", "pytest", - "xlrd==1.2.0", + "xlrd==1.2.0", # needed by Pandas to read Excel files ] setup(