-
Notifications
You must be signed in to change notification settings - Fork 8
Add linting of code examples in docstrings #115
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Put as draft because this is based on #114, but should be ready for a review. |
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>
|
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!) |
Marenz
approved these changes
Aug 15, 2023
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Also prepare for the v0.5.0 release.
part:pytestlabelconftestmodule__init__.pyfilespytesthook to lint docstring examplesFixes #27.