We will use Git, Anaconda, and the conda
package manager to install and
manage the development environment.
This guide assumes a basic understanding of git using the command line. For more help, attend the optional setup session on August 17 and/or review the Software Carpentry's course on Version Control with Git.
This guide also assumes that you are using a UNIX-type shell. If you are working on a Windows machine, one option is to install and use Git for Windows.
Note: The steps in this section only need to be performed once per repository.
-
Clone the repository.
- In a browser, navigate to the PyGMT repository.
- Login to GitHub by clicking the 'Sign In' button in the top-left corner.
- Click the green 'Code' button ①.
- If you do not have
ssh keys set up,
use the https url by first clicking the
https
button ②. - Copy the link by clicking the clipboard icon ③.
- In a terminal window, navigate to the directory where you want to place
the cloned PyGMT repository using
cd
. - Type
git clone clone-url
into the terminal (replaceclone-url
with the url that was copied to your clipboard).
-
Fork the repository to your personal account.
- Click the
Fork
button on the PyGMT page ①. If you are presented with a list of organizations, click on your GitHub username.
- Click the
-
Add your fork as a remote.
- Go to your fork of the PyGMT repository:
https://github.com/your-username/pygmt
(replaceyour-username
with your GitHub username) and copy the code url as in step 1. - In your terminal window, navigate into your cloned repository
(e.g.,
cd pygmt
). - Check that the repository was cloned successfully using
git status
. - In your terminal window, run
git remote add your-github-username fork-url
(replaceyour-github-username
with your GitHub username andfork-url
with the url that was copied to your clipboard). You will be able to tell it is your fork url because it will have your GitHub username in it.
- Go to your fork of the PyGMT repository:
-
Install Anaconda if you do not already have it installed.
-
In a terminal window, navigate to the base of the repository using
cd
. -
Run
git status
to check that you are in the repository. -
Run
conda env create
to create a new conda environment from theenvironment.yml
file.Note: If you get a
conda: command not found
error, you'll need to addconda
to your$PATH
first, see instructions on https://stackoverflow.com/questions/35246386/conda-command-not-found. Afterwards, you may want to runconda init
, and open a new terminal window (you may then need to repeat steps 2-4 again). -
Run
conda activate pygmt
to activate the conda environment. -
Run
make install
to install the current source code in your environment. If you are on Windows, you may need to usepip install --no-deps -e .
instead. -
Run
python -c "import pygmt; pygmt.show_versions()"
to check your installation.
The steps in this guide are based on Aaron Meurer's Git workflow guide and the PyGMT Contributing Guide.