-
Notifications
You must be signed in to change notification settings - Fork 16
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
Documentation page: mkdocs & GitHub pages #449
base: main
Are you sure you want to change the base?
Conversation
82f046d
to
4932a58
Compare
Add mkdocs as a documentation framework for FawltyDeps. Update dependencies with a new `docs` dependencies group. Add material-mkdocs.
6c410db
to
ce7a0ab
Compare
b7f16d5
to
dfb1799
Compare
Create content for the documentation page
5870a05
to
d218819
Compare
Content of README should be shorter. Information suplocated in `docs` is removed.
d218819
to
a7e8e0e
Compare
Add a github action to build and deploy documentation to the GriHub pages.
…itHub rather than internally to the code.
a7e8e0e
to
a23d59c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big review, lots of comments, but don't be discouraged! I love the look of the docs website, and I'm happy to help in any way I can to get this merged! ❤️
|
||
To solve this, FawltyDeps uses a sequence of resolvers (aka. mapping strategies) | ||
to determine which Python packages provide which import names. For more details, | ||
check [FawltyDeps mapping strategy blogpost](https://www.tweag.io/blog/2023-09-21-fawltydeps-mapping-strategy/). The diagram below |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check [FawltyDeps mapping strategy blogpost](https://www.tweag.io/blog/2023-09-21-fawltydeps-mapping-strategy/). The diagram below | |
check the [FawltyDeps mapping strategy blog post](https://www.tweag.io/blog/2023-09-21-fawltydeps-mapping-strategy/). The diagram below |
|
||
markdown_extensions: | ||
- toc: | ||
permalink: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: missing trailing newline
- Support all current Python versions: that means all Python versions that have | ||
a stable release, and are not yet End Of Life. Currently this is: v3.7 - v3.11. | ||
a stable release, and are not yet End Of Life. Currently this is: v3.8 - v3.13. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for updating this part. I think it should be updated to reflect that v3.8 is actually EOL, but we still intend to support it for now:
- Support all current Python versions: that means [all Python versions that have
a stable release, and are not yet End Of Life](https://devguide.python.org/versions/).
- We also try to support older (EOL-ed) Python versions, when doing so is not too expensive.
- Currently we support running on Python v3.8 - v3.13.
- Since we no longer rely on running inside the same Python environment as the project being
analyzed, it is possible for us to support analyzing projects running on even older Python versions.
More generally, this file is starting to show its age (e.g. the sentence about Windows below), and would benefit from another pass to make it more up-to-date (not in this PR! 😅).
docs/images/fd_dependencies.png
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.github/workflows/docs.yaml
Outdated
restore-keys: | | ||
mkdocs-material- | ||
- run: pip install mkdocs-material | ||
- run: mkdocs gh-deploy --force |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: missing trailing newline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? Does the same apply to the previous with
key?
git config user.name github-actions[bot] | ||
git config user.email 41898282+github-actions[bot]@users.noreply.github.com |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very hard-coded. Where is this identity coming from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to have a unique GitHub bot identity that does the commits.
We could use something like:
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
But that means that the person who merged the PR to the main branch will be markes as the author of the commit for the docs branch.
We could also go a bit simpler, not marking the particular bot, but to say that we use a bot to generate this commit:
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
What do you think would be best?
.github/workflows/docs.yaml
Outdated
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV | ||
- uses: actions/cache@v4 | ||
with: | ||
key: mkdocs-material-${{ env.cache_id }} | ||
path: .cache | ||
restore-keys: | | ||
mkdocs-material- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what's going on here, the date --utc '+%V'
prints the current week number, IIUC. Why is this appropriate as a cache key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole GitHub action is based on the mkdocs (Publishing your site)[https://squidfunk.github.io/mkdocs-material/publishing-your-site/#with-github-actions] guide. If you have some other idea for the cache key, we can change the current one.
# Documentation | ||
site/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default location used by mkdocs, I assume? I don't see site/
referenced anywhere else in these changes...
.github/workflows/docs.yaml
Outdated
- run: pip install mkdocs-material | ||
- run: mkdocs gh-deploy --force |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, this should used the docs
dependency group that you added to pyproject.toml
? And even more ideally (and I can easily do this in a separate PR), we should wrap this is a Nox action, so that we can easily generate the docs locally too?
Rewrite front page of the documentation as per @jherland's suggestion Co-authored-by: Johan Herland <[email protected]>
In this PR, a documentation page using mkdocs and deployed on GitHub pages is added.
Documentation content
Documentation page is based on the content available in the current README.md file. The content is split and grouped according to diataxis principles to provide explanations, usage guide and FAQs for FawltyDeps.
To build documentation, mkdocs with mkdocs-material are used due to simplicity and wide support.
Deployment
Documentation page is deployed on GitHub pages (see Settings -> Pages) and is using the content of gh-pages branch.
Content of gh-pages is automatically created with GitHub Action, following the documentation of mkdocs-material.
Local tests
First, install docs dependencies:
Then build and serve locally: