Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PEP621 #1910

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 87 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,91 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
requires = ["setuptools>=61", "wheel", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"


[project]
name = "pvlib"
description = "A set of functions and classes for simulating the performance of photovoltaic energy systems."
authors = [
{ name = "pvlib python Developers", email = "pvlib-admin@googlegroups.com" },
]
requires-python = ">=3.7"
dependencies = [
'numpy >= 1.16.0',
'pandas >= 0.25.0',
'pytz',
'requests',
'scipy >= 1.5.0',
'h5py',
'importlib-metadata; python_version < "3.8"',
]
license = { text = "BSD-3-Clause" }
classifiers = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering',
]
readme.text = """
pvlib python is a community developed toolbox that provides a set of
functions and classes for simulating the performance of photovoltaic
energy systems and accomplishing related tasks. The core mission of pvlib
python is to provide open, reliable, interoperable, and benchmark
implementations of PV system models.

We need your help to make pvlib-python a great tool!

Documentation: http://pvlib-python.readthedocs.io

Source code: https://github.com/pvlib/pvlib-python
"""
readme.content-type = "text/x-rst"
dynamic = ["version"]


[project.optional-dependencies]
optional = [
'cython',
'ephem',
'nrel-pysam',
'numba',
'solarfactors',
'statsmodels',
]
doc = [
'ipython',
'matplotlib',
'sphinx == 4.5.0',
'pydata-sphinx-theme == 0.8.1',
'sphinx-gallery',
'docutils == 0.15.2',
'pillow',
'sphinx-toggleprompt >= 0.0.5',
'solarfactors',
]
test = [
'pytest',
'pytest-cov',
'pytest-mock',
'requests-mock',
'pytest-timeout',
'pytest-rerunfailures',
'pytest-remotedata',
'packaging',
]
all = ["pvlib[test,optional,doc]"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was curious about using a recursive dependency to construct combined dependency groups. In case anyone else is interested: from what I can tell, this is a not-yet-documented (see discuss and pypa/pip#11296) feature of pip that other projects are using, e.g. https://github.com/astropy/astropy/blob/main/pyproject.toml#L73

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell me if you'd prefer to have explicit dependencies.


[project.urls]
"Bug Tracker" = "https://github.com/pvlib/pvlib-python/issues"
Documentation = "https://pvlib-python.readthedocs.io/"
"Source Code" = "https://github.com/pvlib/pvlib-python"

[tool.setuptools.packages.find]
include = ["pvlib*"]

[tool.setuptools_scm]

[tool.pytest]
Expand All @@ -13,10 +97,10 @@ testpaths = "pvlib/tests"
# syntax is: action:message:category:module:lineno
# `message` is a regex matching start of warning message
# https://docs.python.org/3/library/warnings.html#the-warnings-filter
filterwarnings =[
filterwarnings = [
"ignore:Using or importing the ABCs:DeprecationWarning:.*patsy:",
# deprecation warnings from numpy 1.20
"ignore:`np.long` is a deprecated alias:DeprecationWarning:.*numba:",
"ignore:`np.int` is a deprecated alias:DeprecationWarning:.*(numba|scipy):",
"ignore:`np.bool` is a deprecated alias:DeprecationWarning:.*numba:",
]
]
127 changes: 18 additions & 109 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,125 +3,34 @@
import os

try:
from setuptools import setup, find_namespace_packages
from setuptools import setup
from setuptools.extension import Extension
except ImportError:
raise RuntimeError('setuptools is required')
raise RuntimeError("setuptools is required")

URL = "https://github.com/pvlib/pvlib-python"

DESCRIPTION = ('A set of functions and classes for simulating the ' +
'performance of photovoltaic energy systems.')
LONG_DESCRIPTION = """
pvlib python is a community developed toolbox that provides a set of
functions and classes for simulating the performance of photovoltaic
energy systems and accomplishing related tasks. The core mission of pvlib
python is to provide open, reliable, interoperable, and benchmark
implementations of PV system models.

We need your help to make pvlib-python a great tool!

Documentation: http://pvlib-python.readthedocs.io

Source code: https://github.com/pvlib/pvlib-python
"""
LONG_DESCRIPTION_CONTENT_TYPE = "text/x-rst"

DISTNAME = 'pvlib'
LICENSE = 'BSD 3-Clause'
AUTHOR = 'pvlib python Developers'
MAINTAINER_EMAIL = 'pvlib-admin@googlegroups.com'
URL = 'https://github.com/pvlib/pvlib-python'

INSTALL_REQUIRES = ['numpy >= 1.16.0',
'pandas >= 0.25.0',
'pytz',
'requests',
'scipy >= 1.5.0',
'h5py',
'importlib-metadata; python_version < "3.8"']

TESTS_REQUIRE = ['pytest', 'pytest-cov', 'pytest-mock',
'requests-mock', 'pytest-timeout', 'pytest-rerunfailures',
'pytest-remotedata', 'packaging']
EXTRAS_REQUIRE = {
'optional': ['cython', 'ephem', 'nrel-pysam', 'numba',
'solarfactors', 'statsmodels'],
'doc': ['ipython', 'matplotlib', 'sphinx == 4.5.0',
'pydata-sphinx-theme == 0.8.1', 'sphinx-gallery',
'docutils == 0.15.2', 'pillow',
'sphinx-toggleprompt >= 0.0.5', 'solarfactors'],
'test': TESTS_REQUIRE
}
EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), [])))

CLASSIFIERS = [
'Development Status :: 4 - Beta',
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Intended Audience :: Science/Research',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering',
]

setuptools_kwargs = {
'zip_safe': False,
'scripts': [],
'include_package_data': True,
'python_requires': '>=3.7'
}

PROJECT_URLS = {
"Bug Tracker": "https://github.com/pvlib/pvlib-python/issues",
"Documentation": "https://pvlib-python.readthedocs.io/",
"Source Code": "https://github.com/pvlib/pvlib-python",
}

# set up pvlib packages to be installed and extensions to be compiled

# the list of packages is not just the top-level "pvlib", but also
# all sub-packages like "pvlib.bifacial". Here, setuptools's definition of
# "package" is, in effect, any directory you want to include in the
# distribution. So even "pvlib.data" counts as a package, despite
# not having any python code or even an __init__.py.
# setuptools.find_namespace_packages() will find all these directories,
# although to exclude "docs", "ci", etc., we include only names matching
# the "pvlib*" glob. Although note that "docs" does get added separately
# via the MANIFEST.in spec.
PACKAGES = find_namespace_packages(include=['pvlib*'])

extensions = []

spa_sources = ['pvlib/spa_c_files/spa.c', 'pvlib/spa_c_files/spa_py.c']
spa_depends = ['pvlib/spa_c_files/spa.h']
spa_all_file_paths = map(lambda x: os.path.join(os.path.dirname(__file__), x),
spa_sources + spa_depends)
spa_sources = ["pvlib/spa_c_files/spa.c", "pvlib/spa_c_files/spa_py.c"]
spa_depends = ["pvlib/spa_c_files/spa.h"]
spa_all_file_paths = map(
lambda x: os.path.join(os.path.dirname(__file__), x),
spa_sources + spa_depends
)

if all(map(os.path.exists, spa_all_file_paths)):
print('all spa_c files found')
PACKAGES.append('pvlib.spa_c_files')

spa_ext = Extension('pvlib.spa_c_files.spa_py',
sources=spa_sources, depends=spa_depends)
print("all spa_c files found")
spa_ext = Extension(
"pvlib.spa_c_files.spa_py", sources=spa_sources, depends=spa_depends
)
extensions.append(spa_ext)
else:
print('WARNING: spa_c files not detected. ' +
'See installation instructions for more information.')
print(
"WARNING: spa_c files not detected. "
+ "See installation instructions for more information."
)


setup(name=DISTNAME,
packages=PACKAGES,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
tests_require=TESTS_REQUIRE,
ext_modules=extensions,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
long_description_content_type=LONG_DESCRIPTION_CONTENT_TYPE,
author=AUTHOR,
maintainer_email=MAINTAINER_EMAIL,
license=LICENSE,
url=URL,
project_urls=PROJECT_URLS,
classifiers=CLASSIFIERS,
**setuptools_kwargs)
setup(ext_modules=extensions, url=URL)
Loading