Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autodoc to Autodoc2 #565

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,6 @@ ___*
.env/installed_pip_pkgs
.env/installed_spec.json
docs/_build
docs/gettsim_objects/apidocs
docs/tutorials/sandbox_cz.ipynb
_version.py
35 changes: 35 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"sphinx.ext.viewcode",
"sphinx_copybutton",
"myst_parser",
"autodoc2",
]

# The master toctree document.
Expand All @@ -59,8 +60,42 @@

# -- Extensions configuration ------------------------------------------------

myst_enable_extensions = ["fieldlist"]

add_module_names = False

autodoc2_packages = [
{
"path": "../src/_gettsim/social_insurance_contributions",
},
{
"path": "../src/_gettsim/taxes",
},
{
"path": "../src/_gettsim/transfers",
},
]

autodoc2_render_plugin = "myst"

autodoc2_output_dir = "gettsim_objects/apidocs"

autodoc2_index_template = """Policy functions in GETTSIM
===============================

This section documents the internal functions provided by GETTSIM to model the tax and
transfer system [#f1]_.

.. toctree::
:titlesonly:
:glob:
{% for package in top_level %}
{{ package }}
{%- endfor %}

.. [#f1] Created with `sphinx-autodoc2
<https://github.com/chrisjsewell/sphinx-autodoc2>`_'"""

autodoc_default_options = {
"members": True,
"private-members": True,
Expand Down
2 changes: 1 addition & 1 deletion docs/gettsim_objects/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This section documents the code inside GETTSIM.
maxdepth: 1
---
interface
functions
apidocs/index
input_variables
variables_out
params
Expand Down
8 changes: 2 additions & 6 deletions docs/gettsim_objects/interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@ This section provides the documentation of the two interface functions. If you w
have more information on how they work and how you can use them please see
{ref}`how_to_guides` and {ref}`tutorials`.

```{eval-rst}
.. currentmodule:: _gettsim.interface
```

```{eval-rst}
.. autofunction:: compute_taxes_and_transfers
```{autodoc2-object} _gettsim.interface.compute_taxes_and_transfers
render_plugin = "myst"
```

```{eval-rst}
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ dependencies:
- sphinx-copybutton
- toml
- pip:
- sphinx-autodoc2
- kaleido
- -e .
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ write_to = "src/_gettsim/_version.py"


[tool.ruff]
target-version = "py311" # Replace by [project] requires-python = ">=3.11" above
target-version = "py311"
fix = true
unsafe-fixes = false

Expand Down
Loading