forked from pex-tool/pex
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-work Pex documentation. (pex-tool#2362)
This change moves Pex off RTD and on to GitHub Pages. Instead of versioned docs out on RTD, only the latest docs will be available via https://docs.pex-tool.org and versioned docs will be available via GitHub Releases (for the PDF) and inside the Pex wheel and Pex PEX themselves via the new `pex3 docs` command that serves the appropriate docs locally, offline, with full functionality. With this switch, docs are also now built and link-checked in CI. There should be no more RTD style misconfiguration production outages.
- Loading branch information
Showing
49 changed files
with
1,081 additions
and
357 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Deploy Doc Site | ||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.[0-9]+.[0-9]+ | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout Pex | ||
uses: actions/checkout@v3 | ||
- name: Setup Python 3.11 | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.11" | ||
- name: Build Doc Site | ||
uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 | ||
with: | ||
tox-env: docs -- --linkcheck --pdf --clean-html | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: "dist/docs/html/" | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ jobs: | |
- name: Build sdist and wheel | ||
uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 | ||
with: | ||
tox-env: package -- --no-pex --additional-format sdist --additional-format wheel | ||
tox-env: package -- --no-pex --additional-format sdist --additional-format wheel --embed-docs | ||
- name: Publish Pex ${{ needs.determine-tag.outputs.release-tag }} | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
|
@@ -83,7 +83,11 @@ jobs: | |
- name: Package Pex ${{ needs.determine-tag.outputs.release-tag }} PEX | ||
uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 | ||
with: | ||
tox-env: package | ||
tox-env: package -- --embed-docs | ||
- name: Generate Pex ${{ needs.determine-tag.outputs.release-tag }} PDF | ||
uses: pantsbuild/actions/run-tox@b16b9cf47cd566acfe217b1dafc5b452e27e6fd7 | ||
with: | ||
tox-env: docs -- --no-html --pdf | ||
- name: Prepare Changelog | ||
id: prepare-changelog | ||
uses: a-scie/actions/[email protected] | ||
|
@@ -100,6 +104,8 @@ jobs: | |
body_path: ${{ steps.prepare-changelog.outputs.changelog-file }} | ||
draft: false | ||
prerelease: false | ||
files: dist/pex | ||
files: | | ||
dist/pex | ||
dist/docs/pdf/pex.pdf | ||
fail_on_unmatched_files: true | ||
discussion_category_name: Announcements |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
/.mypy_cache/ | ||
/.tox/ | ||
/dist/ | ||
/docs/_build | ||
/docs/_static_dynamic/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,11 @@ | ||
# Copyright 2024 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
import os | ||
|
||
# When running under MyPy, this will be set to True for us automatically; so we can use it as a typing module import | ||
# guard to protect Python 2 imports of typing - which is not normally available in Python 2. | ||
TYPE_CHECKING = False | ||
|
||
|
||
INCLUDE_DOCS = os.environ.get("__PEX_BUILD_INCLUDE_DOCS__", "False").lower() in ("1", "true") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,29 @@ | ||
# Copyright 2024 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import | ||
from __future__ import absolute_import, print_function | ||
|
||
import hatchling.build | ||
import pex_build | ||
|
||
# We re-export all hatchling's PEP-517 build backend hooks here for the build frontend to call. | ||
from hatchling.build import * # NOQA | ||
|
||
if pex_build.TYPE_CHECKING: | ||
from typing import Any, Dict, List, Optional | ||
|
||
|
||
def get_requires_for_build_wheel(config_settings=None): | ||
# type: (Optional[Dict[str, Any]]) -> List[str] | ||
|
||
reqs = hatchling.build.get_requires_for_build_wheel( | ||
config_settings=config_settings | ||
) # type: List[str] | ||
if pex_build.INCLUDE_DOCS: | ||
with open("docs-requirements.txt") as fp: | ||
for raw_req in fp.readlines(): | ||
req = raw_req.strip() | ||
if not req or req.startswith("#"): | ||
continue | ||
reqs.append(req) | ||
return reqs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2024 Pex project contributors. | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import absolute_import, print_function | ||
|
||
import os.path | ||
import subprocess | ||
import sys | ||
|
||
import pex_build | ||
from hatchling.builders.hooks.plugin.interface import BuildHookInterface | ||
|
||
if pex_build.TYPE_CHECKING: | ||
from typing import Any, Dict | ||
|
||
|
||
class AdjustBuild(BuildHookInterface): | ||
"""Allows alteration of the build process.""" | ||
|
||
PLUGIN_NAME = "pex-adjust-build" | ||
|
||
def initialize( | ||
self, | ||
version, # type: str | ||
build_data, # type: Dict[str, Any] | ||
): | ||
# type: (...) -> None | ||
if pex_build.INCLUDE_DOCS: | ||
out_dir = os.path.join(self.root, "dist", "docs") | ||
subprocess.check_call( | ||
args=[ | ||
sys.executable, | ||
os.path.join(self.root, "scripts", "build_docs.py"), | ||
"--clean-html", | ||
out_dir, | ||
] | ||
) | ||
build_data["force_include"][out_dir] = os.path.join("pex", "docs") |
Oops, something went wrong.