Skip to content

Commit 35f5853

Browse files
committed
chore: support for PEP621
1 parent 4e55d50 commit 35f5853

File tree

2 files changed

+105
-114
lines changed

2 files changed

+105
-114
lines changed

pyproject.toml

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,93 @@
22
requires = ["setuptools>=45", "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.4.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 supported tool that provides a set of
34+
functions and classes for simulating the performance of photovoltaic
35+
energy systems. PVLIB Python was originally ported from the PVLIB MATLAB
36+
toolbox developed at Sandia National Laboratories and it implements many
37+
of the models and methods developed at the Labs. More information on
38+
Sandia Labs PV performance modeling programs can be found at
39+
https://pvpmc.sandia.gov/. We collaborate with the PVLIB MATLAB project,
40+
but operate independently of it.
41+
42+
We need your help to make pvlib-python a great tool!
43+
44+
Documentation: http://pvlib-python.readthedocs.io
45+
46+
Source code: https://github.com/pvlib/pvlib-python
47+
"""
48+
readme.content-type = "text/x-rst"
49+
dynamic = ["version"]
50+
51+
52+
[project.optional-dependencies]
53+
optional = [
54+
'cython',
55+
'ephem',
56+
'nrel-pysam',
57+
'numba',
58+
'solarfactors',
59+
'statsmodels',
60+
]
61+
doc = [
62+
'ipython',
63+
'matplotlib',
64+
'sphinx == 4.5.0',
65+
'pydata-sphinx-theme == 0.8.1',
66+
'sphinx-gallery',
67+
'docutils == 0.15.2',
68+
'pillow',
69+
'sphinx-toggleprompt >= 0.0.5',
70+
'solarfactors',
71+
]
72+
test = [
73+
'pytest',
74+
'pytest-cov',
75+
'pytest-mock',
76+
'requests-mock',
77+
'pytest-timeout',
78+
'pytest-rerunfailures',
79+
'pytest-remotedata',
80+
'packaging',
81+
]
82+
all = ["pvlib[test,optional,doc]"]
83+
84+
[project.urls]
85+
"Bug Tracker" = "https://github.com/pvlib/pvlib-python/issues"
86+
Documentation = "https://pvlib-python.readthedocs.io/"
87+
"Source Code" = "https://github.com/pvlib/pvlib-python"
88+
89+
[tool.setuptools.packages.find]
90+
include = ["pvlib*"]
91+
592
[tool.setuptools_scm]
693

794
[tool.pytest]
@@ -13,10 +100,10 @@ testpaths = "pvlib/tests"
13100
# syntax is: action:message:category:module:lineno
14101
# `message` is a regex matching start of warning message
15102
# https://docs.python.org/3/library/warnings.html#the-warnings-filter
16-
filterwarnings =[
103+
filterwarnings = [
17104
"ignore:Using or importing the ABCs:DeprecationWarning:.*patsy:",
18105
# deprecation warnings from numpy 1.20
19106
"ignore:`np.long` is a deprecated alias:DeprecationWarning:.*numba:",
20107
"ignore:`np.int` is a deprecated alias:DeprecationWarning:.*(numba|scipy):",
21108
"ignore:`np.bool` is a deprecated alias:DeprecationWarning:.*numba:",
22-
]
109+
]

setup.py

Lines changed: 16 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -3,128 +3,32 @@
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 supported tool that provides a set of
16-
functions and classes for simulating the performance of photovoltaic
17-
energy systems. PVLIB Python was originally ported from the PVLIB MATLAB
18-
toolbox developed at Sandia National Laboratories and it implements many
19-
of the models and methods developed at the Labs. More information on
20-
Sandia Labs PV performance modeling programs can be found at
21-
https://pvpmc.sandia.gov/. We collaborate with the PVLIB MATLAB project,
22-
but operate independently of it.
23-
24-
We need your help to make pvlib-python a great tool!
25-
26-
Documentation: http://pvlib-python.readthedocs.io
27-
28-
Source code: https://github.com/pvlib/pvlib-python
29-
"""
30-
LONG_DESCRIPTION_CONTENT_TYPE = "text/x-rst"
31-
32-
DISTNAME = 'pvlib'
33-
LICENSE = 'BSD 3-Clause'
34-
AUTHOR = 'pvlib python Developers'
35-
MAINTAINER_EMAIL = '[email protected]'
36-
URL = 'https://github.com/pvlib/pvlib-python'
37-
38-
INSTALL_REQUIRES = ['numpy >= 1.16.0',
39-
'pandas >= 0.25.0',
40-
'pytz',
41-
'requests',
42-
'scipy >= 1.4.0',
43-
'h5py',
44-
'importlib-metadata; python_version < "3.8"']
45-
46-
TESTS_REQUIRE = ['pytest', 'pytest-cov', 'pytest-mock',
47-
'requests-mock', 'pytest-timeout', 'pytest-rerunfailures',
48-
'pytest-remotedata', 'packaging']
49-
EXTRAS_REQUIRE = {
50-
'optional': ['cython', 'ephem', 'nrel-pysam', 'numba',
51-
'solarfactors', 'statsmodels'],
52-
'doc': ['ipython', 'matplotlib', 'sphinx == 4.5.0',
53-
'pydata-sphinx-theme == 0.8.1', 'sphinx-gallery',
54-
'docutils == 0.15.2', 'pillow',
55-
'sphinx-toggleprompt >= 0.0.5', 'solarfactors'],
56-
'test': TESTS_REQUIRE
57-
}
58-
EXTRAS_REQUIRE['all'] = sorted(set(sum(EXTRAS_REQUIRE.values(), [])))
59-
60-
CLASSIFIERS = [
61-
'Development Status :: 4 - Beta',
62-
'License :: OSI Approved :: BSD License',
63-
'Operating System :: OS Independent',
64-
'Intended Audience :: Science/Research',
65-
'Programming Language :: Python',
66-
'Programming Language :: Python :: 3',
67-
'Topic :: Scientific/Engineering',
68-
]
69-
70-
setuptools_kwargs = {
71-
'zip_safe': False,
72-
'scripts': [],
73-
'include_package_data': True,
74-
'python_requires': '>=3.7'
75-
}
76-
77-
PROJECT_URLS = {
78-
"Bug Tracker": "https://github.com/pvlib/pvlib-python/issues",
79-
"Documentation": "https://pvlib-python.readthedocs.io/",
80-
"Source Code": "https://github.com/pvlib/pvlib-python",
81-
}
82-
83-
# set up pvlib packages to be installed and extensions to be compiled
84-
85-
# the list of packages is not just the top-level "pvlib", but also
86-
# all sub-packages like "pvlib.bifacial". Here, setuptools's definition of
87-
# "package" is, in effect, any directory you want to include in the
88-
# distribution. So even "pvlib.data" counts as a package, despite
89-
# not having any python code or even an __init__.py.
90-
# setuptools.find_namespace_packages() will find all these directories,
91-
# although to exclude "docs", "ci", etc., we include only names matching
92-
# the "pvlib*" glob. Although note that "docs" does get added separately
93-
# via the MANIFEST.in spec.
94-
PACKAGES = find_namespace_packages(include=['pvlib*'])
9513

9614
extensions = []
9715

98-
spa_sources = ['pvlib/spa_c_files/spa.c', 'pvlib/spa_c_files/spa_py.c']
99-
spa_depends = ['pvlib/spa_c_files/spa.h']
100-
spa_all_file_paths = map(lambda x: os.path.join(os.path.dirname(__file__), x),
101-
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), spa_sources + spa_depends
20+
)
10221

10322
if all(map(os.path.exists, spa_all_file_paths)):
104-
print('all spa_c files found')
105-
PACKAGES.append('pvlib.spa_c_files')
106-
107-
spa_ext = Extension('pvlib.spa_c_files.spa_py',
108-
sources=spa_sources, depends=spa_depends)
23+
print("all spa_c files found")
24+
spa_ext = Extension(
25+
"pvlib.spa_c_files.spa_py", sources=spa_sources, depends=spa_depends
26+
)
10927
extensions.append(spa_ext)
11028
else:
111-
print('WARNING: spa_c files not detected. ' +
112-
'See installation instructions for more information.')
29+
print(
30+
"WARNING: spa_c files not detected. See installation instructions for more information."
31+
)
11332

11433

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

0 commit comments

Comments
 (0)