Skip to content
Myr

use global contributing guide (#2070)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Lord · committed by GitHub · parents ab8218c, 247de5e · Browse files · 2 files+8 added−222 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−222 removed

  • other:+8 added−222 removed

2 files+8 added−222 removed

deleted:CONTRIBUTING.rst-222 removed
1How to contribute to Jinja2==========================34Thank you for considering contributing to Jinja!567Support questions8-----------------910Please don't use the issue tracker for this. The issue tracker is a11tool to address bugs and feature requests in Jinja itself. Use one of12the following resources for questions about using Jinja or issues with13your own code:1415- The ``#get-help`` channel on our Discord chat:16 https://discord.gg/pallets17- 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 jinja {search term, exception message, etc.}``2122.. _Stack Overflow: https://stackoverflow.com/questions/tagged/jinja?tab=Frequent232425Reporting issues26----------------2728Include the following information in your post:2930- 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 Jinja versions. If possible, check if this37 issue is already fixed in the latest releases or the latest code in38 the repository.3940.. _minimal reproducible example: https://stackoverflow.com/help/minimal-reproducible-example414243Submitting patches44------------------4546If there is not an open issue for what you want to submit, prefer47opening 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.5152Include the following in your patch:5354- 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.6465.. _Black: https://black.readthedocs.io66.. _pre-commit: https://pre-commit.com676869First time setup70~~~~~~~~~~~~~~~~7172- Download and install the `latest version of git`_.73- Configure git with your `username`_ and `email`_.7475 .. code-block:: text7677 $ git config --global user.name 'your name'78 $ git config --global user.email 'your email'7980- Make sure you have a `GitHub account`_.81- Fork Jinja to your GitHub account by clicking the `Fork`_ button.82- `Clone`_ the main repository locally.8384 .. code-block:: text8586 $ git clone https://github.com/pallets/jinja87 $ cd jinja8889- Add your fork as a remote to push your work to. Replace90 ``{username}`` with your username. This names the remote "fork", the91 default Pallets remote is "origin".9293 .. code-block:: text9495 $ git remote add fork https://github.com/{username}/jinja9697- 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\activate109110- Upgrade pip and setuptools.111112 .. code-block:: text113114 $ python -m pip install --upgrade pip setuptools115116- Install the development dependencies, then install Jinja in editable117 mode.118119 .. code-block:: text120121 $ pip install -r requirements/dev.txt && pip install -e .122123- Install the pre-commit hooks.124125 .. code-block:: text126127 $ pre-commit install128129.. _latest version of git: https://git-scm.com/downloads130.. _username: https://docs.github.com/en/github/using-git/setting-your-username-in-git131.. _email: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address132.. _GitHub account: https://github.com/join133.. _Fork: https://github.com/pallets/jinja/fork134.. _Clone: https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#step-2-create-a-local-clone-of-your-fork135136137Start coding138~~~~~~~~~~~~139140- Create a branch to identify the issue you would like to work on. If141 you're submitting a bug or documentation fix, branch off of the142 latest ".x" branch.143144 .. code-block:: text145146 $ git fetch origin147 $ git checkout -b your-branch-name origin/3.0.x148149 If you're submitting a feature addition or change, branch off of the150 "main" branch.151152 .. code-block:: text153154 $ git fetch origin155 $ git checkout -b your-branch-name origin/main156157- Using your favorite editor, make your changes,158 `committing as you go`_.159- Include tests that cover any code changes you make. Make sure the160 test fails without your patch. Run the tests as described below.161- Push your commits to your fork on GitHub and162 `create a pull request`_. Link to the issue being addressed with163 ``fixes #123`` in the pull request.164165 .. code-block:: text166167 $ git push --set-upstream fork your-branch-name168169.. _committing as you go: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes170.. _create a pull request: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request171172173Running the tests174~~~~~~~~~~~~~~~~~175176Run the basic test suite with pytest.177178.. code-block:: text179180 $ pytest181182This runs the tests for the current environment, which is usually183sufficient. CI will run the full suite when you submit your pull184request. You can run the full test suite with tox if you don't want to185wait.186187.. code-block:: text188189 $ tox190191192Running test coverage193~~~~~~~~~~~~~~~~~~~~~194195Generating a report of lines that do not have test coverage can indicate196where to start contributing. Run ``pytest`` using ``coverage`` and197generate a report.198199.. code-block:: text200201 $ pip install coverage202 $ coverage run -m pytest203 $ coverage html204205Open ``htmlcov/index.html`` in your browser to explore the report.206207Read more about `coverage <https://coverage.readthedocs.io>`__.208209210Building the docs211~~~~~~~~~~~~~~~~~212213Build the docs in the ``docs`` directory using Sphinx.214215.. code-block:: text216217 $ cd docs218 $ make html219220Open ``_build/html/index.html`` in your browser to view the docs.221222Read more about `Sphinx <https://www.sphinx-doc.org/en/stable/>`__.
modified:README.md+8 added