-
Notifications
You must be signed in to change notification settings - Fork 74
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
Update doc to use pkg_resources #120
Conversation
I expect some bike-shedding to happen here, I'm really not sure what's the best way to present this. |
doc/usage.rst
Outdated
The ``registry.txt`` file in this case is in the ``plumbus/`` directory module and should be | ||
shipped with the package. We use `pkg_resources <https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access)`__ | ||
to access it, giving it the name of our Python package (the one we'll put in ``setup.py``). | ||
Its contents are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure what width is used for word-wrapping rst files. Also this link is too long 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 for rst files it doesn't really matter too much. I usually do 79 or 88 (whichever you prefer). Not much we can do about the link, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @remram44! Yeah, it's tricky to have opinionated docs but I find it useful. Actually, all my other packages using Pooch need to implement this change. Made a few minor comments on the wording but this is good overall.
doc/usage.rst
Outdated
GOODBOY.load_registry(registry_file) | ||
|
||
The ``registry.txt`` file in this case is in the ``plumbus/`` directory module and should be | ||
shipped with the package. We use `pkg_resources <https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access)`__ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of "We use package_resources" you could say:
We access the file contents using pkg_resources (instead of
os.path.dirname(__file__)
) because it's safer alternative. For example, it makes sure our code can work out of a zip archive, which is necessary depending on how the user installs the package.
doc/usage.rst
Outdated
# Load this registry file | ||
GOODBOY.load_registry(registry_file) | ||
|
||
The ``registry.txt`` file in this case is in the ``plumbus/`` directory module and should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ``registry.txt`` file in this case is in the ``plumbus/`` directory module and should be | |
The ``registry.txt`` file is in the ``plumbus/`` directory (the package) and should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this repeats "the package"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, didn't see that one in the next line. Just feel like "directory module" sounds strange.
@remram44 I pushed a fix for the broken hyperlink and removed the repeated "package". Looks good to me now and will merge as soon as CIs are happy. Thank you for this! 👍 |
With Pooch 0.7.0, the recommended way of loading the registry file is with `pkg_resources` (see fatiando/pooch#120). It's also better to use the default cache location so users can more easily clean up unused files. Because this is system specific, add the `verde.datasets.locate` function to return the cache folder location.
With Pooch 0.7.0, the recommended way of loading the registry file is with `pkg_resources` (see fatiando/pooch#120). It's also better to use the default cache location so users can more easily clean up unused files. Because this is system specific, add the `verde.datasets.locate` function to return the cache folder location.
With Pooch 0.7.0, the recommended way of loading the registry file is with `pkg_resources` (see fatiando/pooch#120). It's also better to use the default cache location so users can more easily clean up unused files. Because this is system specific, add the `harmonica.datasets.locate` function to return the cache folder location.
With Pooch 0.7.0, the recommended way of loading the registry file is with `pkg_resources` (see fatiando/pooch#120). It's also better to use the default cache location so users can more easily clean up unused files. Because this is system specific, add the `harmonica.datasets.locate` function to return the cache folder location.
Follow up on #117
Using pkg_resources instead of
os.path
calls is less error-prone and allows one's package to work from ZIPs (zip-safe).Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.