Skip to content

Commit c8ae803

Browse files
committed
Initial commit
0 parents  commit c8ae803

File tree

110 files changed

+13131
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+13131
-0
lines changed

.claude/.gitkeep

Whitespace-only changes.

.editorconfig

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
2+
# EditorConfig Configurtaion file, for more details see:
3+
# https://EditorConfig.org
4+
# EditorConfig is a convention description, that could be interpreted
5+
# by multiple editors to enforce common coding conventions for specific
6+
# file types
7+
8+
# top-most EditorConfig file:
9+
# Will ignore other EditorConfig files in Home directory or upper tree level.
10+
root = true
11+
12+
13+
[*] # For All Files
14+
# Unix-style newlines with a newline ending every file
15+
end_of_line = lf
16+
insert_final_newline = true
17+
trim_trailing_whitespace = true
18+
# Set default charset
19+
charset = utf-8
20+
# Indent style default
21+
indent_style = space
22+
23+
[*.{py,cfg,ini}]
24+
# 4 space indentation
25+
indent_size = 4
26+
27+
[*.{html,dtml,pt,zpt,xml,zcml,js,json,ts,less,scss,css,sass,toml,yml,yaml}]
28+
# 2 space indentation
29+
indent_size = 2
30+
31+
[{Makefile,.gitmodules}]
32+
# Tab indentation (no size specified, but view as 4 spaces)
33+
indent_style = tab
34+
indent_size = unset
35+
tab_width = unset

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @ericof
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
---
2+
applyTo: "docs/src/**/*.md"
3+
---
4+
# Documentation standards
5+
6+
This codebase is a library that helps developers to build schema-driven form wizards for the terminal
7+
8+
ALWAYS use `TUI Forms` as the friendly name of the package and `tui-forms` when refering to the package codebase.
9+
10+
## 1. Audience and scope
11+
12+
- This library is intended for Python developers building terminal applications or command line utilities.
13+
- About the reader:
14+
- Could be categorized as:
15+
- **End User**: Python developer willing to use this library in their own projects.
16+
- **Contributor**: Also a Python developer, probably also an End User, but someone willing to contribute to this library by fixing issues, implementing new features, and writing documentation.
17+
- Assume they know: Python development terms, Python 3.12+
18+
- Do NOT assume they know: internal architecture decisions, the history of the project, or even other libraries providing the same features.
19+
- Full documentation lives at: https://collective.github.io/tui-forms
20+
21+
---
22+
23+
## 2. Documentation structure (Diátaxis)
24+
25+
All documentation must fit one of these four types. Never mix types in the same file.
26+
27+
| Type | Purpose | Answers |
28+
|---|---|---|
29+
| **Tutorial** | Learning-oriented, step-by-step | "How do I get started?" |
30+
| **How-to guide** | Task-oriented, goal-focused | "How do I accomplish X?" |
31+
| **Reference** | Information-oriented, API/config | "What does parameter X do?" |
32+
| **Explanation** | Understanding-oriented, concepts | "Why does it work this way?" |
33+
34+
When drafting a new file, STATE which type it is at the top of your working notes before writing.
35+
36+
---
37+
38+
## 3. File metadata (REQUIRED on every file)
39+
40+
Every `.md` file must begin with a MyST metadata block. Use this template and fill in accurate values — do not copy the placeholder text verbatim into the output:
41+
42+
```markdown
43+
---
44+
myst:
45+
html_meta:
46+
"description": "[PLACEHOLDER: one sentence, plain English, no marketing language]"
47+
"property=og:description": "[PLACEHOLDER: same as description above]"
48+
"property=og:title": "[PLACEHOLDER: page title, matches the H1 heading below]"
49+
"keywords": "[PLACEHOLDER: comma-separated, include library name, relevant concepts]"
50+
---
51+
```
52+
53+
Rules:
54+
- `description` must be a single sentence under 160 characters.
55+
- `keywords` must include `tui-forms` as the first keyword.
56+
- The `og:title` must exactly match the H1 heading of the page.
57+
- NEVER copy example metadata from another page without updating all four fields.
58+
59+
---
60+
61+
## 4. Toolchain
62+
63+
- **Documentation framework**: Sphinx with MyST-Parser (Markdown)
64+
- **Setup environment**: `make install`
65+
- **Build command**: `make docs-html`
66+
- **Live preview**: `make docs-livehtml`
67+
- **Output directory**: `docs/_build/html`
68+
- **Hosting**: `GitHub Pages`
69+
70+
Before suggesting any Sphinx extension or MyST feature, verify it is listed in `docs/src/conf.py`. Do not assume extensions are available.
71+
72+
---
73+
74+
## 5. Writing standards (Vale-enforced)
75+
76+
Vale is configured for **American English** with the following style guides active:
77+
- Microsoft
78+
79+
Vale runs via: `make docs-vale`
80+
81+
Rules that Vale does NOT catch but must still be followed:
82+
83+
- Use second-person voice ("you", not "the user" or "one").
84+
- Use active voice. Passive voice is allowed only when the actor is genuinely unknown.
85+
- Use present tense ("returns a string", not "will return a string").
86+
- Sentence case for all headings ("Getting started", not "Getting Started"). Exception: proper nouns and the library name.
87+
- One sentence per line in the source Markdown (makes diffs readable).
88+
- No filler phrases: "simply", "just", "easily", "obviously", "of course".
89+
- Spell out acronyms on first use per page, even common ones.
90+
91+
---
92+
93+
## 6. Code examples
94+
95+
- ALL code examples must be tested and working against the current version.
96+
- Use `tui_forms` as the import in all examples.
97+
- Show the minimal working example first, then add complexity.
98+
- Every code block must have a language tag:
99+
````markdown
100+
```python
101+
```
102+
````
103+
- If an example requires setup not shown inline, reference the relevant how-to guide explicitly.
104+
- NEVER fabricate API behaviour. If unsure whether a method exists or behaves a certain way, read the source at `src/tui_forms` before writing.
105+
106+
---
107+
108+
## 7. MyST-specific syntax
109+
110+
Use MyST directives correctly. Prefer these patterns:
111+
112+
**Notes and warnings:**
113+
```markdown
114+
:::{note}
115+
Use notes sparingly — only for information the reader would otherwise miss.
116+
:::
117+
118+
:::{warning}
119+
Reserve warnings for actions that could cause data loss or security issues.
120+
:::
121+
```
122+
123+
**Cross-references** (always use labels, never bare URLs for internal links):
124+
```markdown
125+
{doc}`/path/to/page`
126+
{ref}`label-name`
127+
{py:func}`yourlibrary.module.function`
128+
```
129+
130+
**Do not use** raw HTML unless there is no MyST equivalent.
131+
132+
---
133+
134+
## 8. What to verify before writing
135+
136+
Before drafting any documentation:
137+
138+
1. Read the relevant source files in `src/tui_forms`.
139+
2. Check whether existing documentation already covers the topic (`docs/src`).
140+
3. Run the build to confirm there are no pre-existing errors: `make docs-html`.
141+
142+
FORBIDDEN: "I think this method does...", "It should...", "Probably..."
143+
REQUIRED: "According to `[file:line]`...", "The source shows..."
144+
145+
If the behaviour is not clear from the source, STATE: "I cannot confirm this from the source code — please verify."
146+
147+
---
148+
149+
## 9. Definition of done
150+
151+
A documentation task is complete only when:
152+
153+
- [ ] Vale passes with zero errors: `make docs-vale`
154+
- [ ] Sphinx builds with zero warnings: `make docs-html`
155+
- [ ] All internal cross-references resolve.
156+
- [ ] All code examples have been run and produce the stated output.
157+
- [ ] Metadata block is present and accurate on every new or modified file.
158+
- [ ] The page fits exactly one Diátaxis type.
159+
160+
"The page renders" is not done. "Vale passes" is not done on its own. All six must be true.
161+
162+
---
163+
164+
## 10. What not to do
165+
166+
- NEVER mix tutorial and reference content in the same page.
167+
- NEVER use the word "simply" or "just" (Vale will catch this, but be proactive).
168+
- NEVER document behaviour you have not verified in the source.
169+
- NEVER copy metadata from another page without updating all fields.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
applyTo: "README.md"
3+
---
4+
# README file standards
5+
6+
## 1. Audience and scope
7+
8+
- This library is intended for Python developers building terminal applications or command line utilities.
9+
- The README.md file is going to be the first contact the reader has with this project:
10+
- Will be viewed on GitHub
11+
- Will be viewed also on PyPI
12+
- The file must:
13+
- Start with a short tagline and a brief project description.
14+
- Describe the features with enough detail so the reader understands what each feature does:
15+
- ✅ (good bullet point wording): `- Different renderers using other Python libraries like rich`
16+
- ❌ (too vague): `- Renderers`
17+
- Review the code if necessary to explain features accurately.
18+
- Include a minimal usage/code example showing how to define a JSONSchema and render a form.
19+
- Provide installation instructions for end users (using `pip`, `poetry`, and `uv`).
20+
- Provide installation instructions for developers willing to contribute to this project.
21+
- End with a license section.
22+
- About the reader:
23+
- Could be categorized as:
24+
- **End User**: Python developer willing to use this library in their own projects.
25+
- **Contributor**: Also a Python developer, probably also an End User, but someone willing to contribute to this library by fixing issues, implementing new features, and writing documentation.
26+
- Assume they know: Python development terms, Python 3.12+
27+
- Do NOT assume they know: internal architecture decisions, the history of the project, or even other libraries providing the same features.
28+
- Full documentation lives at: https://collective.github.io/tui-forms
29+
30+
## 2. Suggested README structure
31+
32+
Use this section order:
33+
34+
1. Badges (CI status, PyPI version, license)
35+
2. Project name and tagline
36+
3. Short description (2–4 sentences)
37+
4. Features (bulleted list with enough detail)
38+
5. Usage (minimal code example)
39+
6. Installation (End User)
40+
7. Contributing (Contributor setup)
41+
8. License
42+
43+
## 3. Recommendations
44+
45+
- ALWAYS use `TUI Forms` as the friendly name of the package and `tui-forms` when refering to the package codebase.
46+
- ALWAYS use emojis in section titles for a friendly tone.
47+
- ALWAYS use second person ("you") when addressing the reader.
48+
- End User:
49+
- Provide installation instructions on how to add this package to their own projects using `pip`, `poetry`, and `uv`.
50+
- Refer them to the full documentation for usage and how to integrate with their own project.
51+
- Contributor:
52+
- ALWAYS recommend using `make` commands. The key targets are:
53+
- `make install` — set up the development environment
54+
- `make format` — format the codebase
55+
- `make lint` — run the linter
56+
- `make lint-mypy` — check type hints
57+
- `make test` — run all tests
58+
- `make test-coverage` — run tests with coverage report
59+
- `make docs-html` — build the HTML documentation
60+
- `make docs-livehtml` — build and serve documentation locally
61+
- NEVER recommend using `pip install`, `uv add`, or `uv pip` directly.

.github/workflows/changelog.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Changelog check
2+
on:
3+
pull_request:
4+
types:
5+
- assigned
6+
- opened
7+
- synchronize
8+
- reopened
9+
- labeled
10+
- unlabeled
11+
branches:
12+
- main
13+
14+
env:
15+
python-version: 3.13
16+
17+
jobs:
18+
changelog:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v6
22+
with:
23+
# Fetch all history
24+
fetch-depth: 0
25+
26+
- name: Install the latest version of uv
27+
uses: astral-sh/setup-uv@v7
28+
with:
29+
python-version: ${{ env.python-version }}
30+
31+
- name: Check for presence of a Change Log fragment
32+
run: |
33+
git fetch --no-tags origin ${{ github.base_ref }}
34+
uvx towncrier check --compare-with origin/${{ github.base_ref }} --config pyproject.toml --dir .

.github/workflows/config.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: 'Compute Config variables'
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python-version:
7+
required: false
8+
type: string
9+
default: "3.12"
10+
outputs:
11+
backend:
12+
description: "Flag reporting if we should run the code jobs"
13+
value: ${{ jobs.config.outputs.backend }}
14+
docs:
15+
description: "Flag reporting if we should run the docs jobs"
16+
value: ${{ jobs.config.outputs.docs }}
17+
base-tag:
18+
description: "Base tag to be used when creating container images"
19+
value: ${{ jobs.config.outputs.base-tag }}
20+
python-version:
21+
description: "Python version to be used"
22+
value: ${{ inputs.python-version }}
23+
version-pyroma:
24+
description: "Pyroma version"
25+
value: "latest"
26+
version-ruff:
27+
description: "Ruff version"
28+
value: "latest"
29+
version-check-python:
30+
description: "Check Python version"
31+
value: "latest"
32+
33+
jobs:
34+
config:
35+
runs-on: ubuntu-latest
36+
outputs:
37+
backend: ${{ steps.filter.outputs.backend }}
38+
docs: ${{ steps.filter.outputs.docs }}
39+
base-tag: ${{ steps.vars.outputs.BASE_TAG }}
40+
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v6
44+
45+
- name: Compute several vars needed for the CI
46+
id: vars
47+
run: |
48+
echo "base-tag=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
49+
50+
- uses: dorny/paths-filter@v3.0.2
51+
id: filter
52+
with:
53+
filters: |
54+
backend:
55+
- '**'
56+
- '.github/workflows/config.yml'
57+
- '.github/workflows/main.yml'
58+
docs:
59+
- 'docs/**'
60+
- '.vale'
61+
- '.github/workflows/docs.yml'
62+
63+
- name: Test vars
64+
run: |
65+
echo "base-tag: ${{ steps.vars.outputs.base-tag }}"
66+
echo 'event-name: ${{ github.event_name }}'
67+
echo "ref-name: ${{ github.ref_name }}"
68+
echo 'Paths - code: ${{ steps.filter.outputs.backend }}'
69+
echo 'Paths - docs: ${{ steps.filter.outputs.docs }}'

0 commit comments

Comments
 (0)