Skip to content

Commit 3692427

Browse files
authored
setup.py: use setuptools.find_namespace_packages() (#1483)
* setup.py: use setuptools.find_packages() * switch to better method; add documentation * more comment * use stable pypi release action should hopefully address and silence this warning: Warning: You are using "pypa/gh-action-pypi-publish@master". The "master" branch of this project has been sunset and will not receive any updates, not even security bug fixes. Please, make sure to use a supported version. If you want to pin to v1 major version, use "pypa/gh-action-pypi-publish@release/v1". If you feel adventurous, you may opt to use use "pypa/gh-action-pypi-publish@unstable/v1" instead. A more general recommendation is to pin to exact tags or commit shas. * some pruning * fix errors
1 parent 798799a commit 3692427

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
# only publish distribution to PyPI for tagged commits
3636
- name: Publish distribution to PyPI
3737
if: startsWith(github.ref, 'refs/tags/v')
38-
uses: pypa/gh-action-pypi-publish@master
38+
uses: pypa/gh-action-pypi-publish@release/v1
3939
with:
4040
user: __token__
4141
password: ${{ secrets.pypi_password }}

MANIFEST.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,15 @@ global-exclude .DS_Store
1717
global-exclude .git*
1818
global-exclude \#*
1919
global-exclude .ipynb_checkpoints
20+
21+
exclude .coveragerc
22+
exclude .lgtm.yml
23+
exclude .stickler.yml
24+
exclude codecov.yml
25+
exclude readthedocs.yml
26+
exclude CODE_OF_CONDUCT.md
27+
28+
prune paper
29+
prune .github
30+
prune benchmarks
31+
prune ci

setup.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import sys
55

66
try:
7-
from setuptools import setup
7+
from setuptools import setup, find_namespace_packages
88
from setuptools.extension import Extension
99
except ImportError:
1010
raise RuntimeError('setuptools is required')
@@ -82,7 +82,17 @@
8282
}
8383

8484
# set up pvlib packages to be installed and extensions to be compiled
85-
PACKAGES = ['pvlib']
85+
86+
# the list of packages is not just the top-level "pvlib", but also
87+
# all sub-packages like "pvlib.bifacial". Here, setuptools's definition of
88+
# "package" is, in effect, any directory you want to include in the
89+
# distribution. So even "pvlib.data" counts as a package, despite
90+
# not having any python code or even an __init__.py.
91+
# setuptools.find_namespace_packages() will find all these directories,
92+
# although to exclude "docs", "ci", etc., we include only names matching
93+
# the "pvlib*" glob. Although note that "docs" does get added separately
94+
# via the MANIFEST.in spec.
95+
PACKAGES = find_namespace_packages(include=['pvlib*'])
8696

8797
extensions = []
8898

0 commit comments

Comments
 (0)