dsgovbr-sphinx-theme 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. dsgovbr_sphinx_theme-0.1.0/LICENSE +21 -0
  2. dsgovbr_sphinx_theme-0.1.0/PKG-INFO +102 -0
  3. dsgovbr_sphinx_theme-0.1.0/README.md +66 -0
  4. dsgovbr_sphinx_theme-0.1.0/THIRD_PARTY_NOTICES.md +36 -0
  5. dsgovbr_sphinx_theme-0.1.0/pyproject.toml +65 -0
  6. dsgovbr_sphinx_theme-0.1.0/setup.cfg +4 -0
  7. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/__init__.py +71 -0
  8. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/componentes.py +1109 -0
  9. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/componentes_static/vendor/bootstrap/LICENSE +21 -0
  10. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/componentes_static/vendor/bootstrap/bootstrap.bundle.min.js +7 -0
  11. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/componentes_static/vendor/dsgovbr-bootstraped/LICENSE +21 -0
  12. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/componentes_static/vendor/dsgovbr-bootstraped/dsgovbr-bootstraped.min.css +5 -0
  13. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/dsgovbr-breadcrumb.html +22 -0
  14. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/dsgovbr-menu.html +23 -0
  15. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/layout.html +149 -0
  16. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/css/dsgovbr-sphinx-theme.css +369 -0
  17. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/css/rawline.css +68 -0
  18. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/OFL.txt +95 -0
  19. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-300.woff2 +0 -0
  20. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-400.woff2 +0 -0
  21. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-400i.woff2 +0 -0
  22. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-500.woff2 +0 -0
  23. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-600.woff2 +0 -0
  24. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-600i.woff2 +0 -0
  25. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-700.woff2 +0 -0
  26. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/fonts/rawline/rawline-700i.woff2 +0 -0
  27. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/static/js/dsgovbr-sphinx-theme.js +127 -0
  28. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme/theme.toml +27 -0
  29. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme.egg-info/PKG-INFO +102 -0
  30. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme.egg-info/SOURCES.txt +33 -0
  31. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme.egg-info/dependency_links.txt +1 -0
  32. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme.egg-info/entry_points.txt +2 -0
  33. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme.egg-info/requires.txt +6 -0
  34. dsgovbr_sphinx_theme-0.1.0/src/dsgovbr_sphinx_theme.egg-info/top_level.txt +1 -0
  35. dsgovbr_sphinx_theme-0.1.0/tests/test_tema.py +197 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abrasileirado
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,102 @@
1
+ Metadata-Version: 2.4
2
+ Name: dsgovbr-sphinx-theme
3
+ Version: 0.1.0
4
+ Summary: Tema Sphinx comunitário e não oficial inspirado no Design System GOV.BR (DSGovBR)
5
+ Author-email: Kelson da Costa Medeiros <kelsoncm@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://abrasileirado.github.io/dsgovbr-sphinx-theme/
8
+ Project-URL: Repository, https://github.com/abrasileirado/dsgovbr-sphinx-theme
9
+ Project-URL: Issues, https://github.com/abrasileirado/dsgovbr-sphinx-theme/issues
10
+ Keywords: sphinx,theme,dsgovbr,gov.br,design-system
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Framework :: Sphinx
13
+ Classifier: Framework :: Sphinx :: Theme
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Natural Language :: Portuguese (Brazilian)
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Documentation
24
+ Classifier: Topic :: Documentation :: Sphinx
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: THIRD_PARTY_NOTICES.md
29
+ License-File: src/dsgovbr_sphinx_theme/static/fonts/rawline/OFL.txt
30
+ Requires-Dist: sphinx>=7.3
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=8; extra == "dev"
33
+ Requires-Dist: ruff>=0.6; extra == "dev"
34
+ Requires-Dist: doc8>=1.1; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # dsgovbr-sphinx-theme
38
+
39
+ > Projeto comunitário, independente e **não oficial**. Não representa nem implica
40
+ > homologação ou endosso pelo GOV.BR DS ou pelo Governo Federal.
41
+
42
+ Tema [Sphinx](https://www.sphinx-doc.org/) com visual inspirado no Padrão Digital de
43
+ Governo ([GOV.BR DS](https://www.gov.br/ds/)): fonte Rawline, tokens de cor do GOV.BR DS,
44
+ cabeçalho, menu lateral, breadcrumb, avisos (*message*), tabelas e rodapé no estilo dos
45
+ componentes do design system, modo escuro e layout responsivo.
46
+
47
+ Inclui a extensão opcional `dsgovbr_sphinx_theme.componentes`, com diretivas e roles reST
48
+ (`.. br-alerta::`, `.. br-card::`, `.. br-acordeao::`, `:br-badge:`...) para usar nos seus
49
+ `.rst` os componentes do [dsgovbr-bootstraped](https://github.com/abrasileirado/dsgovbr-bootstraped).
50
+
51
+ Documentação: <https://abrasileirado.github.io/dsgovbr-sphinx-theme/>
52
+
53
+ ## Uso rápido
54
+
55
+ ```bash
56
+ pip install dsgovbr-sphinx-theme
57
+ ```
58
+
59
+ ```python
60
+ # docs/conf.py
61
+ html_theme = "dsgovbr_sphinx_theme"
62
+ extensions = [
63
+ "sphinx.ext.githubpages",
64
+ "dsgovbr_sphinx_theme.componentes", # opcional: diretivas br-*
65
+ ]
66
+ html_theme_options = {
67
+ "github_url": "https://github.com/org/repo",
68
+ "navigation_links": "PyPI|https://pypi.org/project/x/",
69
+ }
70
+ ```
71
+
72
+ ```rst
73
+ .. br-alerta:: warning
74
+ :titulo: Atenção
75
+
76
+ Revise os dados antes de continuar.
77
+
78
+ .. br-abas::
79
+
80
+ .. br-aba:: pip
81
+
82
+ ``pip install pacote``
83
+
84
+ .. br-aba:: uv
85
+
86
+ ``uv add pacote``
87
+ ```
88
+
89
+ Opções do tema e a lista completa de componentes estão na documentação.
90
+
91
+ ## Desenvolvimento
92
+
93
+ ```bash
94
+ uv venv && uv pip install -e ".[dev]"
95
+ uv run pytest
96
+ uv run ruff check .
97
+ uv run sphinx-build -W -b html docs docs/_build/html
98
+ ```
99
+
100
+ ## Licença
101
+
102
+ MIT. Fontes e assets de terceiros: ver [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,66 @@
1
+ # dsgovbr-sphinx-theme
2
+
3
+ > Projeto comunitário, independente e **não oficial**. Não representa nem implica
4
+ > homologação ou endosso pelo GOV.BR DS ou pelo Governo Federal.
5
+
6
+ Tema [Sphinx](https://www.sphinx-doc.org/) com visual inspirado no Padrão Digital de
7
+ Governo ([GOV.BR DS](https://www.gov.br/ds/)): fonte Rawline, tokens de cor do GOV.BR DS,
8
+ cabeçalho, menu lateral, breadcrumb, avisos (*message*), tabelas e rodapé no estilo dos
9
+ componentes do design system, modo escuro e layout responsivo.
10
+
11
+ Inclui a extensão opcional `dsgovbr_sphinx_theme.componentes`, com diretivas e roles reST
12
+ (`.. br-alerta::`, `.. br-card::`, `.. br-acordeao::`, `:br-badge:`...) para usar nos seus
13
+ `.rst` os componentes do [dsgovbr-bootstraped](https://github.com/abrasileirado/dsgovbr-bootstraped).
14
+
15
+ Documentação: <https://abrasileirado.github.io/dsgovbr-sphinx-theme/>
16
+
17
+ ## Uso rápido
18
+
19
+ ```bash
20
+ pip install dsgovbr-sphinx-theme
21
+ ```
22
+
23
+ ```python
24
+ # docs/conf.py
25
+ html_theme = "dsgovbr_sphinx_theme"
26
+ extensions = [
27
+ "sphinx.ext.githubpages",
28
+ "dsgovbr_sphinx_theme.componentes", # opcional: diretivas br-*
29
+ ]
30
+ html_theme_options = {
31
+ "github_url": "https://github.com/org/repo",
32
+ "navigation_links": "PyPI|https://pypi.org/project/x/",
33
+ }
34
+ ```
35
+
36
+ ```rst
37
+ .. br-alerta:: warning
38
+ :titulo: Atenção
39
+
40
+ Revise os dados antes de continuar.
41
+
42
+ .. br-abas::
43
+
44
+ .. br-aba:: pip
45
+
46
+ ``pip install pacote``
47
+
48
+ .. br-aba:: uv
49
+
50
+ ``uv add pacote``
51
+ ```
52
+
53
+ Opções do tema e a lista completa de componentes estão na documentação.
54
+
55
+ ## Desenvolvimento
56
+
57
+ ```bash
58
+ uv venv && uv pip install -e ".[dev]"
59
+ uv run pytest
60
+ uv run ruff check .
61
+ uv run sphinx-build -W -b html docs docs/_build/html
62
+ ```
63
+
64
+ ## Licença
65
+
66
+ MIT. Fontes e assets de terceiros: ver [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,36 @@
1
+ # Avisos de terceiros
2
+
3
+ Este pacote redistribui, sem modificação, os arquivos abaixo.
4
+
5
+ ## Fonte Rawline
6
+
7
+ - Arquivos: `src/dsgovbr_sphinx_theme/static/fonts/rawline/*.woff2` (pesos 300 a 700).
8
+ - Origem: CDN do GOV.BR DS (SERPRO),
9
+ `https://cdngovbr-ds.estaleiro.serpro.gov.br/design-system/fonts/rawline/`,
10
+ mesma cópia usada no site do dsgovbr-bootstraped.
11
+ - Licença: **SIL Open Font License 1.1** (`OFL.txt` ao lado das fontes;
12
+ copyright "The Raleway Project Authors"; a Rawline deriva da Raleway).
13
+ - Motivo da cópia: o CDN não envia `Access-Control-Allow-Origin`, o que impede
14
+ carregar a fonte com SRI.
15
+
16
+ ## dsgovbr-bootstraped
17
+
18
+ - Arquivo: `src/dsgovbr_sphinx_theme/componentes_static/vendor/dsgovbr-bootstraped/dsgovbr-bootstraped.min.css`
19
+ - Versão: dsgovbr-bootstraped **v0.11.0** (inclui Bootstrap 5.3.8 compilado).
20
+ - Origem: <https://github.com/abrasileirado/dsgovbr-bootstraped>
21
+ - Licença: MIT (`LICENSE` ao lado do arquivo).
22
+
23
+ ## Bootstrap
24
+
25
+ - Arquivo: `src/dsgovbr_sphinx_theme/componentes_static/vendor/bootstrap/bootstrap.bundle.min.js`
26
+ (inclui Popper).
27
+ - Versão: Bootstrap **v5.3.8**.
28
+ - Origem: <https://github.com/twbs/bootstrap>
29
+ - Licença: MIT (`LICENSE` ao lado do arquivo).
30
+
31
+ Os dois últimos só são carregados quando a extensão
32
+ `dsgovbr_sphinx_theme.componentes` está ativa. Para atualizá-los, veja
33
+ `scripts/atualizar_vendor.py`.
34
+
35
+ Este projeto é comunitário, independente e não oficial; não representa nem implica
36
+ endosso pelo GOV.BR DS, pelo Governo Federal ou pelo projeto Bootstrap.
@@ -0,0 +1,65 @@
1
+ [build-system]
2
+ requires = ["setuptools>=69", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "dsgovbr-sphinx-theme"
7
+ version = "0.1.0"
8
+ description = "Tema Sphinx comunitário e não oficial inspirado no Design System GOV.BR (DSGovBR)"
9
+ readme = "README.md"
10
+ authors = [{ name = "Kelson da Costa Medeiros", email = "kelsoncm@gmail.com" }]
11
+ license = "MIT"
12
+ license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md", "src/dsgovbr_sphinx_theme/static/fonts/rawline/OFL.txt"]
13
+ requires-python = ">=3.10"
14
+ dependencies = ["sphinx>=7.3"]
15
+ keywords = ["sphinx", "theme", "dsgovbr", "gov.br", "design-system"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Framework :: Sphinx",
19
+ "Framework :: Sphinx :: Theme",
20
+ "Intended Audience :: Developers",
21
+ "Natural Language :: Portuguese (Brazilian)",
22
+ "Operating System :: OS Independent",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ "Programming Language :: Python :: 3.13",
28
+ "Programming Language :: Python :: 3.14",
29
+ "Topic :: Documentation",
30
+ "Topic :: Documentation :: Sphinx",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = ["pytest>=8", "ruff>=0.6", "doc8>=1.1"]
35
+
36
+ [project.urls]
37
+ Homepage = "https://abrasileirado.github.io/dsgovbr-sphinx-theme/"
38
+ Repository = "https://github.com/abrasileirado/dsgovbr-sphinx-theme"
39
+ Issues = "https://github.com/abrasileirado/dsgovbr-sphinx-theme/issues"
40
+
41
+ [project.entry-points."sphinx.html_themes"]
42
+ dsgovbr_sphinx_theme = "dsgovbr_sphinx_theme"
43
+
44
+ [tool.setuptools.packages.find]
45
+ where = ["src"]
46
+
47
+ [tool.setuptools.package-data]
48
+ dsgovbr_sphinx_theme = [
49
+ "*.html",
50
+ "theme.toml",
51
+ "static/css/*.css",
52
+ "static/js/*.js",
53
+ "static/fonts/rawline/*",
54
+ "componentes_static/vendor/*/*",
55
+ ]
56
+
57
+ [tool.pytest.ini_options]
58
+ testpaths = ["tests"]
59
+
60
+ [tool.ruff]
61
+ line-length = 100
62
+ target-version = "py310"
63
+
64
+ [tool.ruff.lint]
65
+ select = ["E", "F", "W", "I", "UP", "B"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,71 @@
1
+ """Tema Sphinx comunitário e não oficial inspirado no Design System GOV.BR (DSGovBR)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from importlib.metadata import PackageNotFoundError, version
6
+ from pathlib import Path
7
+ from typing import Any
8
+
9
+ try:
10
+ __version__ = version("dsgovbr-sphinx-theme")
11
+ except PackageNotFoundError: # pragma: no cover - execução a partir do código-fonte
12
+ __version__ = "0.0.0"
13
+
14
+ THEME_NAME = "dsgovbr_sphinx_theme"
15
+
16
+
17
+ def get_html_theme_path() -> str:
18
+ """Retorna o diretório do tema (o que contém ``theme.toml``).
19
+
20
+ Mantido para quem ainda usa ``html_theme_path``; com o pacote instalado o
21
+ Sphinx encontra o tema pelo *entry point* ``sphinx.html_themes``.
22
+ """
23
+ return str(Path(__file__).resolve().parent)
24
+
25
+
26
+ def _parse_links(raw: Any) -> list[tuple[str, str]]:
27
+ """Converte ``navigation_links`` em pares (título, destino).
28
+
29
+ Aceita lista de pares/dicionários ou a string ``"Título|destino, Outro|url"``.
30
+ """
31
+ if not raw:
32
+ return []
33
+ links: list[tuple[str, str]] = []
34
+ if isinstance(raw, str):
35
+ for item in raw.split(","):
36
+ if not item.strip():
37
+ continue
38
+ title, _, target = item.partition("|")
39
+ if not target.strip():
40
+ raise ValueError(
41
+ f"[{THEME_NAME}] navigation_links: item {item.strip()!r} sem destino; "
42
+ "use 'Título|destino'."
43
+ )
44
+ links.append((title.strip(), target.strip()))
45
+ return links
46
+ for item in raw:
47
+ if isinstance(item, dict):
48
+ links.append((str(item["title"]), str(item["url"])))
49
+ else:
50
+ title, target = item
51
+ links.append((str(title), str(target)))
52
+ return links
53
+
54
+
55
+ def _html_page_context(
56
+ app: Any, pagename: str, templatename: str, context: dict[str, Any], doctree: Any
57
+ ) -> None:
58
+ """Expõe ``dsgovbr_navigation_links`` já normalizado para os templates."""
59
+ options = context.get("theme_navigation_links")
60
+ context["dsgovbr_navigation_links"] = _parse_links(options)
61
+
62
+
63
+ def setup(app: Any) -> dict[str, Any]:
64
+ """Registra o tema no Sphinx."""
65
+ app.add_html_theme(THEME_NAME, get_html_theme_path())
66
+ app.connect("html-page-context", _html_page_context)
67
+ return {
68
+ "version": __version__,
69
+ "parallel_read_safe": True,
70
+ "parallel_write_safe": True,
71
+ }