Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 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
18 changes: 10 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,25 @@ jobs:
echo "source /tmp/venv/openfisca_doc/bin/activate" >> $BASH_ENV

- run:
name: Install app dependencies
command: |
pip install --upgrade pip
pip install -r requirements.txt --use-deprecated=legacy-resolver
name: Install doc dependencies
command: make install

- save_cache:
key: dependency-cache-{{ checksum "requirements.txt" }}
paths:
- /tmp/venv/openfisca_doc

- run:
name: Build app
command: make html
name: Test doc
command: make test

- run:
name: Build doc
command: make build

- run:
name: Run app
command: python -m http.server 8000 --directory build/html
name: Serve doc
command: make prod
background: true

- run:
Expand Down
26 changes: 22 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,29 @@ help:

.PHONY: help Makefile

# Install doc dependencies.
install:
@pip install --upgrade pip
@pip install -r requirements.txt --use-deprecated=legacy-resolver

# Build the doc.
build:
@${MAKE} html

# Test the doc.
test:
@${MAKE} dummy SPHINXOPTS="-n -q -W"

# Serve the documentation in dev mode.
dev:
@rm -Rf $(BUILDDIR)
@sphinx-autobuild $(SOURCEDIR) $(BUILDDIR)

# Serve the documentation in prod mode.
prod:
@python -m http.server 8000 --directory build/html

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

dev:
rm -Rf $(BUILDDIR)
sphinx-autobuild $(SOURCEDIR) $(BUILDDIR)
54 changes: 52 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
To install dependencies, run:

```
pip install -r requirements.txt --use-deprecated=legacy-resolver
make install
```

## Build

To build the HTML documentation, run:

```
make html
make build
```

The HTML output will be generated in the `build/html` directory.
Expand All @@ -30,6 +30,56 @@ make dev

The documentation will be served on `http://127.0.0.1:8000`

## Test

To test the documentation, run:

```
make test
```

## Fixing the doc

If the tests fail, here's what you can do:

1. If the errors also concern OpenFisca-Core, please take a look at the [README](https://github.com/openfisca/openfisca-core/blob/master/README.md).

2. If not, clone & install the documentation:

```
git clone https://github.com/openfisca/openfisca-doc
make install
```

3. create a branch to correct the problems:

```
git checkout -b fix-doc
```

4. Fix the offending problems.

You can test-drive your fixes by checking that each change works as expected:

```
make test
```

5. Commit at each step, so you don't accidentally lose your progress:

```
git add -A && git commit -m "Fixed missing doctree"
```

6. Once you're done, push your changes:

```
git push origin `git branch --show-current`
```

7. Finally, open a [pull request](https://github.com/openfisca/openfisca-doc/compare/master...fix-doc).

That's it! 🙌

## Technical note on links

Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--editable git+https://github.com/openfisca/openfisca-core.git@master#egg=OpenFisca-Core[dev]
docutils==0.12
docutils==0.13.1
guzzle_sphinx_theme==0.7.11
recommonmark==0.4
sphinx-autobuild==0.7.1
sphinx-markdown-tables==0.0.9
Sphinx==1.5
Sphinx==1.5.1
sphinx_argparse==0.2.5
5 changes: 5 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@
'sphinxarg.ext',
]

intersphinx_mapping = {
"numpy": ("https://numpy.org/doc/stable/", None),
"python": ("https://docs.python.org/3/", None),
}

source_parsers = {
'.md': CommonMarkParser,
}
Expand Down
8 changes: 8 additions & 0 deletions source/openfisca-python-api/errors.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
======
Errors
======

.. module:: openfisca_core.errors

.. autoclass:: VariableNameConflictError
:members:
4 changes: 3 additions & 1 deletion source/openfisca-python-api/holder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
Holders
=======

.. automodule:: openfisca_core.holders
.. module:: openfisca_core.holders

.. autoclass:: Holder
:members:
2 changes: 2 additions & 0 deletions source/openfisca-python-api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ Modules:
enum_array
holder
simulation_generator
periods
errors
```

Scripts:
Expand Down
13 changes: 12 additions & 1 deletion source/openfisca-python-api/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,16 @@
Parameters
==========

.. automodule:: openfisca_core.parameters
.. module:: openfisca_core.parameters

.. autoclass:: ParameterNodeAtInstant
:members:

.. autoclass:: ParameterNode
:members:

.. autoclass:: Parameter
:members:

.. autoclass:: ParameterScale
:members:
8 changes: 8 additions & 0 deletions source/openfisca-python-api/periods.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=======
Periods
=======

.. module:: openfisca_core.periods

.. autoclass:: Instant
:members:
4 changes: 3 additions & 1 deletion source/openfisca-python-api/simulations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
Simulation
==========

.. autoclass:: openfisca_core.simulations.Simulation
.. module:: openfisca_core.simulations

.. autoclass:: Simulation
:members: calculate, get_array, get_holder, get_memory_usage
4 changes: 3 additions & 1 deletion source/openfisca-python-api/tax-benefit-system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
TaxBenefitSystem
=================

.. automodule:: openfisca_core.taxbenefitsystems
.. module:: openfisca_core.taxbenefitsystems

.. autoclass:: TaxBenefitSystem
:members:
7 changes: 6 additions & 1 deletion source/openfisca-python-api/variables.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
Variables
=========

.. automodule:: openfisca_core.variables
.. module:: openfisca_core.variables

.. autoclass:: Variable
:members:

.. automodule:: openfisca_core.variables.typing
:members: