Skip to content

Commit b78ce03

Browse files
authored
docs: phase 6 — mkdocstrings API reference (#10)
docs/reference/api.md, with mkdocstrings directives covering every public name re-exported from yarlpattern/__init__.py — tiered by audience: * Primary API — URLPattern, URLPatternResult, COMPONENTS * Escape helpers — escape_pattern_string, escape_regexp_string * Low-level building blocks (tokenizer / parts / regex generation) — for tools that compose URLPatterns programmatically Auto-extracted from the existing Google-style docstrings. Future API changes to docstrings ship to the site on the next push to main with zero hand-maintained reference content to drift. properdocs nav gains a Reference > API entry between WPT Conformance and Comparisons. Phase 6 task #48 closed. With Phase 6 merged the documentation arc is complete: Overview (URLPattern-101 + ecosystem) Examples (11 verified worked examples) Reference (auto-extracted API) Comparisons (vs aiohttp UrlDispatcher, vs yarl) Explanation (architecture) WPT Conformance (auto-generated) Co-authored-by: chad-loder <26261238+chad-loder@users.noreply.github.com>
1 parent f59f702 commit b78ce03

2 files changed

Lines changed: 135 additions & 0 deletions

File tree

docs/reference/api.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# API reference
2+
3+
Auto-extracted from yarlpattern's docstrings by
4+
[mkdocstrings](https://mkdocstrings.github.io). Items are grouped by
5+
audience: the primary public API, the escape helpers most callers
6+
eventually need, and the lower-level building blocks reserved for
7+
advanced use.
8+
9+
## Primary API
10+
11+
The 95% surface: one class, one result type, one tuple of component
12+
names.
13+
14+
::: yarlpattern.URLPattern
15+
options:
16+
show_source: false
17+
show_root_heading: true
18+
members_order: source
19+
20+
::: yarlpattern.URLPatternResult
21+
options:
22+
show_source: false
23+
show_root_heading: true
24+
25+
::: yarlpattern.COMPONENTS
26+
options:
27+
show_source: false
28+
show_root_heading: true
29+
30+
## Escape helpers
31+
32+
When you're building a pattern from a string whose contents might
33+
contain pattern metacharacters (`:`, `*`, `(`, `)`, `{`, `}`), escape
34+
it first.
35+
36+
::: yarlpattern.escape_pattern_string
37+
options:
38+
show_source: false
39+
show_root_heading: true
40+
41+
::: yarlpattern.escape_regexp_string
42+
options:
43+
show_source: false
44+
show_root_heading: true
45+
46+
## Low-level building blocks
47+
48+
The spec-aligned tokenizer, parser, and regex generator are public
49+
because they're useful for tools that compose URLPatterns
50+
programmatically — a route-table linter, a static analyzer for
51+
overlapping patterns, a code generator emitting JavaScript URLPattern
52+
strings from a Python source of truth.
53+
54+
Most users never need these.
55+
56+
### Tokenizer
57+
58+
::: yarlpattern.tokenize
59+
options:
60+
show_source: false
61+
show_root_heading: true
62+
63+
::: yarlpattern.Token
64+
options:
65+
show_source: false
66+
show_root_heading: true
67+
68+
::: yarlpattern.TokenType
69+
options:
70+
show_source: false
71+
show_root_heading: true
72+
73+
::: yarlpattern.TokenizePolicy
74+
options:
75+
show_source: false
76+
show_root_heading: true
77+
78+
### Parts
79+
80+
A *part* is one syntactic element of a pattern: a literal text run,
81+
a named segment-wildcard, a regex group, or a full wildcard.
82+
83+
::: yarlpattern.parse_pattern_string
84+
options:
85+
show_source: false
86+
show_root_heading: true
87+
88+
::: yarlpattern.parts_to_pattern_string
89+
options:
90+
show_source: false
91+
show_root_heading: true
92+
93+
::: yarlpattern.Part
94+
options:
95+
show_source: false
96+
show_root_heading: true
97+
98+
::: yarlpattern.PartType
99+
options:
100+
show_source: false
101+
show_root_heading: true
102+
103+
::: yarlpattern.PartModifier
104+
options:
105+
show_source: false
106+
show_root_heading: true
107+
108+
::: yarlpattern.Options
109+
options:
110+
show_source: false
111+
show_root_heading: true
112+
113+
::: yarlpattern.EncodingCallback
114+
options:
115+
show_source: false
116+
show_root_heading: true
117+
118+
### Regex generation
119+
120+
::: yarlpattern.parts_to_regex
121+
options:
122+
show_source: false
123+
show_root_heading: true
124+
125+
::: yarlpattern.generate_segment_wildcard_regexp
126+
options:
127+
show_source: false
128+
show_root_heading: true
129+
130+
::: yarlpattern.FULL_WILDCARD_REGEXP_VALUE
131+
options:
132+
show_source: false
133+
show_root_heading: true

properdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ nav:
8989
- Extract YouTube video IDs from any URL form: examples/extract-youtube-video-ids-from-any-url-form.md
9090
- Match Slack callback IDs with structured data: examples/match-slack-callback-ids-with-structured-data.md
9191
- WPT Conformance: wpt-compliance.md
92+
- Reference:
93+
- API: reference/api.md
9294
- Comparisons:
9395
- vs. aiohttp.web.UrlDispatcher: comparisons/aiohttp.md
9496
- vs. yarl: comparisons/yarl.md

0 commit comments

Comments
 (0)