-
Notifications
You must be signed in to change notification settings - Fork 3
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
WIP: Read the docs #90
Draft
ross-spencer
wants to merge
18
commits into
main
Choose a base branch
from
dev/issue-33-docstrings-and-documentation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
This commit adds module-wide `app_instance` fixtures which are used to provide application context to tests under the Application Factory pattern, as well as a test that demonstrates how to test database state using our test config with in-memory test database. Due to how pytest discovers fixtures, removing the duplication of the fixtures as defined in conftest modules would require re-organizing our tests into a single AIPscan.tests directory.
This commit adds the application context to tests via the app_instance fixture so that it's not necessary to do so explicitly within tests and adds some post-test cleanup.
This commit replaces Blueprint-specific conftest modules with a single one that can be used across the project. It also makes use of the app.app_context context manager so that we do not need to push and pop the app context manually.
This commit moves the Application Factory into AIPscan's __init__ module. This seems to be common practice, reduces the number of new modules added in this work, and provides the potential down the line to call the Application Factory directly from gunicorn without the need for a wsgi.py entrypoint should we choose to do so.
NB. This is a hammer-nail solution, we'll want to take this a different direction, e.g. inheriting from base requirements first, and adding dev reqs on-top, before merging.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit is starting to create a framework for creating the necessary documentation for both developers, and users. I wanted to explore what we can do with standard tooling which we use in other projects, and share some of that learning with the team, although they may already have this know-how so it might just be for myself.
Connected to #33 which might be developed out of this effort, but it might be better suited under a documentation effort.
To preview:
docs/_build/html
directory in your favorite flavor of web-browser.To use:
pip install -r requirements/dev.txt
Makefile
in thedocs
folder, e.g.make html
once changes have been made to code.How I created this documentation so far:
unless other values were needed.
and projects like a3m and mets-reader-writer for which we already have some
documentation.
sphinx-apidoc -o ../docs ../AIPscan
recreated (source control). And we can add links to other modules and also
annotate some of the bits and pieces that we want to drape people's
attention to.
make html.
TODO:
Where this takes us...
Python doesn't seem to be as well suited to this as other languages, i.e. it's not as integrated, and
pydoc
can be a tad flaky, but one nice impact of documentation from code, like this, and why it is connected to #33 is that we can improve the quality and consistency of our docstrings by inspecting them through the docs.For example:
An example of a simple module summary using a module docstring:
An example of nice function level documentation from Tessa:
A much more basic one from myself, which might not be the style we adopt moving forward:
We can become more fluent with how we format our docstrings which we use to decorate our code. One small example based on Tessa's approach might be to then add pre-formatted text for code within strings, e.g. for the
dict
reference, and how thedict
is used, e.g.somedict[
somevalue]
.