Skip to content
Myr

contributing.md

This file

Path

docs/contributing.md

179 lines · 5.5 KiB · Markdown

Last changed by

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

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

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

lines 40–42why, one step back
40With the repository cloned you can access its folder, set up the
41virtual environment, install the project requirements,42and then install HTTPX on edit mode:

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

line 43why, one step back
43

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

lines 44–50why, one step back
44```shell
45$ cd httpx46$ python3 -m venv venv47$ source venv/bin/activate48$ pip install -r test-requirements.txt49$ pip install -e .50```

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

line 51why, one step back
51

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

lines 52–54why, one step back
52!!! note
53 Feel free to replace this step with your development environment setup54 (pyenv, pipenv, virtualenvwrapper, docker, etc).

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

line 55why, one step back
55

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

lines 56–61why, one step back
56## Testing and Linting
5758We use [nox](https://nox.thea.codes/en/stable/) to automate testing, linting,59and documentation building workflow. Make sure you have it installed60at your system before starting.61

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

line 62why, one step back
62Install `nox` with:

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

line 63why, one step back
63

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

lines 64–67why, one step back
64```shell
65$ python3 -m pip install --user nox66```67

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

lines 68–69why, one step back
68Alternatively, use [pipx](https://github.com/pipxproject/pipx) if you prefer
69to keep it into an isolated environment:

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

lines 70–74why, one step back
70
71```shell72$ pipx install nox73```74

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

line 75why, one step back
75Now, with nox installed, run the complete pipeline with:

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

lines 76–83why, one step back
76
77```shell78$ nox79```8081!!! warning82 The test suite spawns a testing server at the port **8000**.83 Make sure this isn't being used, so the tests can run properly.

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

lines 84–104why, one step back
84
85To run the code auto-formatting separately:8687```shell88$ nox -s lint89```9091Also, if you need to run the tests only:9293```shell94$ nox -s test95```9697You can also run a single test script like this:9899```shell100$ nox -s test -- tests/test_multipart.py101```102103## Documenting104

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

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

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

line 106why, one step back
106

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

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

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

lines 108–109why, one step back
108
109```shell

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

line 110why, one step back
110$ nox -s serve

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

line 111why, one step back
111```

Document the release process (#363)Florimond Mancabefore adoption1275246

line 112why, one step back
112

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

lines 113–161why, one step back
113## Resolving Build / Travis Failures
114115Once you've submitted your pull request, the test suite will automatically run, and the results will show up in GitHub.116If the test suite fails, you'll want to click through to the "Details" link, and try to identify why the test suite failed.117118<p align="center" style="margin: 0 0 10px">119 <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/travis-fail.png" alt='Failing PR commit status'>120</p>121122Here are some common ways the test suite can fail:123124### NOX_SESSION=check Job Failed125126<p align="center" style="margin: 0 0 10px">127 <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/travis-fail-check.png" alt='Failing Travis lint job'>128</p>129130This job failing means there is either a code formatting issue or type-annotation issue.131You can look at the job output to figure out why it's failed or within a shell run:132133`nox -s check`134135It may be worth it to run `nox -s lint` to attempt auto-formatting the code136and if that job succeeds commit the changes.137138### NOX_SESSION=docs Job Failed139140This job failing means the documentation failed to build. This can happen for141a variety of reasons like invalid markdown or missing configuration within `mkdocs.yml`.142143### NOX_SESSION=test-3.X Job Failed144145<p align="center" style="margin: 0 0 10px">146 <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/travis-fail-test.png" alt='Failing Travis test job'>147</p>148149This job failing means the unit tests failed or not all code paths are covered by unit tests.150151If tests are failing you will see this message under the coverage report:152153`=== 1 failed, 435 passed, 1 skipped, 1 xfailed in 11.09s ===`154155If tests succeed but coverage isn't 100% you will see this message under the coverage report:156157`FAIL Required test coverage of 100% not reached. Total coverage: 99.00%`158159Look at the [coverage report from codecov](https://codecov.io/gh/encode/httpx/pulls)160for the pull request for help debugging coverage.161

Document the release process (#363)Florimond Mancabefore adoption1275246

lines 162–179why, one step back
162## Releasing
163164*This section is targeted at HTTPX maintainers.*165166Before releasing a new version, create a pull request that includes:167168- **An update to the changelog**:169 - We follow the format from [keepachangelog](https://keepachangelog.com/en/1.0.0/).170 - [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:171 - Things that **must** go in the changelog: added, changed, deprecated or removed features, and bug fixes.172 - Things that **should not** go in the changelog: changes to documentation, tests or tooling.173 - Try sorting entries in descending order of impact / importance.174 - Keep it concise and to-the-point. 🎯175- **A version bump**: see `__version__.py`.176177For an example, see [#362](https://github.com/encode/httpx/pull/362).178179Once the release PR is merged, run `$ scripts/publish` to publish the new release to PyPI.