tesorotools-python 0.1.12__tar.gz → 0.1.13__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.
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/PKG-INFO +1 -1
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/__init__.py +40 -3
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/_registry.py +56 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/__init__.py +27 -1
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/_common.py +15 -1
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/_dates.py +11 -117
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/bar_line.py +8 -5
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/barh_plot.py +7 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/box_plot.py +3 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/intraday_plot.py +3 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/line_plot.py +3 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/matrix.py +3 -0
- tesorotools_python-0.1.13/src/tesorotools/artists/names.py +129 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/plotly_backend.py +62 -9
- tesorotools_python-0.1.13/src/tesorotools/artists/review.py +424 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/sankey.py +3 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/scatter.py +3 -0
- tesorotools_python-0.1.13/src/tesorotools/artists/sharing.py +306 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/shock_plot.py +4 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/stacked.py +61 -11
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/type_curve.py +167 -73
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/vector_plot.py +3 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/waterfall.py +3 -0
- tesorotools_python-0.1.13/src/tesorotools/dates.py +165 -0
- tesorotools_python-0.1.13/src/tesorotools/extend.py +188 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/builder.py +2 -5
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/lint.py +5 -4
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/pipeline/engine.py +21 -11
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/pipeline/rules.py +155 -4
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/__init__.py +2 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/builder.py +2 -16
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/cli.py +88 -12
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/native.py +12 -15
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/skill/SKILL.md +44 -12
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/skill/reglas.md +3 -3
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/images.py +34 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/section.py +4 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/subtitle.py +11 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/table.py +19 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/text.py +4 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/title.py +8 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/report.py +8 -0
- tesorotools_python-0.1.13/src/tesorotools/utils/template.py +397 -0
- tesorotools_python-0.1.12/src/tesorotools/artists/sharing.py +0 -59
- tesorotools_python-0.1.12/src/tesorotools/utils/template.py +0 -132
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/.gitignore +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/pyproject.toml +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/_build_context.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/_bars.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/compact.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/tikz_backend.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/README.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Black.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Bold.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Extrabold.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Extralight.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Light.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Medium.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Regular.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/CabinetGrotesk-Thin.otf +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/fonts/README.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/nota_template.dotx +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/plots.yaml +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/template.docx +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/assets/tesoro.mplstyle +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/data_sources/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/data_sources/debug.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/database/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/database/local.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/database/push.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/database/shared.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/dependencies/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/dependencies/node.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/dependencies/resolution.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/driver.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/cli.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/scaffold.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/article/main.tex.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/article/sections/01-introduccion.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/article/sections/02-analisis.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/article/sections/03-conclusiones.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/beamer/main.tex.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/beamer/slides/01-contexto.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/beamer/slides/02-analisis.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/beamer/slides/03-conclusiones.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/beamer/style/beamerthemeTesoro.sty +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/book/appendices/a-fuentes.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/book/chapters/01-introduccion.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/book/chapters/02-analisis.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/book/frontmatter/resumen.tex +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/book/main.tex.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/README.md.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/dot-gitignore +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/dot-vscode/settings.json +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/figures/dot-gitkeep +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/fonts/README.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/latexmkrc +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/refs.bib +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/style/tesoro.sty +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/style/tesorobrand.sty.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/latex/templates/common/style/tesorolocal.sty.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/manifest.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/charts.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/cli.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/inline.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/issues.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/markdown.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/pdf.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/skeleton.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/skill/SKILL.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/skill/reglas.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/note/template.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/offsets/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/offsets/offsets.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/offsets/outliers.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/orchestration.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/palette.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/pipeline/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/pipeline/diagnose.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/charts.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/fit.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/fonts.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/glossary.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/house.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/lint.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/markdown.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/pdf.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/sections.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/skeleton.md +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/presentation/template.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/base.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/bde.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/ecb.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/fred.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/imf_irfcl.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/providers/lseg.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/py.typed +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/content/content.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/render/document.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/scaffold.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/testing/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/testing/compare.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/config.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/format.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/globals.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/matplotlib.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/series.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/utils/shortcuts.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/__init__.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/app.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/brand.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/cli.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/components.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/formatting.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/launcher.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/palette.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/period.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/plotting.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/scaffold.py +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/Dockerfile.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/README.md.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/dot-dockerignore.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/dot-gitignore.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/dot-streamlit/config.toml.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/pyproject.toml.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/src/$package/__init__.py.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/src/$package/cli.py.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/src/$package/main.py.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/src/$package/sections.py.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/tests/__init__.py.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/templates/tests/test_app.py.tmpl +0 -0
- {tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/web/theme.py +0 -0
|
@@ -14,11 +14,16 @@ requires ``[lseg]``) are exposed lazily through
|
|
|
14
14
|
extras to be installed.
|
|
15
15
|
|
|
16
16
|
Third parties extend the package via ``register_artist``,
|
|
17
|
-
``register_tag``,
|
|
18
|
-
plural variants)
|
|
19
|
-
|
|
17
|
+
``register_tag``, ``register_provider`` and ``register_rule``
|
|
18
|
+
(and their plural variants), with the building blocks of
|
|
19
|
+
:mod:`tesorotools.extend`; installed packages that declare a
|
|
20
|
+
``tesorotools.extensions`` entry point are loaded on import
|
|
21
|
+
(:func:`load_extensions`). See ``docs/extending.md`` for the
|
|
22
|
+
recommended idioms and ``docs/estabilidad.md`` for what is
|
|
23
|
+
public.
|
|
20
24
|
"""
|
|
21
25
|
|
|
26
|
+
import os
|
|
22
27
|
from importlib.metadata import PackageNotFoundError, version
|
|
23
28
|
from typing import TYPE_CHECKING, Any
|
|
24
29
|
|
|
@@ -40,6 +45,7 @@ if TYPE_CHECKING:
|
|
|
40
45
|
from tesorotools._build_context import BuildContext
|
|
41
46
|
from tesorotools._registry import (
|
|
42
47
|
Artist,
|
|
48
|
+
NO_EXTENSIONS_ENV,
|
|
43
49
|
YamlConstructor,
|
|
44
50
|
all_artists,
|
|
45
51
|
all_providers,
|
|
@@ -49,6 +55,8 @@ from tesorotools._registry import (
|
|
|
49
55
|
iter_artists,
|
|
50
56
|
iter_providers,
|
|
51
57
|
iter_tags,
|
|
58
|
+
load_extensions,
|
|
59
|
+
loaded_extensions,
|
|
52
60
|
register_artist,
|
|
53
61
|
register_artists,
|
|
54
62
|
register_provider,
|
|
@@ -77,6 +85,14 @@ from tesorotools.artists import (
|
|
|
77
85
|
share_y_axes,
|
|
78
86
|
)
|
|
79
87
|
from tesorotools.orchestration import CompositeRegistry, iter_contexts
|
|
88
|
+
from tesorotools.pipeline.rules import (
|
|
89
|
+
RuleParam,
|
|
90
|
+
RuleSpec,
|
|
91
|
+
build_rule,
|
|
92
|
+
describe_rule,
|
|
93
|
+
describe_rules,
|
|
94
|
+
register_rule,
|
|
95
|
+
)
|
|
80
96
|
from tesorotools.providers.base import (
|
|
81
97
|
DataProvider,
|
|
82
98
|
RegistryProtocol,
|
|
@@ -94,6 +110,12 @@ from tesorotools.render import (
|
|
|
94
110
|
Title,
|
|
95
111
|
new_document,
|
|
96
112
|
)
|
|
113
|
+
from tesorotools.utils.template import (
|
|
114
|
+
Tagged,
|
|
115
|
+
TemplateDumper,
|
|
116
|
+
TemplateLoader,
|
|
117
|
+
dump_template,
|
|
118
|
+
)
|
|
97
119
|
|
|
98
120
|
|
|
99
121
|
def _register_builtins() -> None:
|
|
@@ -127,6 +149,9 @@ def _register_builtins() -> None:
|
|
|
127
149
|
|
|
128
150
|
_register_builtins()
|
|
129
151
|
|
|
152
|
+
if os.environ.get(NO_EXTENSIONS_ENV) != "1":
|
|
153
|
+
load_extensions()
|
|
154
|
+
|
|
130
155
|
|
|
131
156
|
__all__ = [
|
|
132
157
|
"__version__",
|
|
@@ -161,6 +186,9 @@ __all__ = [
|
|
|
161
186
|
"StackedBarPlot",
|
|
162
187
|
"Subtitle",
|
|
163
188
|
"Table",
|
|
189
|
+
"Tagged",
|
|
190
|
+
"TemplateDumper",
|
|
191
|
+
"TemplateLoader",
|
|
164
192
|
"Text",
|
|
165
193
|
"Title",
|
|
166
194
|
"TypeCurve",
|
|
@@ -171,6 +199,7 @@ __all__ = [
|
|
|
171
199
|
"all_providers",
|
|
172
200
|
"all_tags",
|
|
173
201
|
"bootstrap_providers",
|
|
202
|
+
"dump_template",
|
|
174
203
|
"get_artist",
|
|
175
204
|
"get_provider",
|
|
176
205
|
"iter_artists",
|
|
@@ -185,6 +214,14 @@ __all__ = [
|
|
|
185
214
|
"register_tag",
|
|
186
215
|
"register_tags",
|
|
187
216
|
"share_y_axes",
|
|
217
|
+
"RuleParam",
|
|
218
|
+
"RuleSpec",
|
|
219
|
+
"build_rule",
|
|
220
|
+
"describe_rule",
|
|
221
|
+
"describe_rules",
|
|
222
|
+
"load_extensions",
|
|
223
|
+
"loaded_extensions",
|
|
224
|
+
"register_rule",
|
|
188
225
|
]
|
|
189
226
|
|
|
190
227
|
|
|
@@ -39,7 +39,9 @@ import the private dictionaries.
|
|
|
39
39
|
|
|
40
40
|
from __future__ import annotations
|
|
41
41
|
|
|
42
|
+
import warnings
|
|
42
43
|
from collections.abc import Iterator, Mapping
|
|
44
|
+
from importlib.metadata import entry_points
|
|
43
45
|
from typing import Any, Callable, Literal, Protocol, Self, cast, overload
|
|
44
46
|
|
|
45
47
|
from yaml.nodes import MappingNode
|
|
@@ -236,3 +238,57 @@ def iter_tags() -> Iterator[tuple[str, YamlConstructor]]:
|
|
|
236
238
|
def all_tags() -> dict[str, YamlConstructor]:
|
|
237
239
|
"""Return a snapshot dict of every registered ``!`` YAML tag."""
|
|
238
240
|
return dict(iter_tags())
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
# ----------------------------------------------------------------------
|
|
244
|
+
# Extensions declared by installed packages
|
|
245
|
+
# ----------------------------------------------------------------------
|
|
246
|
+
|
|
247
|
+
#: Entry point group of the packages that extend tesorotools.
|
|
248
|
+
EXTENSIONS_GROUP = "tesorotools.extensions"
|
|
249
|
+
#: Set it to ``1`` to import tesorotools without loading extensions.
|
|
250
|
+
NO_EXTENSIONS_ENV = "TESOROTOOLS_NO_EXTENSIONS"
|
|
251
|
+
_LOADED_EXTENSIONS: dict[str, str] = {}
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def load_extensions(group: str = EXTENSIONS_GROUP) -> dict[str, str]:
|
|
255
|
+
"""Load the extensions that installed packages declare.
|
|
256
|
+
|
|
257
|
+
A package declares one in its ``pyproject.toml``::
|
|
258
|
+
|
|
259
|
+
[project.entry-points."tesorotools.extensions"]
|
|
260
|
+
mi_extension = "mi_paquete.extension:install"
|
|
261
|
+
|
|
262
|
+
and ``install()`` registers its artists, tags, providers and rules.
|
|
263
|
+
An entry point may also name a module, whose import registers them.
|
|
264
|
+
``import tesorotools`` calls this once (unless the environment
|
|
265
|
+
variable ``TESOROTOOLS_NO_EXTENSIONS`` is ``1``), so the extension
|
|
266
|
+
works from the command line, a project or a server alike.
|
|
267
|
+
|
|
268
|
+
An extension that fails is skipped with a :class:`RuntimeWarning`
|
|
269
|
+
naming it, and never stops tesorotools from loading. Returns every
|
|
270
|
+
extension loaded so far, by name, with its ``"module:attr"``; a
|
|
271
|
+
name already loaded is not loaded twice.
|
|
272
|
+
"""
|
|
273
|
+
for point in entry_points(group=group):
|
|
274
|
+
if point.name in _LOADED_EXTENSIONS:
|
|
275
|
+
continue
|
|
276
|
+
try:
|
|
277
|
+
target = point.load()
|
|
278
|
+
if callable(target):
|
|
279
|
+
target()
|
|
280
|
+
except Exception as error: # noqa: BLE001 - never break the import
|
|
281
|
+
warnings.warn(
|
|
282
|
+
f"tesorotools extension {point.name!r} ({point.value}) "
|
|
283
|
+
f"failed to load: {type(error).__name__}: {error}",
|
|
284
|
+
RuntimeWarning,
|
|
285
|
+
stacklevel=2,
|
|
286
|
+
)
|
|
287
|
+
continue
|
|
288
|
+
_LOADED_EXTENSIONS[point.name] = point.value
|
|
289
|
+
return dict(_LOADED_EXTENSIONS)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def loaded_extensions() -> dict[str, str]:
|
|
293
|
+
"""The extensions loaded so far, by name, with their ``module:attr``."""
|
|
294
|
+
return dict(_LOADED_EXTENSIONS)
|
|
@@ -20,6 +20,9 @@ Each class follows the same shape:
|
|
|
20
20
|
Plotly figure (all but ``IntradayPlot``);
|
|
21
21
|
:func:`plotly_unsupported` lists the keys it drops.
|
|
22
22
|
|
|
23
|
+
:func:`data_issues` reviews the data of a chart (too many series or
|
|
24
|
+
bars, mixed magnitudes, gaps) and returns ``Issue`` warnings.
|
|
25
|
+
|
|
23
26
|
:func:`share_y_axes` gives the charts that declare the same
|
|
24
27
|
``y_group`` one common y scale.
|
|
25
28
|
|
|
@@ -45,9 +48,22 @@ from tesorotools.artists.box_plot import BoxPlot
|
|
|
45
48
|
from tesorotools.artists.intraday_plot import IntradayPlot
|
|
46
49
|
from tesorotools.artists.line_plot import LinePlot
|
|
47
50
|
from tesorotools.artists.matrix import MatrixChart
|
|
51
|
+
from tesorotools.artists.names import (
|
|
52
|
+
KIND_NAMES,
|
|
53
|
+
KindName,
|
|
54
|
+
kind_from_name,
|
|
55
|
+
native_kind,
|
|
56
|
+
spanish_name,
|
|
57
|
+
)
|
|
58
|
+
from tesorotools.artists.review import ReviewLimits, data_issues
|
|
48
59
|
from tesorotools.artists.sankey import SankeyPlot
|
|
49
60
|
from tesorotools.artists.scatter import ScatterPlot
|
|
50
|
-
from tesorotools.artists.sharing import
|
|
61
|
+
from tesorotools.artists.sharing import (
|
|
62
|
+
align_plot_areas,
|
|
63
|
+
draw_together,
|
|
64
|
+
equal_axis_decimals,
|
|
65
|
+
share_y_axes,
|
|
66
|
+
)
|
|
51
67
|
from tesorotools.artists.shock_plot import ShockChart
|
|
52
68
|
from tesorotools.artists.stacked import StackedAreaPlot, StackedBarPlot
|
|
53
69
|
from tesorotools.artists.type_curve import TypeCurve
|
|
@@ -55,6 +71,7 @@ from tesorotools.artists.vector_plot import VectorPlot
|
|
|
55
71
|
from tesorotools.artists.waterfall import Waterfall
|
|
56
72
|
|
|
57
73
|
__all__ = [
|
|
74
|
+
"KIND_NAMES",
|
|
58
75
|
"Artist",
|
|
59
76
|
"BarLinePlot",
|
|
60
77
|
"BoxPlot",
|
|
@@ -63,9 +80,11 @@ __all__ = [
|
|
|
63
80
|
"GroupedBarChart",
|
|
64
81
|
"HorizontalBarChart",
|
|
65
82
|
"IntradayPlot",
|
|
83
|
+
"KindName",
|
|
66
84
|
"Legend",
|
|
67
85
|
"LinePlot",
|
|
68
86
|
"MatrixChart",
|
|
87
|
+
"ReviewLimits",
|
|
69
88
|
"SankeyPlot",
|
|
70
89
|
"ScatterPlot",
|
|
71
90
|
"ShockChart",
|
|
@@ -74,6 +93,13 @@ __all__ = [
|
|
|
74
93
|
"TypeCurve",
|
|
75
94
|
"VectorPlot",
|
|
76
95
|
"Waterfall",
|
|
96
|
+
"align_plot_areas",
|
|
97
|
+
"draw_together",
|
|
98
|
+
"equal_axis_decimals",
|
|
99
|
+
"kind_from_name",
|
|
100
|
+
"native_kind",
|
|
101
|
+
"data_issues",
|
|
77
102
|
"plotly_unsupported",
|
|
78
103
|
"share_y_axes",
|
|
104
|
+
"spanish_name",
|
|
79
105
|
]
|
|
@@ -27,7 +27,15 @@ import math
|
|
|
27
27
|
import warnings
|
|
28
28
|
from collections.abc import Sequence
|
|
29
29
|
from pathlib import Path
|
|
30
|
-
from typing import
|
|
30
|
+
from typing import (
|
|
31
|
+
Any,
|
|
32
|
+
ClassVar,
|
|
33
|
+
Literal,
|
|
34
|
+
Protocol,
|
|
35
|
+
Self,
|
|
36
|
+
cast,
|
|
37
|
+
runtime_checkable,
|
|
38
|
+
)
|
|
31
39
|
|
|
32
40
|
import matplotlib.colors as mcolors
|
|
33
41
|
import matplotlib.pyplot as plt
|
|
@@ -369,6 +377,9 @@ class Format:
|
|
|
369
377
|
noise) -- set it on the ``annot_fmt`` that labels the bars.
|
|
370
378
|
"""
|
|
371
379
|
|
|
380
|
+
#: Written on one line by ``dump_template``: ``!format {decimals: 1}``.
|
|
381
|
+
yaml_flow_style: ClassVar[bool] = True
|
|
382
|
+
|
|
372
383
|
def __init__(
|
|
373
384
|
self, units: str = "", decimals: int = 0, signed: bool = False
|
|
374
385
|
) -> None:
|
|
@@ -417,6 +428,9 @@ class Legend:
|
|
|
417
428
|
then.
|
|
418
429
|
"""
|
|
419
430
|
|
|
431
|
+
#: Written on one line by ``dump_template``: ``!legend {ncol: 2}``.
|
|
432
|
+
yaml_flow_style: ClassVar[bool] = True
|
|
433
|
+
|
|
420
434
|
def __init__(
|
|
421
435
|
self,
|
|
422
436
|
ncol: int | None = None,
|
|
@@ -14,6 +14,17 @@ from typing import Any
|
|
|
14
14
|
|
|
15
15
|
import pandas as pd
|
|
16
16
|
|
|
17
|
+
# The date texts live in :mod:`tesorotools.dates`; re-exported here for
|
|
18
|
+
# the modules that read them with the calendar grids.
|
|
19
|
+
from tesorotools.dates import MONTH_ABBREVIATIONS as MONTH_ABBREVIATIONS
|
|
20
|
+
from tesorotools.dates import MONTHS as MONTHS
|
|
21
|
+
from tesorotools.dates import data_frequency as data_frequency
|
|
22
|
+
from tesorotools.dates import date_label as date_label
|
|
23
|
+
from tesorotools.dates import dates_unit as dates_unit
|
|
24
|
+
from tesorotools.dates import day_label as day_label
|
|
25
|
+
from tesorotools.dates import month_label as month_label
|
|
26
|
+
from tesorotools.dates import quarter_label as quarter_label
|
|
27
|
+
|
|
17
28
|
#: Calendar steps, finest first. ``M`` counts months, ``Y`` years; the
|
|
18
29
|
#: month steps divide a year, so January is always on the grid.
|
|
19
30
|
DATE_STEPS: tuple[str, ...] = (
|
|
@@ -212,123 +223,6 @@ def date_layouts(
|
|
|
212
223
|
return layouts
|
|
213
224
|
|
|
214
225
|
|
|
215
|
-
#: Month names and abbreviations of the house dates. Spelled here and not
|
|
216
|
-
#: read from the locale (``%b``), which gives ``Dec`` on a server in
|
|
217
|
-
#: English and ``dic.`` on a Spanish desktop.
|
|
218
|
-
MONTHS: tuple[str, ...] = (
|
|
219
|
-
"enero",
|
|
220
|
-
"febrero",
|
|
221
|
-
"marzo",
|
|
222
|
-
"abril",
|
|
223
|
-
"mayo",
|
|
224
|
-
"junio",
|
|
225
|
-
"julio",
|
|
226
|
-
"agosto",
|
|
227
|
-
"septiembre",
|
|
228
|
-
"octubre",
|
|
229
|
-
"noviembre",
|
|
230
|
-
"diciembre",
|
|
231
|
-
)
|
|
232
|
-
MONTH_ABBREVIATIONS: tuple[str, ...] = (
|
|
233
|
-
"ene.",
|
|
234
|
-
"feb.",
|
|
235
|
-
"mar.",
|
|
236
|
-
"abr.",
|
|
237
|
-
"may.",
|
|
238
|
-
"jun.",
|
|
239
|
-
"jul.",
|
|
240
|
-
"ago.",
|
|
241
|
-
"sep.",
|
|
242
|
-
"oct.",
|
|
243
|
-
"nov.",
|
|
244
|
-
"dic.",
|
|
245
|
-
)
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
def month_label(when: Any, *, year: bool = False) -> str:
|
|
249
|
-
"""The month of *when* as the date axes print it: ``dic.``.
|
|
250
|
-
|
|
251
|
-
With *year*, ``dic. 2022``: the label of a month that stands alone
|
|
252
|
-
(the first date of an axis, a monthly bar).
|
|
253
|
-
"""
|
|
254
|
-
ts = pd.Timestamp(when)
|
|
255
|
-
month = MONTH_ABBREVIATIONS[ts.month - 1]
|
|
256
|
-
return f"{month} {ts.year}" if year else month
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
def quarter_label(when: Any, *, year: bool = False) -> str:
|
|
260
|
-
"""The quarter of *when* on a chart axis: ``2T``, ``2T 2025`` with *year*.
|
|
261
|
-
|
|
262
|
-
A chart axis has no room for the ``segundo trimestre de 2025`` of the
|
|
263
|
-
running text, so it prints the short form of the tables.
|
|
264
|
-
"""
|
|
265
|
-
ts = pd.Timestamp(when)
|
|
266
|
-
return f"{ts.quarter}T {ts.year}" if year else f"{ts.quarter}T"
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
def data_frequency(dates: Any) -> str:
|
|
270
|
-
"""How often *dates* come: ``"Y"``, ``"Q"``, ``"M"`` or ``"D"``.
|
|
271
|
-
|
|
272
|
-
Read from the shortest gap between two consecutive dates (a missing
|
|
273
|
-
period only widens the others), so a series with one bar per year
|
|
274
|
-
is annual whether it is dated on 1 January or on 31 December. Fewer
|
|
275
|
-
than two dates are daily: nothing says they are coarser.
|
|
276
|
-
"""
|
|
277
|
-
index = pd.DatetimeIndex(dates).unique().sort_values()
|
|
278
|
-
if len(index) < 2:
|
|
279
|
-
return "D"
|
|
280
|
-
gap = int((index[1:] - index[:-1]).days.min())
|
|
281
|
-
if gap >= 360:
|
|
282
|
-
return "Y"
|
|
283
|
-
if gap >= 88:
|
|
284
|
-
return "Q"
|
|
285
|
-
return "M" if gap >= 28 else "D"
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
def dates_unit(dates: Any) -> str:
|
|
289
|
-
"""The :func:`date_label` unit that names every one of *dates*.
|
|
290
|
-
|
|
291
|
-
``"Y"`` when they all close a year (31 December) or all open one
|
|
292
|
-
(1 January, one per year), ``"M"`` when they all close or open a
|
|
293
|
-
month, else ``"D"``: the dates of a bar chart read ``2025``, ``dic.
|
|
294
|
-
2025`` or ``31 de diciembre de 2025``, never ``2025-12-31 00:00:00``.
|
|
295
|
-
"""
|
|
296
|
-
index = pd.DatetimeIndex(dates)
|
|
297
|
-
year_ends = bool(((index.month == 12) & (index.day == 31)).all())
|
|
298
|
-
year_starts = bool(((index.month == 1) & (index.day == 1)).all())
|
|
299
|
-
if year_ends or (year_starts and len(index) > 1 and index.year.is_unique):
|
|
300
|
-
return "Y"
|
|
301
|
-
if bool((index.is_month_end | (index.day == 1)).all()):
|
|
302
|
-
return "M"
|
|
303
|
-
return "D"
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
def day_label(when: Any) -> str:
|
|
307
|
-
"""A day as the house writes it: ``29 de octubre de 2026``."""
|
|
308
|
-
ts = pd.Timestamp(when)
|
|
309
|
-
return f"{ts.day} de {MONTHS[ts.month - 1]} de {ts.year}"
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
def date_label(when: Any, unit: str = "D") -> str:
|
|
313
|
-
"""The one house text of a date, whatever the chart that prints it.
|
|
314
|
-
|
|
315
|
-
*unit* is what the date stands for: ``"Y"`` a year (``2025``),
|
|
316
|
-
``"Q"`` a quarter (``4T 2025``), ``"M"`` a month (``dic. 2022``)
|
|
317
|
-
and ``"D"`` a day (``29 de octubre de 2026``). Never the
|
|
318
|
-
``29/10/2026``, ``ene-21`` or ``2025-12-31 00:00:00`` of
|
|
319
|
-
``strftime`` and ``str``.
|
|
320
|
-
"""
|
|
321
|
-
if unit == "Y":
|
|
322
|
-
return str(pd.Timestamp(when).year)
|
|
323
|
-
if unit == "Q":
|
|
324
|
-
return quarter_label(when, year=True)
|
|
325
|
-
if unit == "M":
|
|
326
|
-
return month_label(when, year=True)
|
|
327
|
-
if unit == "D":
|
|
328
|
-
return day_label(when)
|
|
329
|
-
raise ValueError(f"date unit must be 'Y', 'Q', 'M' or 'D': {unit!r}")
|
|
330
|
-
|
|
331
|
-
|
|
332
226
|
def period_label(
|
|
333
227
|
period: pd.Timestamp, step: str, *, first: bool = False
|
|
334
228
|
) -> str:
|
|
@@ -196,6 +196,9 @@ class BarLinePlot(FigureLifecycle):
|
|
|
196
196
|
)
|
|
197
197
|
self.out_path = out_path
|
|
198
198
|
self.data = resolve_data(data, data_path)
|
|
199
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
200
|
+
#: kept so the chart can be written back to YAML.
|
|
201
|
+
self.data_path = data_path
|
|
199
202
|
self.scale = scale
|
|
200
203
|
self.start_date = start_date
|
|
201
204
|
self.end_date = end_date
|
|
@@ -283,7 +286,7 @@ class BarLinePlot(FigureLifecycle):
|
|
|
283
286
|
cfg["data_path"] = Path(cfg["data_path"])
|
|
284
287
|
return cls(**cfg)
|
|
285
288
|
|
|
286
|
-
def
|
|
289
|
+
def prepare_data(self) -> pd.DataFrame:
|
|
287
290
|
"""Slice by date and scale -- the backend-neutral IR.
|
|
288
291
|
|
|
289
292
|
Returns the sliced, scaled frame carrying every bar and line
|
|
@@ -332,7 +335,7 @@ class BarLinePlot(FigureLifecycle):
|
|
|
332
335
|
month = strftime("%b").rstrip(".").replace("%", "%%")
|
|
333
336
|
return strftime(self.date_format.replace("%b", month)).lower()
|
|
334
337
|
|
|
335
|
-
def
|
|
338
|
+
def format_xticks(
|
|
336
339
|
self,
|
|
337
340
|
ax: Axes,
|
|
338
341
|
index: pd.Index,
|
|
@@ -385,7 +388,7 @@ class BarLinePlot(FigureLifecycle):
|
|
|
385
388
|
def build(self) -> tuple[Figure, Axes]:
|
|
386
389
|
"""Render the chart in memory; return ``(fig, ax)`` without saving."""
|
|
387
390
|
self._check_columns()
|
|
388
|
-
plot_data = self.
|
|
391
|
+
plot_data = self.prepare_data()
|
|
389
392
|
x = np.arange(len(plot_data))
|
|
390
393
|
# lines first, bars after them, in the house cycle; España keeps
|
|
391
394
|
# its own colour wherever it sits (series_colors)
|
|
@@ -473,7 +476,7 @@ class BarLinePlot(FigureLifecycle):
|
|
|
473
476
|
extend_to_ticks(axis)
|
|
474
477
|
# measured at the labels' real size, once the y-axes have taken
|
|
475
478
|
# their room
|
|
476
|
-
self.
|
|
479
|
+
self.format_xticks(ax, plot_data.index, x)
|
|
477
480
|
fit_x_rotation(fig, ax, self.x_rotation, compact=self.compact)
|
|
478
481
|
ylabel = self.ylabel or (
|
|
479
482
|
self._axis_title(secondary=False) if ax2 is not None else ""
|
|
@@ -506,7 +509,7 @@ class BarLinePlot(FigureLifecycle):
|
|
|
506
509
|
data, like a :class:`LinePlot`, and is never stretched down to 0.
|
|
507
510
|
Shared by :meth:`build` and :meth:`to_plotly`.
|
|
508
511
|
"""
|
|
509
|
-
data = self.
|
|
512
|
+
data = self.prepare_data()
|
|
510
513
|
|
|
511
514
|
def on(secondary: bool) -> bool:
|
|
512
515
|
cols = [
|
{tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/barh_plot.py
RENAMED
|
@@ -620,7 +620,11 @@ class HorizontalBarChart(FigureLifecycle):
|
|
|
620
620
|
_check_label_position(value_label_position)
|
|
621
621
|
self.out_path = out_path
|
|
622
622
|
self.data = resolve_data(data, data_path)
|
|
623
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
624
|
+
#: kept so the chart can be written back to YAML.
|
|
625
|
+
self.data_path = data_path
|
|
623
626
|
self.alias = _date_names(_collect_alias(blocks, series))
|
|
627
|
+
self.series = series
|
|
624
628
|
self.blocks = blocks
|
|
625
629
|
self.value_column = value_column
|
|
626
630
|
self.axis_column = axis_column
|
|
@@ -913,6 +917,9 @@ class GroupedBarChart(FigureLifecycle):
|
|
|
913
917
|
_check_label_position(value_label_position)
|
|
914
918
|
self.out_path = out_path
|
|
915
919
|
self.data = resolve_data(data, data_path)
|
|
920
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
921
|
+
#: kept so the chart can be written back to YAML.
|
|
922
|
+
self.data_path = data_path
|
|
916
923
|
self.categories = _date_names(categories)
|
|
917
924
|
self.series = series
|
|
918
925
|
self.fmt = fmt or Format()
|
|
@@ -179,6 +179,9 @@ class BoxPlot(FigureLifecycle):
|
|
|
179
179
|
raise ValueError("weighted mode requires `weight_col`")
|
|
180
180
|
self.out_path = out_path
|
|
181
181
|
self.data = resolve_data(data, data_path)
|
|
182
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
183
|
+
#: kept so the chart can be written back to YAML.
|
|
184
|
+
self.data_path = data_path
|
|
182
185
|
self.series = series
|
|
183
186
|
self.mode = mode
|
|
184
187
|
self.weight_col = weight_col
|
{tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/intraday_plot.py
RENAMED
|
@@ -119,6 +119,9 @@ class IntradayPlot(FigureLifecycle):
|
|
|
119
119
|
raise ValueError(f"out_path must be .png: {out_path}")
|
|
120
120
|
self.out_path = out_path
|
|
121
121
|
self.data = resolve_data(data, data_path)
|
|
122
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
123
|
+
#: kept so the chart can be written back to YAML.
|
|
124
|
+
self.data_path = data_path
|
|
122
125
|
self.label = label or "value"
|
|
123
126
|
self.fmt = fmt or Format(decimals=2)
|
|
124
127
|
self.legend = legend
|
{tesorotools_python-0.1.12 → tesorotools_python-0.1.13}/src/tesorotools/artists/line_plot.py
RENAMED
|
@@ -391,6 +391,9 @@ class LinePlot(FigureLifecycle):
|
|
|
391
391
|
)
|
|
392
392
|
self.out_path = out_path
|
|
393
393
|
self.data = resolve_data(data, data_path)
|
|
394
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
395
|
+
#: kept so the chart can be written back to YAML.
|
|
396
|
+
self.data_path = data_path
|
|
394
397
|
self.series = series
|
|
395
398
|
|
|
396
399
|
self.scale = scale
|
|
@@ -147,6 +147,9 @@ class MatrixChart(FigureLifecycle):
|
|
|
147
147
|
raise ValueError("MatrixChart needs at least one row and column")
|
|
148
148
|
self.out_path = out_path
|
|
149
149
|
self.data = resolve_data(data, data_path)
|
|
150
|
+
#: Feather the data came from (None: built from in-memory data);
|
|
151
|
+
#: kept so the chart can be written back to YAML.
|
|
152
|
+
self.data_path = data_path
|
|
150
153
|
self.rows = rows
|
|
151
154
|
self.cols = cols
|
|
152
155
|
self.cell_labels = cell_labels or {}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Spanish names of the chart kinds: the one table of the house vocabulary.
|
|
2
|
+
|
|
3
|
+
Every artist is registered under an English name (``line_plot``,
|
|
4
|
+
``barh``...). People and the MCP server ask for them in Spanish
|
|
5
|
+
(``lineas``, ``barras horizontales``), and a presentation can draw some
|
|
6
|
+
of them as an editable PowerPoint chart. This table holds the three
|
|
7
|
+
facts per kind, so that no consumer keeps its own copy:
|
|
8
|
+
|
|
9
|
+
* the Spanish names, the first one being the name to print;
|
|
10
|
+
* the name of the editable chart of :mod:`tesorotools.presentation.native`
|
|
11
|
+
that draws it, if any.
|
|
12
|
+
|
|
13
|
+
:func:`kind_from_name` reads a kind given either way (``Barras
|
|
14
|
+
horizontales``, ``barras-horizontales`` and ``barh`` are the same).
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import re
|
|
20
|
+
import unicodedata
|
|
21
|
+
from collections.abc import Iterable
|
|
22
|
+
from dataclasses import dataclass
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"KIND_NAMES",
|
|
26
|
+
"KindName",
|
|
27
|
+
"fold_name",
|
|
28
|
+
"kind_aliases",
|
|
29
|
+
"kind_from_name",
|
|
30
|
+
"native_kind",
|
|
31
|
+
"spanish_name",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(frozen=True)
|
|
36
|
+
class KindName:
|
|
37
|
+
"""The Spanish names of a chart kind and its editable chart.
|
|
38
|
+
|
|
39
|
+
*names* are folded (lower case, no accents, ``_`` between words);
|
|
40
|
+
the first one is the name to print. *native* is the
|
|
41
|
+
:data:`~tesorotools.presentation.native.NATIVE_KINDS` key of the
|
|
42
|
+
editable chart that draws the kind, or ``None``.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
names: tuple[str, ...]
|
|
46
|
+
native: str | None = None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
#: The Spanish names of every built-in kind, by its registry name.
|
|
50
|
+
KIND_NAMES: dict[str, KindName] = {
|
|
51
|
+
"line_plot": KindName(("lineas", "linea"), native="lineas"),
|
|
52
|
+
"stacked_area": KindName(("areas", "areas_apiladas", "area")),
|
|
53
|
+
"stacked_bar": KindName(("barras_apiladas", "barras", "columnas")),
|
|
54
|
+
"bar_line": KindName(
|
|
55
|
+
("barras_y_lineas", "barras_lineas", "barras_con_lineas")
|
|
56
|
+
),
|
|
57
|
+
"box_plot": KindName(("cajas", "caja", "cajas_y_bigotes", "bigotes")),
|
|
58
|
+
"barh": KindName(
|
|
59
|
+
("barras_horizontales", "barra_horizontal"),
|
|
60
|
+
native="barras_horizontales",
|
|
61
|
+
),
|
|
62
|
+
"grouped_barh": KindName(
|
|
63
|
+
("barras_horizontales_agrupadas", "barras_agrupadas"),
|
|
64
|
+
native="barras_horizontales",
|
|
65
|
+
),
|
|
66
|
+
"waterfall": KindName(("cascada",)),
|
|
67
|
+
"scatter": KindName(("dispersion", "puntos", "nube_de_puntos")),
|
|
68
|
+
"type_curve": KindName(("curva", "curva_de_tipos", "curva_tipos")),
|
|
69
|
+
"vector_plot": KindName(("vectores", "flechas")),
|
|
70
|
+
"matrix": KindName(("matriz", "mapa_de_calor")),
|
|
71
|
+
"sankey": KindName(("flujos", "diagrama_de_flujos")),
|
|
72
|
+
"shock_plot": KindName(("impactos", "choques", "perturbaciones")),
|
|
73
|
+
"intraday": KindName(("intradia",)),
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def fold_name(name: object) -> str:
|
|
78
|
+
"""*name* as the table spells it: lower case, no accents, ``_``.
|
|
79
|
+
|
|
80
|
+
``Barras horizontales`` and ``barras-horizontales`` both give
|
|
81
|
+
``barras_horizontales``.
|
|
82
|
+
"""
|
|
83
|
+
text = unicodedata.normalize("NFKD", str(name))
|
|
84
|
+
text = "".join(c for c in text if not unicodedata.combining(c))
|
|
85
|
+
return re.sub(r"[\s-]+", "_", text.lower().strip())
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def spanish_name(kind: str) -> str:
|
|
89
|
+
"""The Spanish name to print for *kind*; the kind itself if it has none."""
|
|
90
|
+
entry = KIND_NAMES.get(kind)
|
|
91
|
+
return entry.names[0] if entry else kind
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def native_kind(kind: str) -> str | None:
|
|
95
|
+
"""The editable chart that draws *kind* in a presentation, or ``None``."""
|
|
96
|
+
entry = KIND_NAMES.get(kind)
|
|
97
|
+
return entry.native if entry else None
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def kind_aliases(kinds: Iterable[str] | None = None) -> dict[str, str]:
|
|
101
|
+
"""Every Spanish name, mapped to its kind.
|
|
102
|
+
|
|
103
|
+
Only the names of *kinds* when given (the registered ones, say), so
|
|
104
|
+
that a name never points to a kind that cannot be drawn.
|
|
105
|
+
"""
|
|
106
|
+
wanted = set(KIND_NAMES if kinds is None else kinds)
|
|
107
|
+
return {
|
|
108
|
+
name: kind
|
|
109
|
+
for kind, entry in KIND_NAMES.items()
|
|
110
|
+
if kind in wanted
|
|
111
|
+
for name in entry.names
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def kind_from_name(name: object, kinds: Iterable[str] | None = None) -> str:
|
|
116
|
+
"""The kind of *name*, given in English or in Spanish.
|
|
117
|
+
|
|
118
|
+
*kinds* are the valid kinds (all those of the table by default; pass
|
|
119
|
+
the registry's to accept third-party artists by their own name).
|
|
120
|
+
Raises :class:`KeyError` when *name* is none of them.
|
|
121
|
+
"""
|
|
122
|
+
valid = list(KIND_NAMES if kinds is None else kinds)
|
|
123
|
+
key = fold_name(name)
|
|
124
|
+
if key in valid:
|
|
125
|
+
return key
|
|
126
|
+
aliases = kind_aliases(valid)
|
|
127
|
+
if key in aliases:
|
|
128
|
+
return aliases[key]
|
|
129
|
+
raise KeyError(f"unknown chart kind: {name!r}")
|