update contributing guide (#1584)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Lord · committed by GitHub · parent 76f376c · Browse files · 1 file·+185 added−39 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+185 added−39 removed
- other:+185 added−39 removed
Provenance
- Commit
9cfa961- Tree
16356f0- Author
David Lord <davidism@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
76f376c
1 file changed+185 added−39 removed
modified:CONTRIBUTING.rst+185 added-39 removed
1-==========================1 How to contribute to Click2 ==========================3 5-Thanks for considering contributing to Click.4+Thank you for considering contributing to Click!5 6+7 Support questions8-=================8+-----------------9 10-Please, don't use the issue tracker for this. Check whether the11-``#pocoo`` IRC channel on Freenode can help with your issue. If your problem12-is not strictly Click-specific, ``#python`` on Freenode is generally more13-active. Also try searching or asking on `Stack Overflow`_ with the14-``python-click`` tag.10+Please, don't use the issue tracker for this. The issue tracker is a11+tool to address bugs and feature requests in Click itself. Use one of12+the following resources for questions about using Click or issues with13+your own code:14 16-.. _Stack Overflow: https://stackoverflow.com/questions/tagged/python-click?sort=votes15+- 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.}``21 22+.. _Stack Overflow: https://stackoverflow.com/questions/tagged/python-click?sort=linked23+24+25 Reporting issues19-================26+----------------27 21-- Under which versions of Python does this happen? This is even more important22- if your issue is encoding related.28+Include the following information in your post:29 24-- Under which versions of Click does this happen? Check if this issue is fixed25- in the repository.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.39 40+.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example41+42+43 Submitting patches28-==================44+------------------45 30-- Include tests if your patch is supposed to solve a bug, and explain clearly31- under which circumstances the bug happens. Make sure the test fails without32- your patch.46+If there is not an open issue for what you want to submit, prefer47+opening one for discussion before working on a PR. You can work on any48+issue that doesn't have an open PR linked to it or a maintainer assigned49+to it. These show up in the sidebar. No need to ask if you can work on50+an issue that interests you.51 34-- Try to follow `PEP8 <http://legacy.python.org/dev/peps/pep-0008/>`_, but you35- may ignore the line-length-limit if following it would make the code uglier.52+Include the following in your patch:53 37-- For features: Consider whether your feature would be a better fit for an38- `external package <https://click.palletsprojects.com/en/7.x/contrib/>`_54+- Use `Black`_ to format your code. This and other tools will run55+ 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.64 40-- For docs and bug fixes: Submit against the latest maintenance branch instead of master!65+.. _Black: https://black.readthedocs.io66+.. _pre-commit: https://pre-commit.com67 42-- Non docs or text related changes need an entry in ``CHANGES.rst``,43- and ``.. versionadded`` or ``.. versionchanged`` markers in the docs.68 45-Running the testsuite46----------------------69+First time setup70+~~~~~~~~~~~~~~~~71 48-You probably want to set up a `virtualenv49-<https://virtualenv.readthedocs.io/en/latest/index.html>`_.72+- Download and install the `latest version of git`_.73+- Configure git with your `username`_ and `email`_.74 51-The minimal requirement for running the testsuite is ``py.test``. You can52-install it with::75+ .. code-block:: text76 54- pip install pytest77+ $ git config --global user.name 'your name'78+ $ git config --global user.email 'your email'79 56-Then you can run the testsuite with::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.83 58- py.test84+ .. code-block:: text85 60-For a more isolated test environment, you can also install ``tox`` instead of61-``pytest``. You can install it with::86+ $ git clone https://github.com/pallets/click87+ $ cd click88 63- pip install tox89+- Add your fork as a remote to push your work to. Replace90+ ``{username}`` with your username.91 65-The ``tox`` command will then run all tests against multiple combinations of66-Python versions and dependency versions.92+ .. code-block:: text93+94+ git remote add fork https://github.com/{username}/click95+96+- Create a virtualenv.97+98+ .. code-block:: text99+100+ $ python3 -m venv env101+ $ . env/bin/activate102+103+ On Windows, activating is different.104+105+ .. code-block:: text106+107+ > env\Scripts\activate108+109+- Install Click in editable mode with development dependencies.110+111+ .. code-block:: text112+113+ $ pip install -e . -r requirements/dev.txt114+115+- Install the pre-commit hooks.116+117+ .. code-block:: text118+119+ $ pre-commit install120+121+.. _latest version of git: https://git-scm.com/downloads122+.. _username: https://help.github.com/en/articles/setting-your-username-in-git123+.. _email: https://help.github.com/en/articles/setting-your-commit-email-address-in-git124+.. _GitHub account: https://github.com/join125+.. _Fork: https://github.com/pallets/click/fork126+.. _Clone: https://help.github.com/en/articles/fork-a-repo#step-2-create-a-local-clone-of-your-fork127+128+129+Start coding130+~~~~~~~~~~~~131+132+- Create a branch to identify the issue you would like to work on. If133+ you're submitting a bug or documentation fix, branch off of the134+ latest ".x" branch.135+136+ .. code-block:: text137+138+ $ git checkout -b your-branch-name origin/7.x139+140+ If you're submitting a feature addition or change, branch off of the141+ "master" branch.142+143+ .. code-block:: text144+145+ $ git checkout -b your-branch-name origin/master146+147+- Using your favorite editor, make your changes,148+ `committing as you go`_.149+- Include tests that cover any code changes you make. Make sure the150+ test fails without your patch. Run the tests as described below.151+- Push your commits to your fork on GitHub and152+ `create a pull request`_. Link to the issue being addressed with153+ ``fixes #123`` in the pull request.154+155+ .. code-block:: text156+157+ $ git push --set-upstream fork your-branch-name158+159+.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes160+.. _create a pull request: https://help.github.com/en/articles/creating-a-pull-request161+162+163+Running the tests164+~~~~~~~~~~~~~~~~~165+166+Run the basic test suite with pytest.167+168+.. code-block:: text169+170+ $ pytest171+172+This runs the tests for the current environment, which is usually173+sufficient. CI will run the full suite when you submit your pull174+request. You can run the full test suite with tox if you don't want to175+wait.176+177+.. code-block:: text178+179+ $ tox180+181+182+Running test coverage183+~~~~~~~~~~~~~~~~~~~~~184+185+Generating a report of lines that do not have test coverage can indicate186+where to start contributing. Run ``pytest`` using ``coverage`` and187+generate a report.188+189+.. code-block:: text190+191+ $ pip install coverage192+ $ coverage run -m pytest193+ $ coverage html194+195+Open ``htmlcov/index.html`` in your browser to explore the report.196+197+Read more about `coverage <https://coverage.readthedocs.io>`__.198+199+200+Building the docs201+~~~~~~~~~~~~~~~~~202+203+Build the docs in the ``docs`` directory using Sphinx.204+205+.. code-block:: text206+207+ $ cd docs208+ $ make html209+210+Open ``_build/html/index.html`` in your browser to view the docs.211+212+Read more about `Sphinx <https://www.sphinx-doc.org/en/stable/>`__.