-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ENH Improving the contribution guidelines #7236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
d00c927
419ce52
0b9974c
085844a
9799d66
9547bc7
5a9f988
c97d6ac
54e0c9c
76a5ab2
19603a5
388a4a0
4d8963f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
closes #7234
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,13 @@ or:: | |
|
||
pip install -v -e . | ||
|
||
This installs matplotlib for development (i.e., builds everything and places | ||
the symbolic links back to the source code). This command has to be called | ||
everytime a `c` file is changed. Note that changing branches may change the | ||
`c`-code. | ||
This installs matplotlib for development (i.e., builds everything and places the | ||
symbolic links back to the source code). You can then run the tests your work | ||
environment is set up properly:: | ||
|
||
python tests.py | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is run at this stage it will spew image comparison failures, won't it? Maybe better to delay all mention of running the test until the place below where you tell how to set things up for testing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On my computer, it works fine at this stage. I am lucky? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not strictly problematic, but if you don't tell it to use the fixed version of freetype, you might run into a lot of image failures if all the text has shifted a bit (like say, the next versions of Debian and Fedora, which include a newer FreeType.) |
||
|
||
You can read more about testing :ref:`testings: | ||
|
||
.. note:: | ||
|
||
|
@@ -75,18 +78,70 @@ For more information on using git and Github, see :ref:`using-git`. | |
Contributing code | ||
================= | ||
|
||
Here are some guidelines on how new code should be written: | ||
How to contribute | ||
----------------- | ||
|
||
The preferred way to contribute to matplotlib is to fork the `main | ||
repository <https://github.com/matplotlib/matplibtl/>`__ on GitHub, | ||
then submit a "pull request" (PR): | ||
|
||
1. `Create an account <https://github.com/join>`_ on | ||
GitHub if you do not already have one. | ||
|
||
2. Fork the `project repository | ||
<https://github.com/matplotlib/matplotlib>`__: click on the 'Fork' button | ||
near the top of the page. This creates a copy of the code under your | ||
account scikit-learnon the GitHub server. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. scikit-learn reference left. |
||
|
||
3. Clone this copy to your local disk:: | ||
|
||
$ git clone [email protected]:YourLogin/matplotlib.git | ||
|
||
4. Create a branch to hold your changes:: | ||
|
||
$ git checkout -b my-feature | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say "Create a branch, normally from master..." and then append "master" to the checkout command. I realize it is not necessary for someone following exactly these instructions, but I think it clarifies what is being done. It gives the new user a hint as to what the line below referring to "master" might mean. |
||
|
||
and start making changes. Never work in the ``master`` branch! | ||
|
||
5. Work on this copy, on your computer, using Git to do the version | ||
control. When you're done editing, do:: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "editing," -> "editing, e.g., 'lib/matplotlib/collections.py'" and then put the example file name in place of "modified_files" below. |
||
|
||
$ git add modified_files | ||
$ git commit | ||
|
||
to record your changes in Git, then push them to GitHub with:: | ||
|
||
$ git push -u origin my-feature | ||
|
||
Finally, go to the web page of the your fork of the matplotlib repo, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. delete first "the" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you mean the second "the". |
||
and click 'Pull request' to send your changes to the maintainers for review. | ||
You may want to consider sending an email to the mailing list for more | ||
visibility. | ||
|
||
If any of the above seems like magic to you, then look up the | ||
`Git documentation <https://git-scm.com/documentation>`_ and our | ||
`Git development workflow <gitwash/development_workflow>`_. | ||
|
||
Contributing pull requests | ||
-------------------------- | ||
|
||
It is recommended to check that your contribution complies with the following | ||
rules before submitting a pull request: | ||
|
||
* If your pull request addresses an issue, please use the title todescribe | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add space -> "to describe" |
||
the issue and mention the issue number in the pull request description | ||
to ensure a link is created to the original issue. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the issue number has to be in the commit message, not the PR description. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It needs to be in the commit message or the description if you want to trigger GitHub's automatic issue closing (which only works when the PR goes to |
||
|
||
* All public methods should have informative docstrings with sample | ||
usage presented as doctests when appropriate. Use the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we actually using doctests anywhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. eh… maybe not. I was actually wondering yesterady if the docstrings were tested, or even just simply run to verify the code actually runs. |
||
`numpy docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_ | ||
|
||
* Formatting should follow `PEP8 | ||
<http://www.python.org/dev/peps/pep-0008/>`_. You should consider | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. http -> https |
||
installing/enabling automatic PEP8 checking in your editor. Part of the | ||
test suite is checking PEP8 compliance, things go smoother if the code is | ||
mostly PEP8 compliant to begin with. | ||
|
||
* Every new feature should be documented. Use the | ||
`numpy docstring standard <https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt>`_ | ||
in all your docstrings. | ||
|
||
* Each high-level plotting function should have a simple example in | ||
the `Example` section of the docstring. This should be as simple as | ||
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: | |
:ref:`keyword-argument-processing`, if code in your pull request | ||
does that. | ||
|
||
In addition, you can check for common programming errors with the following | ||
tools: | ||
|
||
* Code with a good unittest coverage (at least 70%, better 100%), check | ||
with:: | ||
|
||
pip install coverage | ||
python tests.py --with-coverage | ||
|
||
* No pyflakes warnings, check with:: | ||
|
||
pip install pyflakes | ||
pyflakes path/to/module.py | ||
|
||
.. note:: | ||
|
||
The current state of the matplotlib code base is not compliant with all | ||
of those guidelines, but we expect that enforcing those constraints on all | ||
new contributions will get the overall code base quality in the right | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "get" -> "move" |
||
direction. | ||
|
||
|
||
More on :ref:`coding_guidelines` | ||
|
||
.. _other_ways_to_contribute: | ||
|
@@ -138,13 +215,7 @@ list or submit a GitHub pull request. Full documentation can be found under | |
the doc/ directory. | ||
|
||
It also helps us if you spread the word: reference the project from your blog | ||
and articles, link to it from your website, or simply say "I use it": | ||
|
||
.. raw:: html | ||
|
||
<script type="text/javascript" | ||
src="http://www.ohloh.net/p/480792/widgets/project_users.js?style=rainbow"></script> | ||
|
||
and articles or link to it from your website! | ||
|
||
.. _coding_guidelines: | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,20 +17,16 @@ Requirements | |
The following software is required to run the tests: | ||
|
||
- nose_, version 1.0 or later | ||
|
||
- `mock <http://www.voidspace.org.uk/python/mock/>`_, when running python | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above comments, but these links might be outdated. |
||
versions < 3.3 | ||
|
||
- `Ghostscript <http://pages.cs.wisc.edu/~ghost/>`_ (to render PDF | ||
files) | ||
|
||
- `Inkscape <http://inkscape.org>`_ (to render SVG files) | ||
|
||
Optionally you can install: | ||
|
||
- `coverage <http://nedbatchelder.com/code/coverage/>`_ to collect coverage | ||
information | ||
|
||
- `pep8 <http://pep8.readthedocs.org/en/latest>`_ to test coding standards | ||
|
||
Building matplotlib for image comparison tests | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"tests your work" -> "tests to check that your work"