Skip to content

Commit bd327f9

Browse files
authored
Update docs (#418)
1 parent d1fed3e commit bd327f9

6 files changed

Lines changed: 165 additions & 9 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@
1818
# Downloaded dependency archives
1919
/libs/*
2020
!/libs/README.md
21+
22+
# Docs
23+
doc/build

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
version: 2
22

33
build:
4-
os: ubuntu-20.04
4+
os: ubuntu-24.04
55
tools:
6-
python: '3.9'
6+
python: '3.14'
77

88
sphinx:
99
configuration: doc/source/conf.py

doc/README.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# Documentation and Read the Docs
2+
3+
This project publishes its documentation on Read the Docs (RTD):
4+
5+
- Public site: <https://xmlsec.readthedocs.io/>
6+
- RTD config: [../.readthedocs.yaml](../.readthedocs.yaml)
7+
- Sphinx config: [source/conf.py](source/conf.py)
8+
- Docs source: [source/](source/)
9+
10+
## How Read the Docs works in this repo
11+
12+
Read the Docs does not usually require you to upload files manually.
13+
Instead, it watches the GitHub repository and builds the docs from the latest pushed commit.
14+
15+
For this repository, RTD is configured to:
16+
17+
- use config version `2`
18+
- build on `ubuntu-24.04`
19+
- use Python `3.14`
20+
- build with Sphinx using `doc/source/conf.py`
21+
- install the project itself with `pip install .`
22+
- install extra docs dependencies from `doc/source/requirements.txt`
23+
24+
That means every successful RTD build uses the repository contents plus the settings in `.readthedocs.yaml`.
25+
26+
## Before you publish
27+
28+
If you changed the docs, or changed code that affects autodoc output, validate locally first.
29+
30+
### 1. Create and activate a virtual environment
31+
32+
From the repository root:
33+
34+
```bash
35+
python3 -m venv .venv-docs
36+
source .venv-docs/bin/activate
37+
python -m pip install --upgrade pip
38+
```
39+
40+
Use Python `3.12+` for local docs builds. The docs dependencies are pinned to current releases, including Sphinx `9.1.0`, which no longer supports older Python versions.
41+
42+
### 2. Install the package and doc dependencies
43+
44+
For a minimal local docs build, install the docs dependencies:
45+
46+
```bash
47+
python -m pip install -r doc/source/requirements.txt
48+
```
49+
50+
If you want autodoc to import `xmlsec` and render the API pages without import warnings, also install the package itself:
51+
52+
```bash
53+
python -m pip install .
54+
```
55+
56+
Note: `xmlsec` depends on native libraries. If `pip install .` fails, install the system dependencies first.
57+
58+
Examples:
59+
60+
- Debian/Ubuntu:
61+
62+
```bash
63+
sudo apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
64+
```
65+
66+
- macOS with Homebrew:
67+
68+
```bash
69+
brew install libxml2 libxmlsec1 pkg-config
70+
```
71+
72+
### 3. Build the docs locally
73+
74+
```bash
75+
make -C doc html
76+
```
77+
78+
Built HTML will be placed in:
79+
80+
```text
81+
doc/build/html/
82+
```
83+
84+
Open `doc/build/html/index.html` in a browser and check the pages you changed.
85+
86+
## How to publish the latest docs
87+
88+
### Normal flow
89+
90+
If the RTD project is already connected to GitHub, this is the normal deployment path:
91+
92+
1. Edit the docs or code.
93+
2. Commit the changes.
94+
3. Push the branch to GitHub.
95+
4. RTD receives the webhook event.
96+
5. RTD rebuilds the matching version and publishes it.
97+
98+
For this repository, the current Git branch is `master`, and `latest` on RTD commonly tracks the repository default branch.
99+
100+
Example:
101+
102+
```bash
103+
git add doc/source .readthedocs.yaml README.md
104+
git commit -m "Update documentation"
105+
git push origin master
106+
```
107+
108+
If you changed files outside those paths, add the correct files instead of using the sample `git add` command above.
109+
110+
### Manual rebuild from the RTD dashboard
111+
112+
If you already pushed your changes but the site did not update:
113+
114+
1. Open the Read the Docs project for `xmlsec`.
115+
2. Go to the build/version page.
116+
3. Trigger a build for the version you want, usually `latest`.
117+
4. Wait for the build to finish and review the logs if it fails.
118+
119+
Typical reasons a manual rebuild is needed:
120+
121+
- GitHub integration/webhook is missing or broken
122+
- the target branch/version is inactive on RTD
123+
- a previous build failed and you want to rebuild after fixing the branch
124+
125+
## First-time setup in Read the Docs
126+
127+
If RTD has not been connected yet, an admin needs to set it up once:
128+
129+
1. Sign in to Read the Docs with a GitHub account that has access to `xmlsec/python-xmlsec`.
130+
2. Import the repository.
131+
3. Confirm RTD is using the repository root `.readthedocs.yaml`.
132+
4. Make sure the GitHub integration/webhook is enabled.
133+
5. Make sure the `latest` version is active.
134+
135+
After that, pushes to GitHub should trigger builds automatically.
136+
137+
## Troubleshooting
138+
139+
### Build fails locally on `pip install .`
140+
141+
The Python package requires native `xmlsec` and `libxml2` dependencies. Install the OS packages first, then retry.
142+
143+
### RTD build fails after a push
144+
145+
Check:
146+
147+
- the build logs in RTD
148+
- whether `.readthedocs.yaml` is valid
149+
- whether `doc/source/conf.py` still builds cleanly
150+
- whether the target branch/version is active
151+
152+
### RTD is building the wrong version
153+
154+
Read the Docs manages versions from Git branches and tags. Verify which branch `latest` points to, and whether `stable` is mapped to a branch or tag you expect.

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
master_doc = 'index'
2121

2222
project = 'python-xmlsec'
23-
copyright = '2020, Oleg Hoefling <oleg.hoefling@gmail.com>'
23+
copyright = '2026, Amin Solhizadeh <amin.solhizadeh@gmail.com>'
2424
author = 'Bulat Gaifullin <gaifullinbf@gmail.com>'
2525
release = importlib.metadata.version('xmlsec')
2626
parsed: Version = parse(release)

doc/source/requirements.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
lxml==6.1.0
2-
importlib_metadata;python_version < '3.8'
3-
packaging
4-
Sphinx>=3
5-
furo>=2021.4.11b34
2+
packaging==26.1
3+
Sphinx==9.1.0
4+
furo==2025.12.19

src/template.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ static PyObject* PyXmlSec_TemplateAddEncryptedKey(PyObject* self, PyObject *args
605605

606606
static char PyXmlSec_TemplateCreateEncryptedData__doc__[] = \
607607
"encrypted_data_create(node, method, id = None, type = None, mime_type = None, encoding = None, ns = None) -> lxml.etree._Element\n"
608-
"Creates new :xml:`<{ns}:EncryptedData />` node for encryption template.\n\n"
608+
"Creates new ``<{ns}:EncryptedData />`` node for encryption template.\n\n"
609609
":param node: the pointer to signature node\n"
610610
":type node: :class:`lxml.etree._Element`\n"
611611
":param method: the encryption method\n"
@@ -662,7 +662,7 @@ static PyObject* PyXmlSec_TemplateCreateEncryptedData(PyObject* self, PyObject *
662662

663663
static char PyXmlSec_TemplateEncryptedDataEnsureKeyInfo__doc__[] = \
664664
"encrypted_data_ensure_key_info(node, id = None, ns = None) -> lxml.etree._Element\n"
665-
"Adds :xml:`<{ns}:KeyInfo/>` to the :xml:`<enc:EncryptedData/>` node of ``node``.\n\n"
665+
"Adds ``<{ns}:KeyInfo/>`` to the :xml:`<enc:EncryptedData/>` node of ``node``.\n\n"
666666
":param node: the pointer to :xml:`<enc:EncryptedData/>` node\n"
667667
":type node: :class:`lxml.etree._Element`\n"
668668
":param id: the ``\"Id\"`` attribute (optional)\n"

0 commit comments

Comments
 (0)