summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSeth R. Johnson <johnsonsr@ornl.gov>2021-11-12 11:58:44 -0500
committerGitHub <noreply@github.com>2021-11-12 10:58:44 -0600
commita04cc4470e20a9b8b72c914229d67d2eaaf49b82 (patch)
treeb52b6cf3b33da6ae9dda8b42f20b8529f6515064 /lib
parent407f68a67b2e5649de50406e00457f7eb6a4471c (diff)
downloadspack-a04cc4470e20a9b8b72c914229d67d2eaaf49b82.tar.gz
spack-a04cc4470e20a9b8b72c914229d67d2eaaf49b82.tar.bz2
spack-a04cc4470e20a9b8b72c914229d67d2eaaf49b82.tar.xz
spack-a04cc4470e20a9b8b72c914229d67d2eaaf49b82.zip
Add PyPI docs and warning in auto-generated package (#27404)
* docs: Add cross-references for pypi setup * create: add warning for missing pypi
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/docs/build_systems/pythonpackage.rst13
-rw-r--r--lib/spack/spack/cmd/create.py6
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/spack/docs/build_systems/pythonpackage.rst b/lib/spack/docs/build_systems/pythonpackage.rst
index 30875d15f3..365c5d7bce 100644
--- a/lib/spack/docs/build_systems/pythonpackage.rst
+++ b/lib/spack/docs/build_systems/pythonpackage.rst
@@ -125,12 +125,15 @@ The zip file will not contain a ``setup.py``, but it will contain a
``METADATA`` file which contains all the information you need to
write a ``package.py`` build recipe.
+.. _pypi:
+
^^^^
PyPI
^^^^
-The vast majority of Python packages are hosted on PyPI - The Python
-Package Index. ``pip`` only supports packages hosted on PyPI, making
+The vast majority of Python packages are hosted on PyPI (The Python
+Package Index), which is :ref:`preferred over GitHub <pypi-vs-github>`
+for downloading packages. ``pip`` only supports packages hosted on PyPI, making
it the only option for developers who want a simple installation.
Search for "PyPI <package-name>" to find the download page. Note that
some pages are versioned, and the first result may not be the newest
@@ -217,6 +220,7 @@ try to extract the wheel:
version('1.11.0', sha256='d8c9d24ea90457214d798b0d922489863dad518adde3638e08ef62de28fb183a', expand=False)
+.. _pypi-vs-github:
"""""""""""""""
PyPI vs. GitHub
@@ -263,6 +267,9 @@ location, but PyPI is preferred for the following reasons:
PyPI is nice because it makes it physically impossible to
re-release the same version of a package with a different checksum.
+Use the :ref:`pypi attribute <pypi>` to facilitate construction of PyPI package
+references.
+
^^^^^^^^^^^^^^^^^^^^^^^^^
Build system dependencies
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -709,7 +716,7 @@ The package may have its own unit or regression tests. Spack can
run these tests during the installation by adding phase-appropriate
test methods.
-For example, ``py-numpy`` adds the following as a check to run
+For example, ``py-numpy`` adds the following as a check to run
after the ``install`` phase:
.. code-block:: python
diff --git a/lib/spack/spack/cmd/create.py b/lib/spack/spack/cmd/create.py
index bccf3bf66d..baeccc513e 100644
--- a/lib/spack/spack/cmd/create.py
+++ b/lib/spack/spack/cmd/create.py
@@ -316,6 +316,12 @@ class PythonPackageTemplate(PackageTemplate):
url = '/'.join([project, match.group(4)])
self.url_line = ' pypi = "{url}"'
+ else:
+ # Add a reminder about spack preferring PyPI URLs
+ self.url_line = '''
+ # FIXME: ensure the package is not available through PyPI. If it is,
+ # re-run `spack create --force` with the PyPI URL.
+''' + self.url_line
super(PythonPackageTemplate, self).__init__(name, url, *args, **kwargs)