Skip to content
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

List key development dependencies to install for new contributors #1783

Merged
merged 5 commits into from
Mar 8, 2022

Conversation

weiji14
Copy link
Member

@weiji14 weiji14 commented Mar 4, 2022

Description of proposed changes

As a new contributor, it's not obvious what packages are needed to help out with PyGMT development locally. This Pull Request attempts to clarify that, by listing some of the key dependencies needed so that make test and cd doc && make all won't result in nasty errors.

Note that this is one of the other major points from the PyOpenSci review we'll need to handle, so give it a bit of thought 🙂

Fixes #1697

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

Namely git and dvc for code and data version control, pytest-mpl for testing baseline images, and sphinx-gallery for building the gallery example page.
@weiji14 weiji14 added the documentation Improvements or additions to documentation label Mar 4, 2022
@weiji14 weiji14 added this to the 0.6.0 milestone Mar 4, 2022
@weiji14 weiji14 self-assigned this Mar 4, 2022
@@ -192,8 +192,16 @@ It will make your life a lot easier!

The repository includes a conda environment file `environment.yml` with the
specification for all development requirements to build and test the project.
In particular, these are some of the key development dependencies you will need
to install to build the documentation and run the unit tests locally:
Copy link
Member

Choose a reason for hiding this comment

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

Building the documentation needs more packages (like sphinx) than listed here.

Comment on lines 193 to 194
The repository includes a conda environment file `environment.yml` with the
specification for all development requirements to build and test the project.
Copy link
Member

Choose a reason for hiding this comment

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

The repository includes a conda environment file environment.yml with the
specification for all development requirements to build and test the project.

Actually I feel this sentence is very clear that all dependencies are listed in the environment.yml and people who want to build and test should read the environment.yml file, rather than listing an incompleted list here.

Copy link
Member

Choose a reason for hiding this comment

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

A compromise could be to add more sections (via comments) to environment.yml that specify which development dependencies are required for building the docs, running the tests, and/or formatting the code (inspiration from numpy and pandas environment files).

Copy link
Member Author

Choose a reason for hiding this comment

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

A compromise could be to add more sections (via comments) to environment.yml that specify which development dependencies are required for building the docs, running the tests, and/or formatting the code (inspiration from numpy and pandas environment files).

Yes, that sounds like a good idea actually.

So do we not want to list some of the dev dependencies here in contributing.md? I know it seems redundant, but there are some people who might be from a non-Anaconda/pure-Python-pip sort of world that don't really use that environment.yml file. Listing things like git/dvc/pytest/sphinx here up front will at least give people an idea on what framework PyGMT uses for testing and building documentation.

Copy link
Member

Choose a reason for hiding this comment

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

A compromise could be to add more sections (via comments) to environment.yml that specify which development dependencies are required for building the docs, running the tests, and/or formatting the code (inspiration from numpy and pandas environment files).

Yes, that sounds like a good idea actually.

Yes, I agree.

Listing things like git/dvc/pytest/sphinx here up front will at least give people an idea on what framework PyGMT uses for testing and building documentation.

Fair point.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, environment.yml has been reorganized into subsections (general, linters, testing, documentation) in ab8ac74.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this paragraph also include a short sentence on how to install dependencies with a .yml file? Since it's different than the typical pip install -r requirements.txt, it would cut down on confusion of how to use environment.yml to install dependencies.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. There's actually a conda env create instruction just a few sentences below. I've just added a commit (c2ae7dd) to make it more explicit (conda env create --file environment.yml).

weiji14 added 2 commits March 6, 2022 10:12
Including subsections for general development dependencies, style checks, unit testing, and building documentation.
@@ -13,22 +13,25 @@ dependencies:
- packaging
Copy link
Member

Choose a reason for hiding this comment

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

Line 7: can we remove pip from the list?

Copy link
Member Author

@weiji14 weiji14 Mar 6, 2022

Choose a reason for hiding this comment

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

We could, but then people might get a warning that says: "Warning : you have pip-installed dependencies in your environment file, but you do not list pip itself as one of your conda dependencies...". See https://stackoverflow.com/questions/58544099/warning-after-i-run-the-command-conda-env-create-f-environment-yml.

Edit: Oh wait, actually that warning won't show up since we don't list pip dependencies, but I think listing it explicitly doesn't really hurt?

@seisman seisman added the final review call This PR requires final review and approval from a second reviewer label Mar 6, 2022
@weiji14 weiji14 marked this pull request as ready for review March 6, 2022 16:53
@seisman seisman merged commit ff4ed31 into main Mar 8, 2022
@seisman seisman deleted the doc/clarify-dev-deps branch March 8, 2022 09:53
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 8, 2022
sixy6e pushed a commit to sixy6e/pygmt that referenced this pull request Dec 21, 2022
…nericMappingTools#1783)

* List some of the key dev dependencies for developing pygmt locally
* Reorganize development dependencies in environment.yml into subsections
* Explicitly use conda env create --file environment.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clarify required dependencies to run unit tests
4 participants