Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 419ce52

Browse files
committed
ENH Improved contributing documentation
closes #7234
1 parent d00c927 commit 419ce52

2 files changed

Lines changed: 87 additions & 20 deletions

File tree

doc/devel/contributing.rst

Lines changed: 87 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,13 @@ or::
4141
4242
pip install -v -e .
4343

44-
This installs matplotlib for development (i.e., builds everything and places
45-
the symbolic links back to the source code). This command has to be called
46-
everytime a `c` file is changed. Note that changing branches may change the
47-
`c`-code.
44+
This installs matplotlib for development (i.e., builds everything and places the
45+
symbolic links back to the source code). You can then run the tests your work
46+
environment is set up properly::
47+
48+
python tests.py
49+
50+
You can read more about testing :ref:`testings:
4851

4952
.. note::
5053

@@ -75,18 +78,70 @@ For more information on using git and Github, see :ref:`using-git`.
7578
Contributing code
7679
=================
7780

78-
Here are some guidelines on how new code should be written:
81+
How to contribute
82+
-----------------
83+
84+
The preferred way to contribute to matplotlib is to fork the `main
85+
repository <https://github.com/matplotlib/matplibtl/>`__ on GitHub,
86+
then submit a "pull request" (PR):
87+
88+
1. `Create an account <https://github.com/join>`_ on
89+
GitHub if you do not already have one.
90+
91+
2. Fork the `project repository
92+
<https://github.com/matplotlib/matplotlib>`__: click on the 'Fork' button
93+
near the top of the page. This creates a copy of the code under your
94+
account scikit-learnon the GitHub server.
95+
96+
3. Clone this copy to your local disk::
97+
98+
$ git clone [email protected]:YourLogin/matplotlib.git
99+
100+
4. Create a branch to hold your changes::
101+
102+
$ git checkout -b my-feature
103+
104+
and start making changes. Never work in the ``master`` branch!
105+
106+
5. Work on this copy, on your computer, using Git to do the version
107+
control. When you're done editing, do::
108+
109+
$ git add modified_files
110+
$ git commit
111+
112+
to record your changes in Git, then push them to GitHub with::
113+
114+
$ git push -u origin my-feature
115+
116+
Finally, go to the web page of the your fork of the matplotlib repo,
117+
and click 'Pull request' to send your changes to the maintainers for review.
118+
You may want to consider sending an email to the mailing list for more
119+
visibility.
120+
121+
If any of the above seems like magic to you, then look up the
122+
`Git documentation <https://git-scm.com/documentation>`_ and our
123+
`Git development workflow <gitwash/development_workflow>`_.
124+
125+
Contributing pull requests
126+
--------------------------
127+
128+
It is recommended to check that your contribution complies with the following
129+
rules before submitting a pull request:
130+
131+
* If your pull request addresses an issue, please use the title todescribe
132+
the issue and mention the issue number in the pull request description
133+
to ensure a link is created to the original issue.
134+
135+
* All public methods should have informative docstrings with sample
136+
usage presented as doctests when appropriate. Use the
137+
`numpy docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_
79138

80139
* Formatting should follow `PEP8
81140
<http://www.python.org/dev/peps/pep-0008/>`_. You should consider
82141
installing/enabling automatic PEP8 checking in your editor. Part of the
83142
test suite is checking PEP8 compliance, things go smoother if the code is
84143
mostly PEP8 compliant to begin with.
85144

86-
* Every new feature should be documented. Use the
87-
`numpy docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_
88-
in all your docstrings.
89-
90145
* Each high-level plotting function should have a simple example in
91146
the `Example` section of the docstring. This should be as simple as
92147
possible to demonstrate the method. More complex examples should go
@@ -122,6 +177,28 @@ Here are some guidelines on how new code should be written:
122177
:ref:`keyword-argument-processing`, if code in your pull request
123178
does that.
124179

180+
In addition, you can check for common programming errors with the following
181+
tools:
182+
183+
* Code with a good unittest coverage (at least 70%, better 100%), check
184+
with::
185+
186+
pip install coverage
187+
python tests.py --with-coverage
188+
189+
* No pyflakes warnings, check with::
190+
191+
pip install pyflakes
192+
pyflakes path/to/module.py
193+
194+
.. note::
195+
196+
The current state of the matplotlib code base is not compliant with all
197+
of those guidelines, but we expect that enforcing those constraints on all
198+
new contributions will get the overall code base quality in the right
199+
direction.
200+
201+
125202
More on :ref:`coding_guidelines`
126203

127204
.. _other_ways_to_contribute:
@@ -138,13 +215,7 @@ list or submit a GitHub pull request. Full documentation can be found under
138215
the doc/ directory.
139216

140217
It also helps us if you spread the word: reference the project from your blog
141-
and articles, link to it from your website, or simply say "I use it":
142-
143-
.. raw:: html
144-
145-
<script type="text/javascript"
146-
src="http://www.ohloh.net/p/480792/widgets/project_users.js?style=rainbow"></script>
147-
218+
and articles or link to it from your website!
148219

149220
.. _coding_guidelines:
150221

doc/devel/testing.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,16 @@ Requirements
1717
The following software is required to run the tests:
1818

1919
- nose_, version 1.0 or later
20-
2120
- `mock <http://www.voidspace.org.uk/python/mock/>`_, when running python
2221
versions < 3.3
23-
2422
- `Ghostscript <http://pages.cs.wisc.edu/~ghost/>`_ (to render PDF
2523
files)
26-
2724
- `Inkscape <http://inkscape.org>`_ (to render SVG files)
2825

2926
Optionally you can install:
3027

3128
- `coverage <http://nedbatchelder.com/code/coverage/>`_ to collect coverage
3229
information
33-
3430
- `pep8 <http://pep8.readthedocs.org/en/latest>`_ to test coding standards
3531

3632
Building matplotlib for image comparison tests

0 commit comments

Comments
 (0)