Skip to content

Commit 2c66932

Browse files
authored
Various doc fixes. (#2686)
+ Upgrade pagefind to 1.3.0 and enable search result highlighting. + Fix Deploy Doc Site workflow to work for search in forks. + Fix various re-directs pointed out via `--linkcheck` to point to the new homes.
1 parent 6ab5393 commit 2c66932

31 files changed

+112
-75
lines changed

.github/workflows/doc-site.yml

+6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,14 @@ jobs:
3434
python-version: "3.11"
3535
- name: Build Doc Site
3636
uses: pex-tool/actions/run-tox@c53dadd8b410bbd66480de91067e9e45d2b3af38
37+
if: github.repository_owner == 'pex-tool'
3738
with:
3839
tox-env: docs -- --linkcheck --pdf --clean-html
40+
- name: Build Fork Doc Site
41+
uses: pex-tool/actions/run-tox@c53dadd8b410bbd66480de91067e9e45d2b3af38
42+
if: github.repository_owner != 'pex-tool'
43+
with:
44+
tox-env: docs -- --linkcheck --pdf --clean-html --subdir ${{ github.event.repository.name }}
3945
- name: Setup Pages
4046
uses: actions/configure-pages@v4
4147
- name: Upload artifact

CHANGES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ Pex version range.
18551855

18561856
This is another hotfix release for 2.1.68 that fixes a bug in `*.data/*`
18571857
file handling for installed wheels which is outlined in [PEP
1858-
427](https://www.python.org/dev/peps/pep-0427/#installing-a-wheel-distribution-1-0-py32-none-any-whl)
1858+
427](https://peps.python.org/pep-0427/#installing-a-wheel-distribution-1-0-py32-none-any-whl)
18591859

18601860
* Handle `*.data/*` RECORD entries not existing. (#1644)
18611861

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ PEX
2424
Overview
2525
========
2626
pex is a library for generating .pex (Python EXecutable) files which are
27-
executable Python environments in the spirit of `virtualenvs <http://virtualenv.org>`_.
27+
executable Python environments in the spirit of `virtualenvs <https://virtualenv.pypa.io>`_.
2828
pex is an expansion upon the ideas outlined in
2929
`PEP 441 <https://peps.python.org/pep-0441/>`_
3030
and makes the deployment of Python applications as simple as ``cp``. pex files may even
@@ -36,7 +36,7 @@ pex files can be built using the ``pex`` tool. Build systems such as `Pants
3636
support building .pex files directly.
3737

3838
Still unsure about what pex does or how it works? Watch this quick lightning
39-
talk: `WTF is PEX? <http://www.youtube.com/watch?v=NmpnGhRwsu0>`_.
39+
talk: `WTF is PEX? <https://www.youtube.com/watch?v=NmpnGhRwsu0>`_.
4040

4141
pex is licensed under the Apache2 license.
4242

docs/_templates/page.html

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% extends "!page.html" %}
2+
3+
{% block scripts -%}
4+
{{ super() }}
5+
<script type="module">
6+
await import('{{ pex_site_subdir | default() }}/_pagefind/pagefind-highlight.js');
7+
new PagefindHighlight({ highlightParam: "highlight" });
8+
</script>
9+
{%- endblock scripts %}

docs/_templates/search.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "page.html" %}
1+
{% extends "!page.html" %}
22

33
{%- block htmltitle -%}
44
<title>{{ _("Search") }} - {{ docstitle }}</title>
@@ -11,11 +11,12 @@ <h1>{{ _("Search") }}</h1>
1111

1212
{% block scripts -%}
1313
{{ super() }}
14-
<script src="/_pagefind/pagefind-ui.js" type="text/javascript"></script>
14+
<script src="{{ pex_site_subdir | default() }}/_pagefind/pagefind-ui.js" type="text/javascript"></script>
1515
<script>
1616
window.addEventListener("DOMContentLoaded", () => {
1717
new PagefindUI({
1818
element: "#search",
19+
highlightParam: "highlight",
1920
showSubResults: true,
2021
});
2122

docs/buildingpex.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ string (e.g., ``3.6`` or ``3.10.1``) and ``ABI`` is the ABI tag (e.g., ``cp36m``
396396
``abi3``, ``none``). A complete example: ``linux_x86_64-cp-36-cp36m``.
397397

398398
**Constraints**: when ``--platform`` is used the
399-
`environment marker <https://www.python.org/dev/peps/pep-0508/#environment-markers>`_
399+
`environment marker <https://peps.python.org/pep-0508/#environment-markers>`_
400400
``python_full_version`` will not be available if ``PYVER`` is not given as a three component dotted
401401
version since ``python_full_version`` is meant to have 3 digits (e.g., ``3.8.10``). If a
402402
``python_full_version`` environment marker is encountered during a resolve, an
@@ -414,11 +414,11 @@ The complete platform can be either a path to a file containing JSON data or els
414414
literal. In either case, the JSON object is expected to have two fields with any other fields
415415
ignored. The ``marker_environment`` field should have an object value with string field values
416416
corresponding to
417-
`PEP-508 marker environment <https://www.python.org/dev/peps/pep-0508/#environment-markers>`_
417+
`PEP-508 marker environment <https://peps.python.org/pep-0508/#environment-markers>`_
418418
entries. It is OK to only have a subset of valid marker environment fields but it is not valid to
419419
present entries not defined in PEP-508. The ``compatible_tags`` field should have an array of
420420
strings value containing the compatible tags in order from most specific first to least
421-
specific last as defined in `PEP-425 <https://www.python.org/dev/peps/pep-0425>`_. Pex can create
421+
specific last as defined in `PEP-425 <https://peps.python.org/pep-0425>`_. Pex can create
422422
complete platform JSON for you by running it on the target platform like so:
423423
``pex3 interpreter inspect --markers --tags``. For more options, particularly to select the desired
424424
target interpreter see: ``pex3 interpreter inspect --help``.

docs/index.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pex
33
***
44
This project is the home of the .pex file, and the ``pex`` tool which can create them.
5-
``pex`` also provides a general purpose Python environment-virtualization solution similar to `virtualenv <http://virtualenv.org>`_.
5+
``pex`` also provides a general purpose Python environment-virtualization solution similar to `virtualenv <https://virtualenv.pypa.io>`_.
66
pex is short for "Python Executable"
77

88
in brief
@@ -13,15 +13,15 @@ New to python packaging? Check out `packaging.python.org <https://packaging.pyt
1313
intro & history
1414
===============
1515
pex contains the Python packaging and distribution libraries originally available through the
16-
`twitter commons <https://github.com/twitter/commons>`_ but since split out into a separate project.
16+
`twitter commons <https://github.com/twitter-archive/commons>`_ but since split out into a separate project.
1717
The most notable components of pex are the .pex (Python EXecutable) format and the
1818
associated ``pex`` tool which provide a general purpose Python environment virtualization
19-
solution similar in spirit to `virtualenv <http://virtualenv.org>`_. PEX files have been used by Twitter to deploy Python applications to production since 2011.
19+
solution similar in spirit to `virtualenv <https://virtualenv.pypa.io>`_. PEX files have been used by Twitter to deploy Python applications to production since 2011.
2020

2121
To learn more about what the .pex format is and why it could be useful for
2222
you, see :ref:`whatispex` For the impatient, there is also a (slightly outdated) lightning
2323
talk published by Twitter University: `WTF is PEX?
24-
<http://www.youtube.com/watch?v=NmpnGhRwsu0>`_.
24+
<https://www.youtube.com/watch?v=NmpnGhRwsu0>`_.
2525
To go straight to building pex files, see :ref:`buildingpex`.
2626

2727
Guide:

docs/recipes.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ The Pex ``venv`` tool will:
100100
2) Pre-compile all PEX Python code installed in the venv.
101101

102102
Notably, the PEX venv install is done using a
103-
`multi-stage build <https://docs.docker.com/develop/develop-images/multistage-build/>`_ to ensure
103+
`multi-stage build <https://docs.docker.com/build/building/multi-stage/>`_ to ensure
104104
only the final venv remains on disk and it uses two layers to ensure changes to application code
105105
do not lead to re-builds of lower layers. This accommodates the common case of modifying and
106106
re-deploying first party code more often than third party dependencies.
@@ -167,4 +167,4 @@ While building pex files, you may need to fetch dependencies through a proxy. Th
167167
168168
$ pex -v pex
169169
170-
For more information on the requests module support for proxies via environment variables, see the official documentation here: http://docs.python-requests.org/en/master/user/advanced/#proxies.
170+
For more information on the requests module support for proxies via environment variables, see the official documentation here: https://docs.python-requests.org/en/latest/user/advanced/#proxies.

pex/dist_metadata.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -469,19 +469,19 @@ def from_filename(cls, path):
469469
# Handle wheels:
470470
#
471471
# The wheel filename convention is specified here:
472-
# https://www.python.org/dev/peps/pep-0427/#file-name-convention.
472+
# https://peps.python.org/pep-0427/#file-name-convention.
473473
if is_wheel(path):
474474
project_name, version, _ = os.path.basename(path).split("-", 2)
475475
return cls(project_name=project_name, version=version)
476476

477477
# Handle sdists:
478478
#
479479
# The sdist name format has no accepted specification yet, but there is a proposal here:
480-
# https://www.python.org/dev/peps/pep-0625/#specification.
480+
# https://peps.python.org/pep-0625/#specification.
481481
#
482482
# We do the best we can to support the current landscape. A version number can technically
483483
# contain a dash though, even under the standards, in un-normalized form:
484-
# https://www.python.org/dev/peps/pep-0440/#pre-release-separators.
484+
# https://peps.python.org/pep-0440/#pre-release-separators.
485485
# For those cases this logic will produce incorrect results and it does not seem there is
486486
# much we can do since both project names and versions can contain both alphanumeric
487487
# characters and dashes.
@@ -551,7 +551,7 @@ def requires_python(location):
551551
# type: (Union[Distribution, MetadataFiles, Text]) -> Optional[SpecifierSet]
552552
"""Examines dist for `Python-Requires` metadata and returns version constraints if any.
553553
554-
See: https://www.python.org/dev/peps/pep-0345/#requires-python
554+
See: https://peps.python.org/pep-0345/#requires-python
555555
556556
:param location: A distribution to check for `Python-Requires` metadata.
557557
:return: The required python version specifiers.
@@ -624,8 +624,8 @@ def requires_dists(location):
624624
comes in.
625625
626626
See:
627-
+ https://www.python.org/dev/peps/pep-0345/#requires-dist-multiple-use
628-
+ https://www.python.org/dev/peps/pep-0314/#requires-multiple-use
627+
+ https://peps.python.org/pep-0345/#requires-dist-multiple-use
628+
+ https://peps.python.org/pep-0314/#requires-multiple-use
629629
630630
:param location: A distribution to check for requirement metadata.
631631
:return: All requirements found.
@@ -719,7 +719,7 @@ def requires_dists(location):
719719
class RequirementParseError(Exception):
720720
"""Indicates and invalid requirement string.
721721
722-
See PEP-508: https://www.python.org/dev/peps/pep-0508
722+
See PEP-508: https://peps.python.org/pep-0508
723723
"""
724724

725725
error = attr.ib() # type: Any

pex/interpreter.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def get(cls, binary=None):
304304
# Old virtualenv (16 series and lower) sets `sys.real_prefix` in all cases.
305305
cast("Optional[str]", getattr(sys, "real_prefix", None))
306306
# Both pyvenv and virtualenv 20+ set `sys.base_prefix` as per
307-
# https://www.python.org/dev/peps/pep-0405/.
307+
# https://peps.python.org/pep-0405/.
308308
or cast(str, getattr(sys, "base_prefix", sys.prefix))
309309
),
310310
sys_path=sys_path,
@@ -674,7 +674,7 @@ def __hash__(self):
674674
class PyVenvCfg(object):
675675
"""Represents a pyvenv.cfg file.
676676
677-
See: https://www.python.org/dev/peps/pep-0405/#specification
677+
See: https://peps.python.org/pep-0405/#specification
678678
"""
679679

680680
class Error(ValueError):
@@ -688,7 +688,7 @@ def parse(cls, path):
688688
:param path: The path of putative pyvenv.cfg file.
689689
:raises: :class:`PyVenvCfg.Error` if the given `path` doesn't contain a pyvenv.cfg home key.
690690
"""
691-
# See: https://www.python.org/dev/peps/pep-0405/#specification
691+
# See: https://peps.python.org/pep-0405/#specification
692692
config = {}
693693
with open(path) as fp:
694694
for line in fp:
@@ -703,7 +703,7 @@ def parse(cls, path):
703703
@classmethod
704704
def _get_pyvenv_cfg(cls, path):
705705
# type: (str) -> Optional[PyVenvCfg]
706-
# See: https://www.python.org/dev/peps/pep-0405/#specification
706+
# See: https://peps.python.org/pep-0405/#specification
707707
pyvenv_cfg_path = os.path.join(path, "pyvenv.cfg")
708708
if os.path.isfile(pyvenv_cfg_path):
709709
try:
@@ -734,7 +734,7 @@ def find(cls, python_binary):
734734
#
735735
# In practice, we see layout 2 in the wild, but layout 1 is also allowed by the spec.
736736
#
737-
# See: # See: https://www.python.org/dev/peps/pep-0405/#specification
737+
# See: # See: https://peps.python.org/pep-0405/#specification
738738
maybe_venv_bin_dir = os.path.dirname(python_binary)
739739
pyvenv_cfg = cls._get_pyvenv_cfg(maybe_venv_bin_dir)
740740
if not pyvenv_cfg:
@@ -1032,7 +1032,7 @@ def _create_isolated_cmd(
10321032
#
10331033
# See:
10341034
# + https://github.com/python/mypy/issues/4211
1035-
# + https://www.python.org/dev/peps/pep-0484/#the-typing-module
1035+
# + https://peps.python.org/pep-0484/#the-typing-module
10361036
_PYENV = () # type: Union[Tuple[()],Optional[Pyenv]]
10371037

10381038
@classmethod

pex/interpreter_constraints.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ class Value(Enum.Value):
333333
# This value is based off of:
334334
# 1. Past releases: https://www.python.org/downloads/ where the max patch level was achieved by
335335
# 2.7.18.
336-
# 2. The 3.9+ annual release cycle formalization: https://www.python.org/dev/peps/pep-0602/ where
336+
# 2. The 3.9+ annual release cycle formalization: https://peps.python.org/pep-0602/ where
337337
# the last bugfix release will be at a patch level of ~10 and then 3.5 years of security fixes
338338
# as needed before going to EOL at the 5-year mark.
339339
DEFAULT_MAX_PATCH = 30

pex/pep_376.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def find_and_replace_path_components(
112112
class InstalledFile(object):
113113
"""The record of a single installed file from a PEP 376 RECORD file.
114114
115-
See: https://www.python.org/dev/peps/pep-0376/#record
115+
See: https://peps.python.org/pep-0376/#record
116116
"""
117117

118118
_PYTHON_VER_PLACEHOLDER = "pythonX.Y"
@@ -469,7 +469,7 @@ class DistInfoFile(object):
469469
class Record(object):
470470
"""Represents the PEP-376 RECORD of an installed wheel.
471471
472-
See: https://www.python.org/dev/peps/pep-0376/#record
472+
See: https://peps.python.org/pep-0376/#record
473473
"""
474474

475475
@classmethod
@@ -481,7 +481,7 @@ def write(
481481
# type: (...) -> None
482482

483483
# The RECORD is a csv file with the path to each installed file in the 1st column.
484-
# See: https://www.python.org/dev/peps/pep-0376/#record
484+
# See: https://peps.python.org/pep-0376/#record
485485
with safe_open(dst, "w") as fp:
486486
csv_writer = cast(
487487
"CSVWriter",
@@ -499,7 +499,7 @@ def read(
499499
# type: (...) -> Iterator[InstalledFile]
500500

501501
# The RECORD is a csv file with the path to each installed file in the 1st column.
502-
# See: https://www.python.org/dev/peps/pep-0376/#record
502+
# See: https://peps.python.org/pep-0376/#record
503503
for line, (path, fingerprint, file_size) in enumerate(
504504
csv.reader(lines, delimiter=",", quotechar='"'), start=1
505505
):

pex/pep_425.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class CompatibilityTags(object):
5151
Tags are ordered most specific 1st to most generic last. The more specific a tag, the lower its
5252
rank value, with the most specific tag (best match) being ranked 0.
5353
54-
See: https://www.python.org/dev/peps/pep-0425/#use
54+
See: https://peps.python.org/pep-0425/#use
5555
"""
5656

5757
@classmethod
@@ -65,7 +65,7 @@ def from_wheel(cls, wheel):
6565
)
6666
)
6767
wheel_stem, _ = os.path.splitext(os.path.basename(wheel))
68-
# Wheel filename format: https://www.python.org/dev/peps/pep-0427/#file-name-convention
68+
# Wheel filename format: https://peps.python.org/pep-0427/#file-name-convention
6969
# `{distribution}-{version}(-{build tag})?-{python tag}-{abi tag}-{platform tag}.whl`
7070
wheel_components = wheel_stem.rsplit("-", 3)
7171
if len(wheel_components) != 4:

pex/pep_440.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _ensure_ascii_str(text):
3434
@functools.total_ordering
3535
@attr.s(frozen=True, order=False)
3636
class Version(object):
37-
"""A PEP-440 normalized version: https://www.python.org/dev/peps/pep-0440/#normalization"""
37+
"""A PEP-440 normalized version: https://peps.python.org/pep-0440/#normalization"""
3838

3939
raw = attr.ib(eq=False, converter=_ensure_ascii_str) # type: str
4040
normalized = attr.ib(init=False) # type: str
@@ -45,7 +45,7 @@ class Version(object):
4545
def __attrs_post_init__(self):
4646
# type: () -> None
4747

48-
# Although https://www.python.org/dev/peps/pep-0440 which does not allow a `-` in modern
48+
# Although https://peps.python.org/pep-0440 which does not allow a `-` in modern
4949
# versions, it also stipulates that all versions (legacy) must be handled. It turns out
5050
# wheel normalizes `-` to `_` and Pip has had to deal with this:
5151
# https://github.com/pypa/pip/issues/1150

pex/pep_503.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _ensure_ascii_str(text):
2828
class ProjectName(object):
2929
"""Encodes a canonicalized project name as per PEP-503.
3030
31-
See: https://www.python.org/dev/peps/pep-0503/#normalized-names
31+
See: https://peps.python.org/pep-0503/#normalized-names
3232
"""
3333

3434
class InvalidError(ValueError):

pex/pep_508.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def _convert_non_pep_440_dev_versions(python_full_version):
3737
class MarkerEnvironment(object):
3838
"""A PEP-508 marker environment.
3939
40-
See: https://www.python.org/dev/peps/pep-0508/#environment-markers
40+
See: https://peps.python.org/pep-0508/#environment-markers
4141
"""
4242

4343
@classmethod
@@ -89,13 +89,13 @@ def from_platform(cls, platform):
8989
# + linux_x86_64
9090
# + manylinux{1,2010,2014}_x86_64
9191
# For the manylinux* See:
92-
# + manylinux1: https://www.python.org/dev/peps/pep-0513/
93-
# + manylinux2010: https://www.python.org/dev/peps/pep-0571/
94-
# + manylinux2014: https://www.python.org/dev/peps/pep-0599/
92+
# + manylinux1: https://peps.python.org/pep-0513/
93+
# + manylinux2010: https://peps.python.org/pep-0571/
94+
# + manylinux2014: https://peps.python.org/pep-0599/
9595
platform_machine = platform.platform.split("_", 1)[-1]
9696
else:
9797
# E.G.: manylinux_<glibc major>_<glibc_minor>_x86_64
98-
# See: https://www.python.org/dev/peps/pep-0600/
98+
# See: https://peps.python.org/pep-0600/
9999
platform_machine = platform.platform.split("_", 3)[-1]
100100
platform_system = "Linux"
101101
sys_platform = "linux2" if major_version == 2 else "linux"

pex/pip/foreign_platform/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def iter_platform_args(
3737
# the machines it controls. This is in contrast to the public PyPI index which does not
3838
# allow non-manylinux-compliant wheels to be uploaded at all since the wheels it serves can
3939
# be used on unknown target linux machines (for background on this, see:
40-
# https://www.python.org/dev/peps/pep-0513/#rationale). If that organization wishes to
40+
# https://peps.python.org/pep-0513/#rationale). If that organization wishes to
4141
# consume both its own custom-built wheels as well as other manylinux-compliant wheels in
4242
# the same application, it needs to advertise that the target machine supports both
4343
# `linux_x86_64` wheels and `manylinux2014_x86_64` wheels (for example).

0 commit comments

Comments
 (0)