@@ -15,10 +15,10 @@ If you are interested in setting up a similar project, consider the template
1515
1616## Local development
1717
18- This project uses [ black ] ( https://github.com/psf/black ) to format code and
18+ This project uses [ ruff ] ( https://github.com/astral-sh/ruff ) to lint and format code and
1919[ pre-commit] ( https://pre-commit.com/ ) to invoke it as a git pre-commit hook.
20- Consider installing any of [ black 's IDE
21- integrations] ( https://black.readthedocs.io/en/stable/integrations/editors.html )
20+ Consider installing any of [ ruff 's IDE
21+ integrations] ( https://docs.astral.sh/ruff/editors/setup/ )
2222to make your life easier.
2323
2424Run the following to set up the pre-commit git hook to run before pushes:
@@ -83,7 +83,7 @@ If you use remote execution, don't forget to exclude data paths from deployment
8383## Testing
8484
8585Automated builds, tests, generation of documentation and publishing are handled
86- by [ CI pipelines] ( #CI ) . Before pushing your changes to the remote we recommend
86+ by [ CI pipelines] ( #ci ) . Before pushing your changes to the remote we recommend
8787to execute ` tox ` locally in order to detect mistakes early on and to avoid
8888failing pipelines. tox will:
8989* run the test suite
@@ -92,7 +92,7 @@ failing pipelines. tox will:
9292* generate coverage reports in html, as well as badges.
9393
9494You can configure pytest, coverage and ruff by adjusting
95- [ pyproject.toml] ( pyproject.toml ) .
95+ [ pyproject.toml] ( https://github.com/aai-institute/pyDVL/blob/develop/ pyproject.toml) .
9696
9797Besides the usual unit tests, most algorithms are tested using pytest. This
9898requires ray for the parallelization and Memcached for caching. Please install
@@ -132,11 +132,11 @@ There are a few important arguments:
132132 of slow tests.
133133
134134- ` --with-cuda ` sets the device fixture in [ tests/influence/torch/conftest.py] (
135- tests/influence/torch/conftest.py) to ` cuda ` if it is available.
136- Using this fixture within tests, you can run parts of your tests on a ` cuda `
137- device. Be aware, that you still have to take care of the usage of the device
138- manually in a specific test. Setting this flag does not result in
139- running all tests on a GPU.
135+ https://github.com/aai-institute/pyDVL/blob/develop/ tests/influence/torch/conftest.py )
136+ to ` cuda ` if it is available. Using this fixture within tests, you can run parts
137+ of your tests on a ` cuda ` device. Be aware, that you still have to take care of
138+ the usage of the device manually in a specific test. Setting this flag does not
139+ result in running all tests on a GPU.
140140
141141### Markers
142142
@@ -297,6 +297,33 @@ the environment variable `DYLD_FALLBACK_LIBRARY_PATH`:
297297export DYLD_FALLBACK_LIBRARY_PATH=$DYLD_FALLBACK_LIBRARY_PATH :/opt/homebrew/lib
298298```
299299
300+ ### Automatic API documentation
301+
302+ We use [ mkdocstrings] ( https://mkdocstrings.github.io/ ) to automatically generate
303+ API documentation from docstrings, following almost verbatim [ this
304+ recipe] ( https://mkdocstrings.github.io/recipes/#automatic-code-reference-pages ) :
305+ Stubs are generated for all modules on the fly using
306+ [ generate_api_docs.py] ( https://github.com/aai-institute/pyDVL/blob/develop/build_scripts/generate_api_docs.py ) thanks to the pluging
307+ [ mkdocstrings-gen-files] ( https://github.com/oprypin/mkdocs-gen-files ) and
308+ navigation is generated for
309+ [ mkdocs-literate-nav] ( https://github.com/oprypin/mkdocs-literate-nav ) .
310+
311+ With some renaming and using
312+ [ section-index] ( https://github.com/oprypin/mkdocs-section-index ) ` __init__.py `
313+ files are used as entry points for the documentation of a module.
314+
315+ Since very often we re-export symbols in the ` __init__.py ` files, the automatic
316+ generation of the documentation skips ** all** symbols in those files. If you
317+ want to document any in particular you can do so by ** overriding
318+ mkdocs_genfiles** : Create a file under ` docs/api/pydvl/module/index.md ` and add
319+ your documentation there. For example, to document the whole module and every
320+ (re-)exported symbol just add this to the file:
321+
322+ ``` markdown
323+ ::: pydvl.module
324+ ```
325+
326+
300327### Adding new pages
301328
302329Navigation is configured in ` mkdocs.yaml ` using the nav section. We use the
@@ -384,7 +411,8 @@ library](https://www.zotero.org/groups/2703043/transferlab/library). All other
384411contributors just add the bibtex data, and a maintainer will add it to the group
385412library upon merging.
386413
387- To add a citation inside a markdown file, use the notation ` [@citekey] ` . Alas,
414+ To add a citation inside a markdown file, use the notation ` [@ citekey] ` (with
415+ no space). Alas,
388416because of when mkdocs-bibtex enters the pipeline, it won't process docstrings.
389417For module documentation, we manually inject html into the markdown files. For
390418example, in ` pydvl.value.shapley.montecarlo ` we have:
@@ -440,7 +468,7 @@ use braces for legibility like in the first example.
440468### Abbreviations
441469
442470We keep the abbreviations used in the documentation inside the
443- [ docs_include/abbreviations.md] ( docs_includes%2Fabbreviations .md ) file.
471+ [ docs_include/abbreviations.md] ( https://github.com/aai-institute/pyDVL/blob/develop/ docs_includes/abbreviations .md) file.
444472
445473The syntax for abbreviations is:
446474
@@ -569,7 +597,7 @@ act -j lint
569597act --artifact-server-path /tmp/artifacts
570598
571599# Run a job in a specific workflow (useful if you have duplicate job names)
572- act -j lint -W .github/workflows/tox .yml
600+ act -j lint -W .github/workflows/publish .yml
573601
574602# Run in dry-run mode:
575603act -n
@@ -727,9 +755,10 @@ PYPI_PASSWORD
727755The first 2 are used after tests run on the develop branch' s CI workflow
728756to automatically publish packages to [TestPyPI](https://test.pypi.org/).
729757
730- The last 2 are used in the [publish.yaml](.github/workflows/publish.yaml) CI
731- workflow to publish packages to [PyPI](https://pypi.org/) from `develop` after
732- a GitHub release.
758+ The last 2 are used in the
759+ [publish.yaml](https://github.com/aai-institute/pyDVL/blob/develop/.github/workflows/publish.yaml)
760+ CI workflow to publish packages to [PyPI](https://pypi.org/) from `develop`
761+ after a GitHub release.
733762
734763#### Publish to TestPyPI
735764
@@ -738,6 +767,5 @@ the build part of the version number without commiting or tagging the change
738767and then publish a package to TestPyPI from CI using Twine. The version
739768has the GitHub run number appended.
740769
741- For more details refer to the files
742- [.github/workflows/publish.yaml](.github/workflows/publish.yaml) and
743- [.github/workflows/tox.yaml](.github/workflows/tox.yaml).
770+ For more details refer to the file
771+ [.github/workflows/publish.yaml](https://github.com/aai-institute/pyDVL/blob/develop/.github/workflows/publish.yaml).
0 commit comments