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

Support passing in pathlib.Path into pygmt modules #1381

Closed
weiji14 opened this issue Jul 8, 2021 · 2 comments · Fixed by #1382
Closed

Support passing in pathlib.Path into pygmt modules #1381

weiji14 opened this issue Jul 8, 2021 · 2 comments · Fixed by #1382
Assignees
Labels
feature request New feature wanted good first issue Good for newcomers scipy-sprint Things to work on during the SciPy sprint!
Milestone

Comments

@weiji14
Copy link
Member

weiji14 commented Jul 8, 2021

Description of the desired feature

Originally posted by @liamtoney in #949 (comment)

I'd add Path objects if they're not already supported. :)

The pathlib.Path is a cross-platform way of handling filepaths. Currently PyGMT supports passing in filenames as a str, but it would be good to ensure that pathlib.Path works too.

What needs to be done ☑️

  1. This if-statement needs to be modified:

if isinstance(data, str):
kind = "file"

  1. Add some unit tests with pathlib.Path inputs, best placed in https://github.com/GenericMappingTools/pygmt/blob/master/pygmt/tests/test_info.py.

How to make the change 🧐

  1. First, read up our contributing guidelines at https://www.pygmt.org/v0.4.0/contributing.html#editing-the-documentation
  2. Leave a comment below, stating that you will tackle this issue. We will assign you to this issue and you can then start working on it.
  3. To edit the utils.py file, go to https://github.com/GenericMappingTools/pygmt/edit/master/pygmt/helpers/utils.py and make the change!. Or you may want to do this in your code editor locally.
  4. Submit a pull request, and be sure to fill it up with as much detail as possible.

Are you willing to help implement and maintain this feature? Happy to guide someone with some familiarity with Python Path objects to work on this. Will also be a great opportunity for someone wanting to learn how to write unit tests.

@weiji14 weiji14 added good first issue Good for newcomers help wanted Helping hands are appreciated feature request New feature wanted scipy-sprint Things to work on during the SciPy sprint! labels Jul 8, 2021
@aitorres
Copy link
Contributor

aitorres commented Jul 9, 2021

Hi there! I could take this issue and make a PR with the changes :-)

@weiji14
Copy link
Member Author

weiji14 commented Jul 13, 2021

Thanks @aitorres, I've assigned you to this issue and will take a look at your PR shortly :)

@maxrjones maxrjones removed the help wanted Helping hands are appreciated label Aug 1, 2021
@seisman seisman added this to the 0.5.0 milestone Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted good first issue Good for newcomers scipy-sprint Things to work on during the SciPy sprint!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants