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

Skip to content

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

Merged
merged 13 commits into from
Nov 2, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ENH Improved contributing documentation
closes #7234
  • Loading branch information
NelleV committed Oct 29, 2016
commit 419ce52a908d56b416de5d4fa5b908968ea9b29b
103 changes: 87 additions & 16 deletions doc/devel/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

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"

environment is set up properly::

python tests.py
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my computer, it works fine at this stage. I am lucky?

Copy link
Member

Choose a reason for hiding this comment

The 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::

Expand Down Expand Up @@ -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.
Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

@efiring efiring Oct 12, 2016

Choose a reason for hiding this comment

The 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::
Copy link
Member

Choose a reason for hiding this comment

The 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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete first "the"

Copy link
Member

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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.
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Member

Choose a reason for hiding this comment

The 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 master or when the commit (with the reference) is merged into master). But cross-references still work everywhere.


* All public methods should have informative docstrings with sample
usage presented as doctests when appropriate. Use the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we actually using doctests anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

The 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
Copy link
Member

Choose a reason for hiding this comment

The 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
Expand Down Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"get" -> "move"

direction.


More on :ref:`coding_guidelines`

.. _other_ways_to_contribute:
Expand All @@ -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:

Expand Down
4 changes: 0 additions & 4 deletions doc/devel/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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
Expand Down