Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Explain how to add an extension module#1350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
willingc merged 46 commits intopython:mainfrompicnixz:add-extensions-tutorial
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
46 commits
Select commitHold shift + click to select a range
086ded3
explain how to add modules
picnixzJul 13, 2024
96fb998
Update extension-modules.rst
picnixzJul 13, 2024
5f8797c
Update extension-modules.rst
picnixzJul 13, 2024
e5d41f8
Update extension-modules.rst
picnixzJul 13, 2024
b740114
Update extension-modules.rst
picnixzJul 13, 2024
c74df67
Update extension-modules.rst
picnixzJul 13, 2024
e645869
Update extension-modules.rst
picnixzJul 14, 2024
5a9a57c
Update extension-modules.rst
picnixzJul 14, 2024
26a18eb
Update extension-modules.rst
picnixzJul 14, 2024
1b4d73f
Update extension-modules.rst
picnixzJul 14, 2024
94086dd
Address Hugo's feedback
picnixzJul 14, 2024
9a78a3b
Update extension-modules.rst
picnixzJul 14, 2024
e22c278
Update extension-modules.rst
picnixzJul 14, 2024
1f51497
improvements
picnixzJul 15, 2024
bdf09e5
fixup! sphinx
picnixzJul 15, 2024
ef7cf3e
fixup! indents
picnixzJul 15, 2024
1a405ba
fixup! warnings
picnixzJul 15, 2024
e39cbc2
improve sections
picnixzJul 15, 2024
35f207f
fix markup
picnixzJul 15, 2024
316b00d
improve titles
picnixzJul 15, 2024
523dece
improve presentation
picnixzJul 15, 2024
d1cdd1d
fixup! markup
picnixzJul 15, 2024
defb31e
simplify snippets
picnixzJul 15, 2024
6213438
improvements
picnixzJul 15, 2024
f6e5d55
improvements
picnixzJul 15, 2024
d1a1ed5
some rewordings and cleanups
picnixzJul 15, 2024
86e3e54
simplify wording
picnixzJul 16, 2024
65f62e7
address Erlend's review
picnixzJul 17, 2024
4b7c7d8
fix indents?
picnixzJul 17, 2024
7abb6f1
add ref to clinic everywhere when needed
picnixzJul 17, 2024
da9b58b
fix typos
picnixzJul 17, 2024
783e6db
address encukou's review
picnixzJul 18, 2024
8906ebd
improve the page flow
picnixzJul 18, 2024
128c81c
use sentence case
picnixzJul 18, 2024
7d6c8d6
add podman tip
picnixzJul 18, 2024
01c25bc
address rest of the review
picnixzJul 18, 2024
56910fb
address Alyssa's review
picnixzJul 18, 2024
3ee1cea
add details
picnixzJul 18, 2024
3d235f4
address review
picnixzAug 4, 2024
7b0b234
Make it easier to update the required ubuntu version
picnixzAug 4, 2024
7fa94bf
Merge remote-tracking branch 'upstream/main' into add-extensions-tuto…
picnixzAug 4, 2024
ec48fdb
fixup!
picnixzAug 4, 2024
1843e3d
fixup!
picnixzAug 4, 2024
18c4d91
improve comment
picnixzAug 14, 2024
8224bbd
use double quotes instead of single quotes
picnixzAug 14, 2024
2f63053
Address Carol's review.
picnixzSep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions_extensions/ubuntu_version.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
"""Sphinx extension to update the required Ubuntu version.

The required Ubuntu version should be specified in conf.py by::

configure_ubuntu_version = "MAJOR.MINOR" # e.g., "22.04"

The version must match the one used to regenerate the configure script in
https://github.com/python/cpython/blob/main/Tools/build/regen-configure.sh.
"""

from sphinx.errors import ExtensionError


def replace_ubuntu_version(app, docname, source):
"""Replace all occurrences of $CONFIGURE_UBUNTU_VERSION$.

This is needed since RST replacement via ``|...|`` is not supported
in code-blocks directives.
"""
if (ubuntu_version := app.config.configure_ubuntu_version) is None:
raise ExtensionError("configure_ubuntu_version is not set in conf.py")
source[0] = source[0].replace("$CONFIGURE_UBUNTU_VERSION$", ubuntu_version)


def setup(app):
app.add_config_value("configure_ubuntu_version", None, "env", types=(str,))
app.connect("source-read", replace_ubuntu_version)
return {"parallel_read_safe": True, "parallel_write_safe": True}
8 changes: 8 additions & 0 deletionsconf.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
import sys
import time

sys.path.insert(0, '_extensions')

extensions = [
'ubuntu_version',
'notfound.extension',
'sphinx.ext.extlinks',
'sphinx.ext.intersphinx',
Expand DownExpand Up@@ -194,3 +198,7 @@
copybutton_prompt_text = "$ "
# https://sphinx-copybutton.readthedocs.io/en/latest/use.html#honor-line-continuation-characters-when-copying-multline-snippets
copybutton_line_continuation_character = "\\"

# Must be synchronized with the Ubuntu image version in
# https://github.com/python/cpython/blob/main/Tools/build/regen-configure.sh
configure_ubuntu_version = "22.04"
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp