Skip to content

Commit 0217b2e

Browse files
authored
Merge pull request #2569 from joelostblom/contributing-guidelines
DOCS: Clarify steps in the contributing guidelines
2 parents 5c912ea + 7ab6590 commit 0217b2e

File tree

1 file changed

+45
-38
lines changed

1 file changed

+45
-38
lines changed

CONTRIBUTING.md

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,52 +20,73 @@ slack](https://bit.ly/join-vega-slack).
2020

2121
### Setting Up Your Environment
2222

23-
Install the latest version of Altair locally using
24-
```
25-
$ pip install git+https://github.com/altair-viz/altair/
26-
```
27-
Next step is to fork the repository on GitHub and clone the fork to you local
23+
Fork the Altair repository on GitHub and clone the fork to you local
2824
machine. For more details on forking see the [GitHub
2925
Documentation](https://help.github.com/en/articles/fork-a-repo).
3026
```
3127
$ git clone https://github.com/YOUR-USERNAME/altair.git
3228
```
33-
You can have a single clone of the repository that points to both your fork and
34-
the main package repository. These pointers to GitHub are called "remotes" .
35-
On your local clone you should run:
29+
30+
To keep your fork up to date with changes in the this repo,
31+
you can [use the fetch upstream button on GitHub](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork).
32+
33+
Now you can install the latest version of Altair locally using `pip`.
34+
The `-e` flag indicates that your local changes will be reflected
35+
every time you open a new Python interpreter
36+
(instead of having to reinstall the package each time).
37+
```
38+
$ cd altair/
39+
$ python -m pip install -e .
40+
```
41+
42+
You can now install the development requirements using
3643
```
37-
$ git remote add upstream https://github.com/altair-viz/altair.git
38-
$ git checkout master
39-
$ git pull upstream master
44+
$ python -m pip install -r requirement_dev.txt
4045
```
41-
And then you'll have all the updates in the master branch of your local fork.
42-
Note that git will complain if you've committed changes to your local master
43-
branch that are not on upstream (this is one reason it's good practice to **never**
44-
work directly on your master branch).
46+
4547

4648
### Creating a Branch
4749

48-
Once your local environment is up-to-date, you can create a new git branch which will
49-
contain your contribution:
50+
Once your local environment is up-to-date, you can create a new git branch
51+
which will contain your contribution
52+
(always create a new branch instead of making changes to the master branch):
5053
```
51-
$ git checkout -b <branch-name>
54+
$ git switch -c <branch-name>
5255
```
5356
With this branch checked-out, make the desired changes to the package.
57+
5458
Note that Altair code uses the [black](https://black.readthedocs.io/)
55-
code formatter, which you can apply to your modifications by installing
56-
and running black on the local directory:
59+
code formatter and [flake8](https://flake8.pycqa.org/en/latest/) linter
60+
which you can apply to your modifications by running:
5761
```
58-
$ pip install black
59-
$ black .
62+
$ black --diff . # View changes
63+
$ black . # Apply changes
64+
$ flake8 . --statistics # View changes (fix manually)
65+
```
66+
67+
### Testing your Changes
68+
69+
Before suggesting your contributing your changing to the main Altair repository,
70+
it is recommended that you run the Altair test suite,
71+
which includes a number of tests to validate the correctness of your code:
72+
6073
```
74+
$ make test
75+
```
76+
77+
Study the output of any failed tests and try to fix the issues
78+
before proceeding to the next section.
79+
80+
### Creating a Pull Request
81+
6182
When you are happy with your changes, you can commit them to your branch by running
6283
```
6384
$ git add <modified-file>
6485
$ git commit -m "Some descriptive message about your change"
6586
$ git push origin <branch-name>
6687
```
67-
Finally you will need to submit a pull request (PR) on GitHub asking to merge
68-
your example branch into Altair master. For details on creating a PR see GitHub
88+
You will then need to submit a pull request (PR) on GitHub asking to merge
89+
your example branch into the main Altair repository. For details on creating a PR see GitHub
6990
documentation [Creating a pull
7091
request](https://help.github.com/en/articles/creating-a-pull-request). You can
7192
add more details about your example in the PR such as motivation for the
@@ -77,20 +98,6 @@ automatically shown in the PR.
7798
Hopefully your PR will be answered in a timely manner and your contribution will
7899
help others in the future.
79100

80-
### Testing your Changes
81-
82-
When you submit a pull request, Altair's continuous integration test suite will
83-
run a number of tests to validate the correctness of your code. It can be helpful
84-
when debugging to run those tests locally; to do this first install Altair's
85-
development requirements:
86-
```
87-
$ pip install -r requirements_dev.txt
88-
```
89-
and then run the test suite with:
90-
```
91-
$ make test
92-
```
93-
94101
## Adding Examples
95102

96103
We are always interested in new examples contributed from the community. These

0 commit comments

Comments
 (0)