Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- name: Install dependencies
run: |
pip install zensical mkdocstrings-python markdown-exec[ansi]
pip install zensical mkdocstrings-python markdown-exec[ansi] griffe-pydantic
pip install pytest pytest-cov pytest-r-snapshot
pip install matplotlib python-docx pypdf
pip install -e '.[all]'
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## rtflite (development version)

### Documentation

- Update mkdocstrings settings to render Pydantic field metadata
via `griffe-pydantic` in API reference docs (#189).
- Declare `RTFDocument._table_space` as a Pydantic private attribute to
prevent mkdocstrings render errors in static mode (#189).

## rtflite 2.5.2

### Documentation
Expand Down
Binary file removed docs/assets/JetBrainsMono-Italic-Variable.woff2
Binary file not shown.
Binary file removed docs/assets/JetBrainsMono-Variable.woff2
Binary file not shown.
9 changes: 9 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## rtflite (development version)

### Documentation

- Update mkdocstrings settings to render Pydantic field metadata
via `griffe-pydantic` in API reference docs (#189).
- Declare `RTFDocument._table_space` as a Pydantic private attribute to
prevent mkdocstrings render errors in static mode (#189).

## rtflite 2.5.2

### Documentation
Expand Down
35 changes: 18 additions & 17 deletions docs/stylesheets/extra.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,9 @@
font-style: italic;
}

@font-face {
font-display: swap;
font-family: "JetBrains Mono";
src: url("../assets/JetBrainsMono-Variable.woff2") format("woff2");
font-weight: 100 800;
font-style: normal;
}

@font-face {
font-display: swap;
font-family: "JetBrains Mono";
src: url("../assets/JetBrainsMono-Italic-Variable.woff2") format("woff2");
font-weight: 100 800;
font-style: italic;
}

:root {
--md-text-font: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--md-code-font: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
--md-code-font: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

body {
Expand All @@ -55,6 +39,7 @@ body {

.md-nav {
font-size: 1rem;
line-height: 1.15;
}

.md-nav__item--section>.md-nav__link {
Expand All @@ -69,6 +54,10 @@ body {
height: 150%;
}

.md-ellipsis:has(.doc-symbol) {
font-size: 0.7em;
}

/* Content */

.md-typeset {
Expand Down Expand Up @@ -109,6 +98,18 @@ h4 code {
font-size: 0.8rem;
}

h2.doc-heading {
font-size: 1rem;
}

h3.doc-heading {
font-size: 0.9rem;
}

.doc-contents.first>details>summary {
line-height: 1.5;
}

/* Banner */

.md-banner {
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ dev = [
"zensical>=0.0.15",
"mkdocstrings-python>=1.12.2",
"markdown-exec[ansi]>=1.11.0",
"griffe-pydantic>=1.1.8",
"ruff>=0.7.4",
"isort>=5.13.2",
"mypy>=1.17.1",
Expand Down
10 changes: 9 additions & 1 deletion src/rtflite/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
from pathlib import Path

import polars as pl
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
from pydantic import (
BaseModel,
ConfigDict,
Field,
PrivateAttr,
field_validator,
model_validator,
)

from .convert import LibreOfficeConverter
from .input import (
Expand Down Expand Up @@ -122,6 +129,7 @@ class RTFDocument(BaseModel):
"""

model_config = ConfigDict(arbitrary_types_allowed=True)
_table_space: int = PrivateAttr(default=0)

# Core data
df: pl.DataFrame | list[pl.DataFrame] | None = Field(
Expand Down
11 changes: 6 additions & 5 deletions src/rtflite/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class RTFPage(BaseModel):
Defaults to "double" for closure.

Note:
The nrow parameter represents the total row capacity of a page,
The `nrow` parameter represents the total row capacity of a page,
not just data rows. Plan accordingly when setting this value.
"""

Expand Down Expand Up @@ -717,8 +717,8 @@ class RTFColumnHeader(TableAttributes):

Note:
- Headers automatically repeat on each page in multi-page documents
- Use col_rel_width to create spanning headers
- Border styles from RTFPage are applied to the first row
- Use `col_rel_width` to create spanning headers
- Border styles from `RTFPage` are applied to the first row
"""

model_config = ConfigDict(arbitrary_types_allowed=True)
Expand Down Expand Up @@ -833,10 +833,11 @@ class RTFBody(TableAttributes):
```

Note:
When using subline_by:
When using `subline_by`:

- The specified columns are removed from the table display
- Values appear as paragraph headers before each section
- Pagination is automatically enabled (new_page=True)
- Pagination is automatically enabled (`new_page=True`)
- Formatting attributes apply uniformly to the entire table
"""

Expand Down
14 changes: 14 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions zensical.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,30 @@ default_handler = "python"
paths = ["src"]

[project.plugins.mkdocstrings.handlers.python.options]
extensions = [{ griffe_pydantic = { schema = true } }]
filters = ["!^_"]
# Important for griffe_pydantic to render Pydantic models
force_inspection = false
inherited_members = true
members_order = "source"
merge_init_into_class = true
separate_signature = true
show_root_heading = true
show_signature_annotations = true
show_source = false
signature_crossrefs = true
show_symbol_type_heading = true
show_symbol_type_toc = true

[project.plugins.mkdocstrings.handlers.python.options.docstring_options]
ignore_init_summary = true

[[project.plugins.mkdocstrings.handlers.python.import]]
url = "https://docs.python.org/3/objects.inv"
domains = ["py", "std"]

[[project.plugins.mkdocstrings.handlers.python.import]]
url = "https://typing-extensions.readthedocs.io/en/latest/objects.inv"

# ----------------------------------------------------------------------------
# Section for configuring markdown-exec plugin
Expand Down