Skip to content
Myr

CONTRIBUTING.rst

This file

Path

CONTRIBUTING.rst

218 lines · 6.3 KiB

Last changed by

update CONTRIBUTING.rstDavid Lordbefore adoption3bd7182

History of this file

Take it

The walk stopped after 200 commits: lines older than c3da861 point at it.

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

lines 1–3why, one step back
1How to contribute to Click
2==========================3

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 4why, one step back
4Thank you for considering contributing to Click!

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 5why, one step back
5

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 6why, one step back
6

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 7why, one step back
7Support questions

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 8why, one step back
8-----------------

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 9why, one step back
9

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 10–13why, one step back
10Please, don't use the issue tracker for this. The issue tracker is a
11tool to address bugs and feature requests in Click itself. Use one of12the following resources for questions about using Click or issues with13your own code:

Merge pull request #1198 from 1oglop1/masterDavid Lordbefore adoption76bfd87

line 14why, one step back
14

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 15–20why, one step back
15- The ``#get-help`` channel on our Discord chat:
16 https://discord.gg/t6rrQZH17- The mailing list flask@python.org for long term discussion or larger18 issues.19- Ask on `Stack Overflow`_. Search with Google first using:20 ``site:stackoverflow.com python click {search term, exception message, etc.}``

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 21why, one step back
21

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 22–24why, one step back
22.. _Stack Overflow: https://stackoverflow.com/questions/tagged/python-click?sort=linked
2324

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 25why, one step back
25Reporting issues

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 26why, one step back
26----------------

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 27why, one step back
27

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 28why, one step back
28Include the following information in your post:

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 29why, one step back
29

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 30–38why, one step back
30- Describe what you expected to happen.
31- If possible, include a `minimal reproducible example`_ to help us32 identify the issue. This also helps check that the issue is not with33 your own code.34- Describe what actually happened. Include the full traceback if there35 was an exception.36- List your Python and Click. If possible, check if this issue is37 already fixed in the latest releases or the latest code in the38 repository.

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 39why, one step back
39

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 40–42why, one step back
40.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example
4142

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 43why, one step back
43Submitting patches

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 44why, one step back
44------------------

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 45why, one step back
45

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 46–50why, one step back
46If there is not an open issue for what you want to submit, prefer
47opening one for discussion before working on a PR. You can work on any48issue that doesn't have an open PR linked to it or a maintainer assigned49to it. These show up in the sidebar. No need to ask if you can work on50an issue that interests you.

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 51why, one step back
51

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 52why, one step back
52Include the following in your patch:

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 53why, one step back
53

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 54–63why, one step back
54- Use `Black`_ to format your code. This and other tools will run
55 automatically if you install `pre-commit`_ using the instructions56 below.57- Include tests if your patch adds or changes code. Make sure the test58 fails without your patch.59- Update any relevant docs pages and docstrings. Docs pages and60 docstrings should be wrapped at 72 characters.61- Add an entry in ``CHANGES.rst``. Use the same style as other62 entries. Also include ``.. versionchanged::`` inline changelogs in63 relevant docstrings.

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 64why, one step back
64

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 65–66why, one step back
65.. _Black: https://black.readthedocs.io
66.. _pre-commit: https://pre-commit.com

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 67why, one step back
67

Merge branch '7.x'David Lordbefore adoptiona438322

line 68why, one step back
68

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 69–70why, one step back
69First time setup
70~~~~~~~~~~~~~~~~

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 71why, one step back
71

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 72–73why, one step back
72- Download and install the `latest version of git`_.
73- Configure git with your `username`_ and `email`_.

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 74why, one step back
74

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 75why, one step back
75 .. code-block:: text

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 76why, one step back
76

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 77–78why, one step back
77 $ git config --global user.name 'your name'
78 $ git config --global user.email 'your email'

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 79why, one step back
79

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 80–82why, one step back
80- Make sure you have a `GitHub account`_.
81- Fork Click to your GitHub account by clicking the `Fork`_ button.82- `Clone`_ the main repository locally.

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 83why, one step back
83

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 84why, one step back
84 .. code-block:: text

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 85why, one step back
85

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 86–87why, one step back
86 $ git clone https://github.com/pallets/click
87 $ cd click

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 88why, one step back
88

update contributing guide (#1584)David Lordbefore adoption9cfa961

line 89why, one step back
89- Add your fork as a remote to push your work to. Replace

update CONTRIBUTING.rstDavid Lordbefore adoption3bd7182

lines 90–91why, one step back
90 ``{username}`` with your username. This names the remote "fork", the
91 default Pallets remote is "origin".

Test 3.6Markus Unterwaditzerbefore adoptionc3da861

line 92why, one step back
92

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 93–109why, one step back
93 .. code-block:: text
9495 git remote add fork https://github.com/{username}/click9697- Create a virtualenv.9899 .. code-block:: text100101 $ python3 -m venv env102 $ . env/bin/activate103104 On Windows, activating is different.105106 .. code-block:: text107108 > env\Scripts\activate109

update CONTRIBUTING.rstDavid Lordbefore adoption3bd7182

lines 110–112why, one step back
110- Install the development dependencies, then install Click in editable
111 mode. This order is important, otherwise you'll get the wrong112 version of Click.

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 113–115why, one step back
113
114 .. code-block:: text115

update CONTRIBUTING.rstDavid Lordbefore adoption3bd7182

lines 116–117why, one step back
116 $ pip install -r requirements/dev.txt
117 $ pip install -e .

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 118–141why, one step back
118
119- Install the pre-commit hooks.120121 .. code-block:: text122123 $ pre-commit install124125.. _latest version of git: https://git-scm.com/downloads126.. _username: https://help.github.com/en/articles/setting-your-username-in-git127.. _email: https://help.github.com/en/articles/setting-your-commit-email-address-in-git128.. _GitHub account: https://github.com/join129.. _Fork: https://github.com/pallets/click/fork130.. _Clone: https://help.github.com/en/articles/fork-a-repo#step-2-create-a-local-clone-of-your-fork131132133Start coding134~~~~~~~~~~~~135136- Create a branch to identify the issue you would like to work on. If137 you're submitting a bug or documentation fix, branch off of the138 latest ".x" branch.139140 .. code-block:: text141

update CONTRIBUTING.rstDavid Lordbefore adoption3bd7182

line 142why, one step back
142 $ git fetch origin

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 143–149why, one step back
143 $ git checkout -b your-branch-name origin/7.x
144145 If you're submitting a feature addition or change, branch off of the146 "master" branch.147148 .. code-block:: text149

update CONTRIBUTING.rstDavid Lordbefore adoption3bd7182

line 150why, one step back
150 $ git fetch origin

update contributing guide (#1584)David Lordbefore adoption9cfa961

lines 151–218why, one step back
151 $ git checkout -b your-branch-name origin/master
152153- Using your favorite editor, make your changes,154 `committing as you go`_.155- Include tests that cover any code changes you make. Make sure the156 test fails without your patch. Run the tests as described below.157- Push your commits to your fork on GitHub and158 `create a pull request`_. Link to the issue being addressed with159 ``fixes #123`` in the pull request.160161 .. code-block:: text162163 $ git push --set-upstream fork your-branch-name164165.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes166.. _create a pull request: https://help.github.com/en/articles/creating-a-pull-request167168169Running the tests170~~~~~~~~~~~~~~~~~171172Run the basic test suite with pytest.173174.. code-block:: text175176 $ pytest177178This runs the tests for the current environment, which is usually179sufficient. CI will run the full suite when you submit your pull180request. You can run the full test suite with tox if you don't want to181wait.182183.. code-block:: text184185 $ tox186187188Running test coverage189~~~~~~~~~~~~~~~~~~~~~190191Generating a report of lines that do not have test coverage can indicate192where to start contributing. Run ``pytest`` using ``coverage`` and193generate a report.194195.. code-block:: text196197 $ pip install coverage198 $ coverage run -m pytest199 $ coverage html200201Open ``htmlcov/index.html`` in your browser to explore the report.202203Read more about `coverage <https://coverage.readthedocs.io>`__.204205206Building the docs207~~~~~~~~~~~~~~~~~208209Build the docs in the ``docs`` directory using Sphinx.210211.. code-block:: text212213 $ cd docs214 $ make html215216Open ``_build/html/index.html`` in your browser to view the docs.217218Read more about `Sphinx <https://www.sphinx-doc.org/en/stable/>`__.