Skip to content

Conversation

@llucax
Copy link
Contributor

@llucax llucax commented Aug 15, 2023

Also prepare for the v0.5.0 release.

  • Update repo-config version
  • Add support for linting code examples in docstrings
  • Add support for the part:pytest label
  • mkdocs: Ignore the top-level conftest module
  • Lint docstrings examples
  • Skip examples linting for __init__.py files
  • cookiecutter: Add a pytest hook to lint docstring examples
  • Add summary to release notes

Fixes #27.

@llucax llucax requested a review from a team as a code owner August 15, 2023 09:41
@llucax llucax requested a review from jack-herrmann August 15, 2023 09:41
@github-actions github-actions bot added the part:tests Affects the unit, integration and performance (benchmarks) tests label Aug 15, 2023
@llucax
Copy link
Contributor Author

llucax commented Aug 15, 2023

Put as draft because this is based on #114, but should be ready for a review.

@llucax llucax marked this pull request as draft August 15, 2023 09:42
@llucax llucax self-assigned this Aug 15, 2023
@llucax llucax requested a review from Marenz August 15, 2023 09:42
@llucax llucax added type:enhancement New feature or enhancement visitble to users part:nox Affects the configuration of nox part:cookiecutter Affects the generation of projects using cookiecutter part:pytest Affects the configuration of pytest labels Aug 15, 2023
@llucax llucax changed the title Add linting of code examples in *docstrings* Add linting of code examples in docstrings Aug 15, 2023
@github-actions github-actions bot removed part:cookiecutter Affects the generation of projects using cookiecutter part:nox Affects the configuration of nox labels Aug 15, 2023
llucax added 8 commits August 15, 2023 14:44
We are going to release v0.5.0 soon, so we bump the version in all the
documentation and cookiecutter generated files.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
This commit adds a module with an utility function to be able to easily
collect and lint code examples in docstrings.

It also add an optional dependency to easily pull the dependencies
needed to do this linting and ignores any optional dependency starting
with `extra-` in the tests checking if new repo types were added, as
optional dependencies starting with `extra-` are not really repository
types.

This is based on the work on the SDK:
frequenz-floss/frequenz-sdk-python#384

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
When generating documentation files from Python modules we now ignore
the `conftest` module, as it is just a hack and not really source code
for the project.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Use the new utility functions to lint the examples in the code
docstrings.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
This is because Sybil raises errors when trying to import those files,
see
frequenz-floss#113
for details.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Examples found in code *docstrings* in the `src/` directory will now be
collected and checked using `pylint`. This is done via the file
`src/conftest.py`, which hooks into `pytest`.

We also need to update the regex to use the current development version
of the package in the tests because now we also use the
`extra-lint-examples` optional dependency.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax marked this pull request as ready for review August 15, 2023 12:44
@llucax
Copy link
Contributor Author

llucax commented Aug 15, 2023

Rebased and ready for review. After this I will release v0.5.0 (I think this is the second time I say this, but this time I mean it!)

@llucax llucax enabled auto-merge August 15, 2023 12:49
@llucax llucax added this pull request to the merge queue Aug 15, 2023
Merged via the queue into frequenz-floss:v0.x.x with commit 85d85bf Aug 15, 2023
@llucax llucax deleted the lint-examples branch August 15, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:pytest Affects the configuration of pytest part:tests Affects the unit, integration and performance (benchmarks) tests type:enhancement New feature or enhancement visitble to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lint and test examples in examples and docstrings automatically

2 participants