Skip to content

Commit 8940361

Browse files
docs: Use 'req@url' syntax to install from remote VCS (#2115)
* Use 'req@url' syntax when using pip to install from a remote git repository over 'url#egg=req' to avoid the use of #egg= fragments with a non-PEP 508 name. This will be required in pip v25.0+. - c.f. pypa/pip#11617 for more details. * For best practice, quote the use of extras for compatibility across all shells.
1 parent e80359f commit 8940361

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

docs/installation.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,36 @@ Install latest stable release from `PyPI <https://pypi.org/project/pyhf/>`__...
3232

3333
.. code-block:: console
3434
35-
python -m pip install pyhf[tensorflow]
35+
python -m pip install 'pyhf[tensorflow]'
3636
3737
... with PyTorch backend
3838
++++++++++++++++++++++++
3939

4040
.. code-block:: console
4141
42-
python -m pip install pyhf[torch]
42+
python -m pip install 'pyhf[torch]'
4343
4444
... with JAX backend
4545
++++++++++++++++++++
4646

4747
.. code-block:: console
4848
49-
python -m pip install pyhf[jax]
49+
python -m pip install 'pyhf[jax]'
5050
5151
... with all backends
5252
+++++++++++++++++++++
5353

5454
.. code-block:: console
5555
56-
python -m pip install pyhf[backends]
56+
python -m pip install 'pyhf[backends]'
5757
5858
5959
... with xml import/export functionality
6060
++++++++++++++++++++++++++++++++++++++++
6161

6262
.. code-block:: console
6363
64-
python -m pip install pyhf[xmlio]
64+
python -m pip install 'pyhf[xmlio]'
6565
6666
6767
Install latest development version from `GitHub <https://github.com/scikit-hep/pyhf>`__...
@@ -72,43 +72,43 @@ Install latest development version from `GitHub <https://github.com/scikit-hep/p
7272

7373
.. code-block:: console
7474
75-
python -m pip install --upgrade "git+https://github.com/scikit-hep/pyhf.git#egg=pyhf"
75+
python -m pip install --upgrade 'pyhf@git+https://github.com/scikit-hep/pyhf.git'
7676
7777
... with TensorFlow backend
7878
+++++++++++++++++++++++++++
7979

8080
.. code-block:: console
8181
82-
python -m pip install --upgrade "git+https://github.com/scikit-hep/pyhf.git#egg=pyhf[tensorflow]"
82+
python -m pip install --upgrade 'pyhf[tensorflow]@git+https://github.com/scikit-hep/pyhf.git'
8383
8484
... with PyTorch backend
8585
++++++++++++++++++++++++
8686

8787
.. code-block:: console
8888
89-
python -m pip install --upgrade "git+https://github.com/scikit-hep/pyhf.git#egg=pyhf[torch]"
89+
python -m pip install --upgrade 'pyhf[torch]@git+https://github.com/scikit-hep/pyhf.git'
9090
9191
... with JAX backend
9292
++++++++++++++++++++++
9393

9494
.. code-block:: console
9595
96-
python -m pip install --upgrade "git+https://github.com/scikit-hep/pyhf.git#egg=pyhf[jax]"
96+
python -m pip install --upgrade 'pyhf[jax]@git+https://github.com/scikit-hep/pyhf.git'
9797
9898
... with all backends
9999
+++++++++++++++++++++
100100

101101
.. code-block:: console
102102
103-
python -m pip install --upgrade "git+https://github.com/scikit-hep/pyhf.git#egg=pyhf[backends]"
103+
python -m pip install --upgrade 'pyhf[backends]@git+https://github.com/scikit-hep/pyhf.git'
104104
105105
106106
... with xml import/export functionality
107107
++++++++++++++++++++++++++++++++++++++++
108108

109109
.. code-block:: console
110110
111-
python -m pip install --upgrade "git+https://github.com/scikit-hep/pyhf.git#egg=pyhf[xmlio]"
111+
python -m pip install --upgrade 'pyhf[xmlio]@git+https://github.com/scikit-hep/pyhf.git'
112112
113113
114114
Updating :code:`pyhf`

src/pyhf/cli/complete.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def cli(shell):
2121
@click.command(help='Generate shell completion code.', name='completions')
2222
@click.argument('shell', default=None)
2323
def cli(shell):
24-
'''Placeholder for shell completion code generatioon function if necessary dependency is missing.'''
24+
"""Placeholder for shell completion code generatioon function if necessary dependency is missing."""
2525
click.secho(
26-
'This requires the click_completion module.\n'
27-
'You can install it with the shellcomplete extra:\n'
28-
'python -m pip install pyhf[shellcomplete]'
26+
"This requires the click_completion module.\n"
27+
"You can install it with the shellcomplete extra:\n"
28+
"python -m pip install 'pyhf[shellcomplete]'"
2929
)

src/pyhf/cli/rootio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def xml2json(
5050
except ImportError:
5151
log.error(
5252
"xml2json requires uproot, please install pyhf using the "
53-
"xmlio extra: python -m pip install pyhf[xmlio]",
53+
"xmlio extra: python -m pip install 'pyhf[xmlio]'",
5454
exc_info=True,
5555
)
5656
from pyhf import readxml
@@ -86,7 +86,7 @@ def json2xml(workspace, output_dir, specroot, dataroot, resultprefix, patch):
8686
except ImportError:
8787
log.error(
8888
"json2xml requires uproot, please install pyhf using the "
89-
"xmlio extra: python -m pip install pyhf[xmlio]",
89+
"xmlio extra: python -m pip install 'pyhf[xmlio]'",
9090
exc_info=True,
9191
)
9292
from pyhf import writexml

src/pyhf/contrib/cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def cli():
2424
2525
.. code-block:: shell
2626
27-
$ python -m pip install pyhf[contrib]
27+
$ python -m pip install 'pyhf[contrib]'
2828
"""
2929
from pyhf.contrib import utils # Guard CLI from missing extra # noqa: F401
3030

@@ -72,6 +72,6 @@ def download(archive_url, output_directory, verbose, force, compress):
7272
except AttributeError:
7373
log.error(
7474
"\nInstallation of the contrib extra is required to use the contrib CLI API"
75-
+ "\nPlease install with: python -m pip install pyhf[contrib]\n",
75+
+ "\nPlease install with: python -m pip install 'pyhf[contrib]'\n",
7676
exc_info=True,
7777
)

src/pyhf/contrib/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,6 @@ def download(archive_url, output_directory, force=False, compress=False):
128128
except ModuleNotFoundError:
129129
log.error(
130130
"\nInstallation of the contrib extra is required to use pyhf.contrib.utils.download"
131-
+ "\nPlease install with: python -m pip install pyhf[contrib]\n",
131+
+ "\nPlease install with: python -m pip install 'pyhf[contrib]'\n",
132132
exc_info=True,
133133
)

tests/test_scripts.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ def test_missing_contrib_extra(caplog):
632632
for line in [
633633
"import of requests halted; None in sys.modules",
634634
"Installation of the contrib extra is required to use pyhf.contrib.utils.download",
635-
"Please install with: python -m pip install pyhf[contrib]",
635+
"Please install with: python -m pip install 'pyhf[contrib]'",
636636
]:
637637
assert line in caplog.text
638638
caplog.clear()
@@ -672,7 +672,7 @@ def test_missing_contrib_download(caplog):
672672
for line in [
673673
"module 'pyhf.contrib.utils' has no attribute 'download'",
674674
"Installation of the contrib extra is required to use the contrib CLI API",
675-
"Please install with: python -m pip install pyhf[contrib]",
675+
"Please install with: python -m pip install 'pyhf[contrib]'",
676676
]:
677677
assert line in caplog.text
678678
caplog.clear()

0 commit comments

Comments
 (0)