Debian Codegraph @

CONTRIBUTING.md

raw
1 # How to contribute to Flask-Caching
2
3 Thank you for considering contributing to Flask-Caching!
4
5
6 ## Support questions
7
8 Please don't use the issue tracker for this. The issue tracker is a tool
9 to address bugs and feature requests in Flask-Caching itself. Use one of the
10 following resources for questions about using Flask-Caching or issues with
11 your own code:
12
13 - The `#get-help` channel on our Discord chat:
14 <https://discord.gg/pallets>
15 - Ask on [Stack Overflow](https://stackoverflow.com/search?tab=relevance&q=Flask-Caching). Search with Google first using:
16 `site:stackoverflow.com Flask-Caching {search term, exception message, etc.}`
17
18
19 ## Reporting issues
20
21 Include the following information in your post:
22
23 - Describe what you expected to happen.
24 - If possible, include a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) to help us
25 identify the issue. This also helps check that the issue is not with
26 your own code.
27 - Describe what actually happened. Include the full traceback if there
28 was an exception.
29 - List your Python and Flask-Caching versions. If possible, check if this
30 issue is already fixed in the latest releases or the latest code in
31 the repository.
32
33
34 ## Submitting patches
35
36 If there is not an open issue for what you want to submit, prefer
37 opening one for discussion before working on a PR. You can work on any
38 issue that doesn't have an open PR linked to it or a maintainer assigned
39 to it. These show up in the sidebar. No need to ask if you can work on
40 an issue that interests you.
41
42 Include the following in your patch:
43
44 - Use [Black](https://black.readthedocs.io) to format your code. This and other tools will run
45 automatically if you install [pre-commit](https://pre-commit.com) using the instructions
46 below.
47 - Include tests if your patch adds or changes code. Make sure the test
48 fails without your patch.
49 - Update any relevant docs pages and docstrings. Docs pages and
50 docstrings should be wrapped at 72 characters.
51 - Add an entry in `CHANGES.rst`. Use the same style as other
52 entries. Also include `.. versionchanged::` inline changelogs in
53 relevant docstrings.
54
55
56 ### First time setup
57
58 - Download and install the [latest version of git](https://git-scm.com/downloads).
59 - Configure git with your [username](https://docs.github.com/en/github/using-git/setting-your-username-in-git) and [email](https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/setting-your-commit-email-address).
60
61 ```bash
62 $ git config --global user.name 'your name'
63 $ git config --global user.email 'your email'
64 ```
65
66 - Make sure you have a [GitHub account](https://github.com/join).
67 - Fork Flask-Caching to your GitHub account by clicking the [Fork](https://github.com/pallets-eco/flask-caching/fork) button.
68 - [Clone](https://docs.github.com/en/github/getting-started-with-github/fork-a-repo#step-2-create-a-local-clone-of-your-fork) the main repository locally.
69
70 ```bash
71 $ git clone https://github.com/pallets-eco/flask-caching
72 $ cd flask-caching
73 ```
74
75 - Add your fork as a remote to push your work to. Replace
76 `{username}` with your username. This names the remote "fork", the
77 default Pallets remote is "origin".
78
79 ```bash
80 git remote add fork https://github.com/{username}/flask-caching
81 ```
82
83 - Create a virtualenv.
84
85 **Linux/macOS**
86
87 ```bash
88 $ python3 -m venv env
89 $ . env/bin/activate
90 ```
91
92 **Windows**
93
94 ```bash
95 > py -3 -m venv env
96 > env\Scripts\activate
97 ```
98
99 - Upgrade pip and setuptools.
100
101 ```bash
102 $ python -m pip install --upgrade pip setuptools
103 ```
104
105 - Install the development dependencies, then install Flask-Caching in
106 editable mode.
107
108 ```bash
109 $ pip install -r requirements/dev.txt && pip install -e .
110 ```
111
112 - Install the pre-commit hooks.
113
114 ```bash
115 $ pre-commit install
116 ```
117
118
119 ### Start coding
120
121 - Create a branch to identify the issue you would like to work on. If
122 you're submitting a bug or documentation fix, branch off of the
123 latest ".x" branch.
124
125 ```bash
126 $ git fetch origin
127 $ git checkout -b your-branch-name origin/main
128 ```
129
130 If you're submitting a feature addition or change, branch off of the
131 "main" branch.
132
133 ```bash
134 $ git fetch origin
135 $ git checkout -b your-branch-name origin/main
136 ```
137
138 - Using your favorite editor, make your changes,
139 [committing as you go](https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html#commit-your-changes).
140 - Include tests that cover any code changes you make. Make sure the
141 test fails without your patch. Run the tests as described below.
142 - Push your commits to your fork on GitHub and
143 [create a pull request](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request). Link to the issue being addressed with
144 `fixes #123` in the pull request.
145
146 ```bash
147 $ git push --set-upstream fork your-branch-name
148 ```
149
150
151 ### Running the tests
152
153 Run the basic test suite with pytest.
154
155 ```bash
156 $ pytest
157 ```
158
159 This runs the tests for the current environment, which is usually
160 sufficient. CI will run the full suite when you submit your pull
161 request. You can run the full test suite with tox if you don't want to
162 wait.
163
164 ```bash
165 $ tox
166 ```
167
168
169 ### Running test coverage
170
171 Generating a report of lines that do not have test coverage can indicate
172 where to start contributing. Run `pytest` using `coverage` and
173 generate a report.
174
175 ```bash
176 $ pip install coverage
177 $ coverage run -m pytest
178 $ coverage html
179 ```
180
181 Open `htmlcov/index.html` in your browser to explore the report.
182
183 Read more about [coverage](https://coverage.readthedocs.io).
184
185
186 ### Building the docs
187
188 Build the docs in the `docs` directory using Sphinx.
189
190 ```bash
191 $ cd docs
192 $ make html
193 ```
194
195 Open `_build/html/index.html` in your browser to view the docs.
196
197 Read more about [Sphinx](https://www.sphinx-doc.org/en/stable/).