-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
docs: Improve contributing docs #5708
Merged
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
48acd0f
docs: contributing doc: paste-able commands
juhoautio e654257
Comment about keeping docs in sync manually
juhoautio 9cbbc07
Local dev requires Python 3.8+
juhoautio 0a28e75
Split html comments to lines – does this fix hugo build?
juhoautio 2f617c2
Try to bring back contributing page as it disappeared :)
juhoautio be182a4
Capitalize: "Poetry"
juhoautio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<!-- The content of this file is manually kept in sync with docs/contributing.md. There are formatting differences because this file uses plain markdown. --> | ||
|
||
# Contributing to Poetry | ||
|
||
First off, thanks for taking the time to contribute! | ||
|
@@ -107,8 +109,8 @@ You will need Poetry to start contributing on the Poetry codebase. Refer to the | |
You will first need to clone the repository using `git` and place yourself in its directory: | ||
|
||
```bash | ||
$ git clone [email protected]:python-poetry/poetry.git | ||
$ cd poetry | ||
git clone [email protected]:python-poetry/poetry.git | ||
cd poetry | ||
``` | ||
|
||
> **Note:** We recommend that you use a personal [fork](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo) for this step. If you are new to GitHub collaboration, | ||
|
@@ -118,15 +120,15 @@ Now, you will need to install the required dependency for Poetry and be sure tha | |
tests are passing on your machine: | ||
|
||
```bash | ||
$ poetry install | ||
$ poetry run pytest tests/ | ||
poetry install | ||
poetry run pytest tests/ | ||
``` | ||
|
||
Poetry uses [mypy](https://github.com/python/mypy) for typechecking, and the CI | ||
will fail if it finds any errors. To run mypy locally: | ||
|
||
```bash | ||
$ poetry run mypy | ||
poetry run mypy | ||
``` | ||
|
||
Poetry uses the [black](https://github.com/psf/black) coding style and you must ensure that your | ||
|
@@ -139,13 +141,13 @@ To make sure that you don't accidentally commit code that does not follow the co | |
install a pre-commit hook that will check that everything is in order: | ||
|
||
```bash | ||
$ poetry run pre-commit install | ||
poetry run pre-commit install | ||
``` | ||
|
||
You can also run it anytime using: | ||
|
||
```bash | ||
$ poetry run pre-commit run --all-files | ||
poetry run pre-commit run --all-files | ||
``` | ||
|
||
Your code must always be accompanied by corresponding tests, if tests are not present your code | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<!-- The content of this file is manually kept in sync with ../CONTRIBUTING.md. There are formatting differences because this file uses Hugo templating. --> | ||
|
||
--- | ||
title: "Contributing to Poetry" | ||
draft: false | ||
|
@@ -122,8 +124,8 @@ You will need Poetry to start contributing on the Poetry codebase. Refer to the | |
You will first need to clone the repository using `git` and place yourself in its directory: | ||
|
||
```bash | ||
$ git clone [email protected]:python-poetry/poetry.git | ||
$ cd poetry | ||
git clone [email protected]:python-poetry/poetry.git | ||
cd poetry | ||
``` | ||
|
||
{{% note %}} | ||
|
@@ -135,15 +137,15 @@ Now, you will need to install the required dependency for Poetry and be sure tha | |
tests are passing on your machine: | ||
|
||
```bash | ||
$ poetry install | ||
$ poetry run pytest tests/ | ||
poetry install | ||
poetry run pytest tests/ | ||
``` | ||
|
||
Poetry uses [mypy](https://github.com/python/mypy) for typechecking, and the CI | ||
will fail if it finds any errors. To run mypy locally: | ||
|
||
```bash | ||
$ poetry run mypy | ||
poetry run mypy | ||
``` | ||
|
||
Poetry uses the [black](https://github.com/psf/black) coding style and you must ensure that your | ||
|
@@ -156,13 +158,13 @@ To make sure that you don't accidentally commit code that does not follow the co | |
install a pre-commit hook that will check that everything is in order: | ||
|
||
```bash | ||
$ poetry run pre-commit install | ||
poetry run pre-commit install | ||
``` | ||
|
||
You can also run it anytime using: | ||
|
||
```bash | ||
$ poetry run pre-commit run --all-files | ||
poetry run pre-commit run --all-files | ||
``` | ||
|
||
Your code must always be accompanied by corresponding tests, if tests are not present your code | ||
|
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.
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 could be mentioned:
But it would be good to know also how to build & view the docs locally. For example adding this comment here in a "hugo template file", I'm not sure how it's going to look like when it's live before the gh action has finished deploying the changes that I pushed.
I can see that workflows/docs.yml is for example cloning another repo, the
python-poetry/website
. But I'm wondering if there's any lightweight way to see the files from underdocs/
rendered locally.This is what I tried:
But not sure what to do, as I got this:
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.
You can clone the repo, use provided README file to set it up (granted, it's not the best manual, I am working on something better) and see it locally.
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!
I had to run
npm install
beforenpm run dev
– so that's missing from https://github.com/python-poetry/website#local-development. EDIT: I should try this again from scratch, but I don't think thatnpm run dev
is at least needed at all..I get this in the terminal:
Where can I view the docs?
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.
It should be in the
public/
folder as a pile of files -- that being said, note that the action requires someone to add theDocumentation
tag, and presently that has to be a member of the Poetry team. It's really meant as a way for the team to view the rendered docs without a local clone, as opposed to a way to give feedback to the PR author.We should focus on documenting how to build the website locally for this use case.
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.
I think I figured it out. Previously I was trying
poetry run python bin/website build --local ./poetry
which lead into some errors, and I ignored them – I shouldn't have :) Of course I didn't have./poetry
, I have../poetry
.So, this worked:
(btw:
-w, --watch watch filesystem for changes and recreate as needed (default true)
)And that answered my question about "Where can I view the docs?".
This seems to be needed to apply changes without restarting the Hugo server:
But I still need to manually run
poetry run python bin/website build --local ../poetry
to apply any changes, which is natural because there's a script that copies files from ../poetry/docs to content/docs/. Looks like the file contents are not changed at all so probably automatic live reloading can be achieved by symlinking, for example.I can volunteer to document this in the contributing docs if it helps, let me know.
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.
checkout latest update to
package.json
andnpm scripts
provided in website. you can now just runnpm run dev
and both npm and hugo will run. There is alsoMakefile
providing ready to use scripts for that. I don't see need for all this to be in Poetry contributing.md. Those are separate projects.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.
Could it be somehow documented how to test docs changes locally when contributing to poetry? If I understood correctly the website README instructions work out of the box only for the latest docs in poetry main branch, not my local poetry dev project.
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.
Related: python-poetry/website#48