Skip to content

Commit 09cf445

Browse files
authored
Support PEP621 (#1910)
1 parent 62de654 commit 09cf445

File tree

2 files changed

+105
-112
lines changed

2 files changed

+105
-112
lines changed

pyproject.toml

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,91 @@
11
[build-system]
2-
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
2+
requires = ["setuptools>=61", "wheel", "setuptools_scm>=6.2"]
33
build-backend = "setuptools.build_meta"
44

5+
6+
[project]
7+
name = "pvlib"
8+
description = "A set of functions and classes for simulating the performance of photovoltaic energy systems."
9+
authors = [
10+
{ name = "pvlib python Developers", email = "[email protected]" },
11+
]
12+
requires-python = ">=3.7"
13+
dependencies = [
14+
'numpy >= 1.16.0',
15+
'pandas >= 0.25.0',
16+
'pytz',
17+
'requests',
18+
'scipy >= 1.5.0',
19+
'h5py',
20+
'importlib-metadata; python_version < "3.8"',
21+
]
22+
license = { text = "BSD-3-Clause" }
23+
classifiers = [
24+
'Development Status :: 4 - Beta',
25+
'License :: OSI Approved :: BSD License',
26+
'Operating System :: OS Independent',
27+
'Intended Audience :: Science/Research',
28+
'Programming Language :: Python',
29+
'Programming Language :: Python :: 3',
30+
'Topic :: Scientific/Engineering',
31+
]
32+
readme.text = """
33+
pvlib python is a community developed toolbox that provides a set of
34+
functions and classes for simulating the performance of photovoltaic
35+
energy systems and accomplishing related tasks. The core mission of pvlib
36+
python is to provide open, reliable, interoperable, and benchmark
37+
implementations of PV system models.
38+
39+
We need your help to make pvlib-python a great tool!
40+
41+
Documentation: http://pvlib-python.readthedocs.io
42+
43+
Source code: https://github.com/pvlib/pvlib-python
44+
"""
45+
readme.content-type = "text/x-rst"
46+
dynamic = ["version"]
47+
48+
49+
[project.optional-dependencies]
50+
optional = [
51+
'cython',
52+
'ephem',
53+
'nrel-pysam',
54+
'numba',
55+
'solarfactors',
56+
'statsmodels',
57+
]
58+
doc = [
59+
'ipython',
60+
'matplotlib',
61+
'sphinx == 4.5.0',
62+
'pydata-sphinx-theme == 0.8.1',
63+
'sphinx-gallery',
64+
'docutils == 0.15.2',
65+
'pillow',
66+
'sphinx-toggleprompt >= 0.0.5',
67+
'solarfactors',
68+
]
69+
test = [
70+
'pytest',
71+
'pytest-cov',
72+
'pytest-mock',
73+
'requests-mock',
74+
'pytest-timeout',
75+
'pytest-rerunfailures',
76+
'pytest-remotedata',
77+
'packaging',
78+
]
79+
all = ["pvlib[test,optional,doc]"]
80+
81+
[project.urls]
82+
"Bug Tracker" = "https://github.com/pvlib/pvlib-python/issues"
83+
Documentation = "https://pvlib-python.readthedocs.io/"
84+
"Source Code" = "https://github.com/pvlib/pvlib-python"
85+
86+
[tool.setuptools.packages.find]
87+
include = ["pvlib*"]
88+
589
[tool.setuptools_scm]
690

791
[tool.pytest]
@@ -13,10 +97,10 @@ testpaths = "pvlib/tests"
1397
# syntax is: action:message:category:module:lineno
1498
# `message` is a regex matching start of warning message
1599
# https://docs.python.org/3/library/warnings.html#the-warnings-filter
16-
filterwarnings =[
100+
filterwarnings = [
17101
"ignore:Using or importing the ABCs:DeprecationWarning:.*patsy:",
18102
# deprecation warnings from numpy 1.20
19103
"ignore:`np.long` is a deprecated alias:DeprecationWarning:.*numba:",
20104
"ignore:`np.int` is a deprecated alias:DeprecationWarning:.*(numba|scipy):",
21105
"ignore:`np.bool` is a deprecated alias:DeprecationWarning:.*numba:",
22-
]
106+
]

setup.py

Lines changed: 18 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -3,125 +3,34 @@
33
import os
44

55
try:
6-
from setuptools import setup, find_namespace_packages
6+
from setuptools import setup
77
from setuptools.extension import Extension
88
except ImportError:
9-
raise RuntimeError('setuptools is required')
9+
raise RuntimeError("setuptools is required")
1010

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

12-
DESCRIPTION = ('A set of functions and classes for simulating the ' +
13-
'performance of photovoltaic energy systems.')
14-
LONG_DESCRIPTION = """
15-
pvlib python is a community developed toolbox that provides a set of
16-
functions and classes for simulating the performance of photovoltaic
17-
energy systems and accomplishing related tasks. The core mission of pvlib
18-
python is to provide open, reliable, interoperable, and benchmark
19-
implementations of PV system models.
20-
21-
We need your help to make pvlib-python a great tool!
22-
23-
Documentation: http://pvlib-python.readthedocs.io
24-
25-
Source code: https://github.com/pvlib/pvlib-python
26-
"""
27-
LONG_DESCRIPTION_CONTENT_TYPE = "text/x-rst"
28-
29-
DISTNAME = 'pvlib'
30-
LICENSE = 'BSD 3-Clause'
31-
AUTHOR = 'pvlib python Developers'
32-
MAINTAINER_EMAIL = '[email protected]'
33-
URL = 'https://github.com/pvlib/pvlib-python'
34-
35-
INSTALL_REQUIRES = ['numpy >= 1.16.0',
36-
'pandas >= 0.25.0',
37-
'pytz',
38-
'requests',
39-
'scipy >= 1.5.0',
40-
'h5py',
41-
'importlib-metadata; python_version < "3.8"']
42-
43-
TESTS_REQUIRE = ['pytest', 'pytest-cov', 'pytest-mock',
44-
'requests-mock', 'pytest-timeout', 'pytest-rerunfailures',
45-
'pytest-remotedata', 'packaging']
46-
EXTRAS_REQUIRE = {
47-
'optional': ['cython', 'ephem', 'nrel-pysam', 'numba',
48-
'solarfactors', 'statsmodels'],
49-
'doc': ['ipython', 'matplotlib', 'sphinx == 4.5.0',
50-
'pydata-sphinx-theme == 0.8.1', 'sphinx-gallery',
51-
'docutils == 0.15.2', 'pillow',
52-
'sphinx-toggleprompt >= 0.0.5', 'solarfactors'],
53-
'test': TESTS_REQUIRE
54-
}
55-
EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), [])))
56-
57-
CLASSIFIERS = [
58-
'Development Status :: 4 - Beta',
59-
'License :: OSI Approved :: BSD License',
60-
'Operating System :: OS Independent',
61-
'Intended Audience :: Science/Research',
62-
'Programming Language :: Python',
63-
'Programming Language :: Python :: 3',
64-
'Topic :: Scientific/Engineering',
65-
]
66-
67-
setuptools_kwargs = {
68-
'zip_safe': False,
69-
'scripts': [],
70-
'include_package_data': True,
71-
'python_requires': '>=3.7'
72-
}
73-
74-
PROJECT_URLS = {
75-
"Bug Tracker": "https://github.com/pvlib/pvlib-python/issues",
76-
"Documentation": "https://pvlib-python.readthedocs.io/",
77-
"Source Code": "https://github.com/pvlib/pvlib-python",
78-
}
79-
80-
# set up pvlib packages to be installed and extensions to be compiled
81-
82-
# the list of packages is not just the top-level "pvlib", but also
83-
# all sub-packages like "pvlib.bifacial". Here, setuptools's definition of
84-
# "package" is, in effect, any directory you want to include in the
85-
# distribution. So even "pvlib.data" counts as a package, despite
86-
# not having any python code or even an __init__.py.
87-
# setuptools.find_namespace_packages() will find all these directories,
88-
# although to exclude "docs", "ci", etc., we include only names matching
89-
# the "pvlib*" glob. Although note that "docs" does get added separately
90-
# via the MANIFEST.in spec.
91-
PACKAGES = find_namespace_packages(include=['pvlib*'])
9213

9314
extensions = []
9415

95-
spa_sources = ['pvlib/spa_c_files/spa.c', 'pvlib/spa_c_files/spa_py.c']
96-
spa_depends = ['pvlib/spa_c_files/spa.h']
97-
spa_all_file_paths = map(lambda x: os.path.join(os.path.dirname(__file__), x),
98-
spa_sources + spa_depends)
16+
spa_sources = ["pvlib/spa_c_files/spa.c", "pvlib/spa_c_files/spa_py.c"]
17+
spa_depends = ["pvlib/spa_c_files/spa.h"]
18+
spa_all_file_paths = map(
19+
lambda x: os.path.join(os.path.dirname(__file__), x),
20+
spa_sources + spa_depends
21+
)
9922

10023
if all(map(os.path.exists, spa_all_file_paths)):
101-
print('all spa_c files found')
102-
PACKAGES.append('pvlib.spa_c_files')
103-
104-
spa_ext = Extension('pvlib.spa_c_files.spa_py',
105-
sources=spa_sources, depends=spa_depends)
24+
print("all spa_c files found")
25+
spa_ext = Extension(
26+
"pvlib.spa_c_files.spa_py", sources=spa_sources, depends=spa_depends
27+
)
10628
extensions.append(spa_ext)
10729
else:
108-
print('WARNING: spa_c files not detected. ' +
109-
'See installation instructions for more information.')
30+
print(
31+
"WARNING: spa_c files not detected. "
32+
+ "See installation instructions for more information."
33+
)
11034

11135

112-
setup(name=DISTNAME,
113-
packages=PACKAGES,
114-
install_requires=INSTALL_REQUIRES,
115-
extras_require=EXTRAS_REQUIRE,
116-
tests_require=TESTS_REQUIRE,
117-
ext_modules=extensions,
118-
description=DESCRIPTION,
119-
long_description=LONG_DESCRIPTION,
120-
long_description_content_type=LONG_DESCRIPTION_CONTENT_TYPE,
121-
author=AUTHOR,
122-
maintainer_email=MAINTAINER_EMAIL,
123-
license=LICENSE,
124-
url=URL,
125-
project_urls=PROJECT_URLS,
126-
classifiers=CLASSIFIERS,
127-
**setuptools_kwargs)
36+
setup(ext_modules=extensions, url=URL)

0 commit comments

Comments
 (0)