Skip to content

Commit b2a04d5

Browse files
authored
Merge branch 'main' into ja
2 parents b336a4e + b8fd027 commit b2a04d5

12 files changed

+221
-19
lines changed

.gitignore

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,32 @@
1-
_build
2-
.vscode
3-
*/.ipynb_checkpoints/*
1+
# Vscode
2+
.vscode/
3+
4+
# Python
45
tmp/
56
.DS_Store
6-
.nox
7-
__pycache__
87
*notes-from-review.md
98
*.idea*
109
# Grammar / syntax checkers
1110
styles/
1211
# Exclude translation .mo files
1312
locales/*/LC_MESSAGES/*.mo
13+
14+
# Exclude Jupyter Notebook checkpoints
15+
.ipynb_checkpoints/
16+
*/.ipynb_checkpoints/*
17+
18+
# Exclude Python bytecode
19+
__pycache__/
20+
21+
# Exclude build directories
22+
_build/
23+
24+
# Exclude virtual environments
25+
venv/
26+
env/
27+
ENV/
28+
.venv/
29+
.ENV/
30+
*/venv/
31+
.nox
32+
*/.nox/

CONTRIBUTING.md

Lines changed: 196 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ The second approach is making your contribution directly in the GitHub website.
3232

3333
## Forking the repository
3434

35-
Independently of the approach you choose, the first step is to fork the Python Packaging Guide repository into your personal GitHub space. To "fork" a repository in GitHub means to create a copy of the main repository, or repo, that you have complete control over and can modify as you see fit.
35+
Independently of the approach you choose, the first step is to fork the Python Packaging Guide repository into your personal GitHub space.
36+
You can do this by clicking the "Fork" button in the top right corner of the repository page.
37+
38+
[Learn more: Fork and Clone GitHub Repos](https://datascienceskills.org/lessons/git-github/git-intro/3-fork-clone/) is a good resource to learn more about forking.
3639

3740
To fork a repo,
3841

@@ -44,59 +47,239 @@ To fork a repo,
4447

4548
<img width="395" alt="fork_repo" src="https://github.com/user-attachments/assets/949223fb-b58b-4b6d-85db-003bd117da46">
4649

50+
4751
## Contributing via the GitHub website
4852

4953
### How to edit a MarkDown file
5054

51-
*__TODO__: This section should show how to use the GitHub interface to edit and previewing a Markdown file.*
55+
The Python Packaging Guide is written in myST, a variant of MarkDown. You can edit the files directly in the GitHub website.
56+
To do so, navigate to the file you want to edit and click the pencil icon in the top right corner of the file.
57+
58+
```{figure} images/contributing/edit-button-pencil.png
59+
---
60+
name: edit-button-pencil in GitHub
61+
width: 80%
62+
alt: Edit button in GitHub
63+
---
64+
An image showing how to edit a file in GitHub. The pencil icon is highlighted with a red rectangle.
65+
66+
```{figure} images/contributing/edit-file.png
67+
---
68+
name: edit-file in GitHub
69+
width: 80%
70+
alt: Edit file in GitHub
71+
---
72+
An image showing when a file is being edited in GitHub. The file content is displayed in a text editor.
73+
```
74+
75+
To preview your changes, click the "Preview changes" tab.
76+
77+
```{figure} images/contributing/preview-changes.png
78+
---
79+
name: preview-changes in GitHub
80+
width: 80%
81+
alt: Preview changes in GitHub
82+
---
83+
An image showing how to preview changes in GitHub. The file content is displayed in a text editor. The preview changes tab is highlighted with a red rectangle.
84+
```
5285

5386
### How to commit your changes
5487

55-
*__TODO__: This section should show how to commit changes via the GitHub interface.*
88+
When you are done editing the file, scroll down to the bottom of the page. You will see a section called "Commit changes".
89+
Here you can write a title and a description for your changes. Make sure to write a clear and concise title that describes the changes you made.
90+
91+
```{figure} images/contributing/commit-changes.png
92+
---
93+
name: commit-changes in GitHub
94+
width: 80%
95+
alt: Commit changes in GitHub
96+
---
97+
An image showing how to commit changes in GitHub. The commit message is displayed in a text editor. The commit changes section is highlighted with a red rectangle.
98+
```
99+
100+
After writing your commit message, click the "Commit changes" button to save your changes.
56101

57102
## Contributing locally on your computer
58103

59104
### Clone your forked repository
60105

61-
*__TODO__: This section should show how to clone a repository from GitHub into your computer.*
106+
To clone your forked repository to your computer, you need to copy the URL of your forked repository and run the following command in your terminal:
107+
108+
```bash
109+
git clone <URL>
110+
```
111+
Replace `<URL>` with the URL of your forked repository. You can find the URL by clicking the green "Code" button on your forked repository page.
112+
113+
```{figure} images/contributing/clone-repository.png
114+
---
115+
name: clone-repository in GitHub
116+
width: 80%
117+
alt: Clone repository in GitHub
118+
---
119+
An image showing how to clone a repository in GitHub. The URL of the repository is displayed in a text editor. The code button is highlighted with a red rectangle.
120+
```
62121

63122
### Create a new branch
64123

65-
*__TODO__: This section should show how to create a new branch.*
124+
Before making any changes, you should create a new branch to work on. This will help keep your changes separate from the main branch and make it easier to submit a pull request.
125+
126+
To create a new branch, run the following command in your terminal:
127+
128+
```bash
129+
git checkout -b <branch-name>
130+
```
66131

67132
### Create a virtual environment
68133

69-
*__TODO__: This section should show how to create a virtual environment using venv.*
134+
To build the guide locally, you need to create a virtual environment and install the dependencies. You can do this by running the following commands in your terminal:
135+
136+
- **On Windows**:
137+
```bash
138+
python -m venv .venv
139+
.venv\Scripts\activate
140+
```
141+
142+
- **On MacOS and Linux**:
143+
```bash
144+
python -m venv .venv
145+
source .venv/bin/activate
146+
```
70147

71148
### Install the development dependencies
72149

73-
*__TODO__: This section should show how to install the development dependencies defined in pyproject.toml.*
150+
To install the development dependencies, run the following command in your terminal:
151+
152+
```bash
153+
python -m pip install -e .[dev]
154+
```
74155

75156
### Commit your changes
76157

77-
*__TODO__: This section should describe how to commit from the command line.*
158+
After making your changes, you need to commit them to your local repository. To do this, run the following commands in your terminal:
159+
160+
- To see the changes you made:
161+
```bash
162+
git status
163+
```
164+
- To add the changes to the staging area:
165+
```bash
166+
git add .
167+
```
168+
- To commit the changes:
169+
```bash
170+
git commit -m "Your commit message here"
171+
```
172+
Replace `"Your commit message here"` with a clear and concise message that describes the changes you made.
78173

79174
### How to build the guide locally
80175

81-
*__TODO__: This section should describe the different sessions in nox related to building the docs: docs, docs-test, docs-live. It should also show how to see the guide built locally, by opening the right file in the browser or using the live version from docs-live*
176+
To build the guide locally, you can use the `nox` command. This will run the default `nox` session, which builds the guide and opens it in your browser.
177+
178+
To see the different sessions available, you can run the following command in your terminal:
179+
180+
```bash
181+
nox --list-sessions
182+
```
183+
There are different sessions in nox related to building the docs: `docs`, `docs-test`, `docs-live`. You can run them by specifying the session name after the `nox` command.
184+
185+
- `docs`: this session builds the guide and opens it in your browser.
186+
```bash
187+
nox -e docs
188+
```
189+
To see the guide built locally, open the file `_build/html/index.html` in your browser.
190+
191+
- `docs-test`: this session runs the tests for the guide.
192+
```bash
193+
nox -e docs-test
194+
```
195+
If the tests fail, you will see an error message in your terminal. You need to fix the errors before submitting your pull request.
196+
197+
- `docs-live`: this session builds the guide and opens it in your browser with live reloading.
198+
```bash
199+
nox -e docs-live
200+
```
201+
open the local version of the guide in your browser at ``localhost`` shown in the terminal.
82202

83203
### Before you submit your pull request
84204

85-
*__TODO__: This section should describe what steps a user should follow before submitting the pull request: build the docs, verify your changes look correct, etc.*
205+
Before submitting your pull request, make sure to run the tests and check the formatting of your code.
206+
207+
```bash
208+
nox -e docs-test
209+
```
210+
If the tests fail, you will see an error message in your terminal. You need to fix the errors before submitting your pull request.
211+
Also make sure to check the formatting of your documentation by building the docs locally and checking that your changes look correct.
212+
86213

87214
## Submitting a pull request with your contribution
88215

89216
### How to make a pull request
90217

91-
*__TODO__: This section should describe how to make a pull request in GitHub.*
218+
1. To open a pull request on GitHub, navigate to the main page of your forked repository and click on the "Pull requests" tab.
219+
220+
```{figure} images/contributing/pull-requests-tab.png
221+
---
222+
name: pull-requests-tab in GitHub
223+
width: 80%
224+
alt: Pull requests tab in GitHub
225+
---
226+
An image showing how to navigate to the pull requests tab in GitHub. The pull requests tab is highlighted with a red rectangle.
227+
```
228+
229+
2. Click on the "New pull request" button.
230+
231+
```{figure} images/contributing/new-pull-request.png
232+
---
233+
name: new-pull-request in GitHub
234+
width: 80%
235+
alt: New pull request button in GitHub
236+
---
237+
An image showing how to create a new pull request in GitHub. The new pull request button is highlighted with a red rectangle.
238+
```
239+
240+
3. Write a clear and concise title and description for your pull request. Make sure to describe the changes you made and why they are necessary.
92241

93242
### What happens when you submit a pull request (CI/CD)
94243

95-
*__TODO__: This section should describe how to see the results of the CD/CI checks and how to get more information about errors*
244+
Once you submit a pull request, a series of checks will be run to ensure that your changes do not introduce any bugs or errors. These checks include:
245+
246+
- **Code formatting and styles**: checks that your code is formatted correctly, by `pre-commit.ci - pr check`.
247+
- **docs build**: checks that the documentation builds correctly, using `circleci`.
248+
249+
You will see the status of these checks in your pull request.
250+
251+
```{figure} images/contributing/pull-requests-checks.png
252+
---
253+
name: pull-requests-checks in GitHub
254+
width: 80%
255+
alt: Pull request checks in GitHub
256+
---
257+
An image showing the status of the checks in a pull request in GitHub. The checks are displayed in a table with a status icon next to each check. The checks are highlighted with a red rectangle.
258+
```
259+
If any of these checks fail, you will see an error message in your pull request. You need to fix the errors before your changes can be merged.
260+
261+
```{figure} images/contributing/pull-requests-checks-fails.png
262+
---
263+
name: pull-requests-checks-fails in GitHub
264+
width: 80%
265+
alt: Pull request checks failed in GitHub
266+
---
267+
An image showing the status of the checks in a pull request in GitHub. The checks are displayed in a table with a status icon next to each check. The checks that failed and the details link are highlighted with a red rectangle.
268+
```
269+
270+
To get more information about the errors, you can click on the "Details" link next to the failed check.
96271

97272
### What to expect from the review process
98273

99-
*__TODO__: This section should describe how review happens in GitHub, how see the comments, and how to submit changes (push a new branch)*
274+
Once you submit a pull request, a maintainer of the repository will review your changes and provide feedback. The review process may involve:
275+
276+
- **Comments**: the reviewer may leave comments on your pull request to ask questions or provide feedback.
277+
- **Suggestions**: the reviewer may suggest changes to your code or documentation.
278+
- **Approvals**: once the reviewer is satisfied with your changes, they will approve the pull request.
279+
280+
You can make changes to your pull request by pushing new commits to the branch. The pull request will be updated automatically with your new changes.
281+
282+
Once your pull request is approved, it will be merged into the main branch and your changes will be included in the guide.
100283

101284
## Additional help
102285

15 KB
Loading
26.6 KB
Loading
4.65 KB
Loading

images/contributing/edit-file.png

61 KB
Loading
6.26 KB
Loading
144 KB
Loading
Loading
22.3 KB
Loading
10.7 KB
Loading

tests/run-tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ We will focus on [Nox](https://nox.thea.codes/) in this guide. `nox` is a Python
122122
```{admonition} Other automation tools you'll see in the wild
123123
:class: note
124124
125-
- **[Tox](https://tox.wiki/en/latest/index.html#useful-links)** is an automation tool that supports common steps such as building documentation, running tests across various versions of Python, and more. You can find [a nice overview of tox in the plasmaPy documentation](https://docs.plasmapy.org/en/stable/contributing/testing_guide.html#using-tox).
125+
- **[Tox](https://tox.wiki/en/latest/index.html#useful-links)** is an automation tool that supports common steps such as building documentation, running tests across various versions of Python, and more.
126126
127127
- **[Hatch](https://github.com/ofek/hatch)** is a modern end-to-end packaging tool that works with the popular build backend called hatchling. `hatch` offers a `tox`-like setup where you can run tests locally using different Python versions. If you are using `hatch` to support your packaging workflow, you may want to also use its testing capabilities rather than using `nox`.
128128

0 commit comments

Comments
 (0)