Skip to content
Myr

contributing.md

This file

Path

docs/contributing.md

158 lines · 4.9 KiB · Markdown

Last changed by

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

History of this file

Take it

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

lines 1–2why, one step back
1# Contributing
2

Fix typos, spelling issues, and grammar in docs (#426)Kyle Galbraithbefore adoptionb65bce5

lines 3–4why, one step back
3Thank you for being interested in contributing to HTTPX.
4There are many ways you can contribute to the project:

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

line 5why, one step back
5

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 6–27why, one step back
6- Try HTTPX and [report bugs/issues you find](https://github.com/encode/httpx/issues/new)
7- [Implement new features](https://github.com/encode/httpx/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)8- [Review Pull Requests of others](https://github.com/encode/httpx/pulls)9- Write documentation10- Participate in discussions1112## Reporting Bugs or Other Issues1314Found something that HTTPX should support?15Stumbled upon some unexpected behavior?1617Feel free to open an issue at the18[issue tracker](https://github.com/encode/httpx/issues).19Try to be more descriptive as you can and in case of a bug report,20provide as much information as possible like:2122- OS platform23- Python version24- Installed dependencies and versions (`python -m pip freeze`)25- Code snippet26- Error traceback27

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

lines 28–29why, one step back
28## Development
29

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 30–31why, one step back
30To start developing HTTPX create a **fork** of the
31[HTTPX repository](https://github.com/encode/httpx) on GitHub.

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

lines 32–39why, one step back
32
33Then clone your fork with the following command replacing `YOUR-USERNAME` with34your GitHub username:3536```shell37$ git clone https://github.com/YOUR-USERNAME/httpx38```39

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 40why, one step back
40You can now install the project and its dependencies using:

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

line 41why, one step back
41

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 42–43why, one step back
42```shell
43$ cd httpx

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 44why, one step back
44$ scripts/install

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

line 45why, one step back
45```

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

line 46why, one step back
46

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 47–48why, one step back
47## Testing and Linting
48

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

lines 49–50why, one step back
49We use custom shell scripts to automate testing, linting,
50and documentation building workflow.

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

line 51why, one step back
51

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 52why, one step back
52To run the tests, use:

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

line 53why, one step back
53

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

line 54why, one step back
54```shell

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 55why, one step back
55$ scripts/test

Create a Contributing page in the documentation (#190)Humberto Rochabefore adoption079ab33

lines 56–58why, one step back
56```
5758!!! warning

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

lines 59–60why, one step back
59 The test suite spawns testing servers on ports **8000** and **8001**.
60 Make sure these are not in use, so the tests can run properly.

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

line 61why, one step back
61

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 62why, one step back
62You can run a single test script like this:

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 63–64why, one step back
63
64```shell

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 65why, one step back
65$ scripts/test -- tests/test_multipart.py

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 66–67why, one step back
66```
67

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 68why, one step back
68To run the code auto-formatting:

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 69–70why, one step back
69
70```shell

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 71why, one step back
71$ scripts/lint

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 72–73why, one step back
72```
73

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 74why, one step back
74Lastly, to run code checks separately (they are also run as part of `scripts/test`), run:

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 75–76why, one step back
75
76```shell

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 77why, one step back
77$ scripts/check

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 78–81why, one step back
78```
7980## Documenting81

Allow serving docs via nox (#450)Florimond Mancabefore adoption65b8593

line 82why, one step back
82Documentation pages are located under the `docs/` folder.

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

line 83why, one step back
83

Allow serving docs via nox (#450)Florimond Mancabefore adoption65b8593

line 84why, one step back
84To run the documentation site locally (useful for previewing changes), use:

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

lines 85–86why, one step back
85
86```shell

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 87why, one step back
87$ scripts/docs-serve

Add additional info to Contributing Guide (#213)Humberto Rochabefore adoption7156c36

line 88why, one step back
88```

Document the release process (#363)Florimond Mancabefore adoption1275246

line 89why, one step back
89

Add hints for debugging CI issues (#399)Seth Michael Larsonbefore adoptiona80c432

lines 90–100why, one step back
90## Resolving Build / Travis Failures
9192Once you've submitted your pull request, the test suite will automatically run, and the results will show up in GitHub.93If the test suite fails, you'll want to click through to the "Details" link, and try to identify why the test suite failed.9495<p align="center" style="margin: 0 0 10px">96 <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/travis-fail.png" alt='Failing PR commit status'>97</p>9899Here are some common ways the test suite can fail:100

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 101why, one step back
101### Check Job Failed

Add hints for debugging CI issues (#399)Seth Michael Larsonbefore adoptiona80c432

lines 102–109why, one step back
102
103<p align="center" style="margin: 0 0 10px">104 <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/travis-fail-check.png" alt='Failing Travis lint job'>105</p>106107This job failing means there is either a code formatting issue or type-annotation issue.108You can look at the job output to figure out why it's failed or within a shell run:109

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

lines 110–112why, one step back
110```shell
111$ scripts/check112```

Add hints for debugging CI issues (#399)Seth Michael Larsonbefore adoptiona80c432

line 113why, one step back
113

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 114why, one step back
114It may be worth it to run `$ scripts/lint` to attempt auto-formatting the code

Add hints for debugging CI issues (#399)Seth Michael Larsonbefore adoptiona80c432

lines 115–116why, one step back
115and if that job succeeds commit the changes.
116

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 117why, one step back
117### Docs Job Failed

Add hints for debugging CI issues (#399)Seth Michael Larsonbefore adoptiona80c432

lines 118–121why, one step back
118
119This job failing means the documentation failed to build. This can happen for120a variety of reasons like invalid markdown or missing configuration within `mkdocs.yml`.121

Drop nox in favor of vanilla scripts (#566)Florimond Mancabefore adoption8d55d78

line 122why, one step back
122### Python 3.X Job Failed

Add hints for debugging CI issues (#399)Seth Michael Larsonbefore adoptiona80c432

lines 123–140why, one step back
123
124<p align="center" style="margin: 0 0 10px">125 <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/travis-fail-test.png" alt='Failing Travis test job'>126</p>127128This job failing means the unit tests failed or not all code paths are covered by unit tests.129130If tests are failing you will see this message under the coverage report:131132`=== 1 failed, 435 passed, 1 skipped, 1 xfailed in 11.09s ===`133134If tests succeed but coverage isn't 100% you will see this message under the coverage report:135136`FAIL Required test coverage of 100% not reached. Total coverage: 99.00%`137138Look at the [coverage report from codecov](https://codecov.io/gh/encode/httpx/pulls)139for the pull request for help debugging coverage.140

Document the release process (#363)Florimond Mancabefore adoption1275246

lines 141–158why, one step back
141## Releasing
142143*This section is targeted at HTTPX maintainers.*144145Before releasing a new version, create a pull request that includes:146147- **An update to the changelog**:148 - We follow the format from [keepachangelog](https://keepachangelog.com/en/1.0.0/).149 - [Compare](https://github.com/encode/httpx/compare/) `master` with the tag of the latest release, and list all entries that are of interest to our users:150 - Things that **must** go in the changelog: added, changed, deprecated or removed features, and bug fixes.151 - Things that **should not** go in the changelog: changes to documentation, tests or tooling.152 - Try sorting entries in descending order of impact / importance.153 - Keep it concise and to-the-point. 🎯154- **A version bump**: see `__version__.py`.155156For an example, see [#362](https://github.com/encode/httpx/pull/362).157158Once the release PR is merged, run `$ scripts/publish` to publish the new release to PyPI.