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

Update pystac.utils docs #735

Merged
merged 11 commits into from Feb 23, 2022

Conversation

duckontheweb
Copy link
Contributor

@duckontheweb duckontheweb commented Jan 28, 2022

Related Issue(s):

Description:

Updates docstrings with references to internal and external API docs and adds more detail to some of the docstrings.

PR Checklist:

  • Code is formatted (run pre-commit run --all-files)
  • Tests pass (run scripts/test)
  • Documentation has been updated to reflect changes, if applicable
  • This PR maintains or improves overall codebase code coverage.
  • Changes are added to the CHANGELOG. See the docs for information about adding to the changelog.

@duckontheweb duckontheweb added this to the 1.4.0 milestone Jan 28, 2022
@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2022

Codecov Report

Merging #735 (c39e43b) into main (ca49adb) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #735   +/-   ##
=======================================
  Coverage   94.42%   94.42%           
=======================================
  Files          77       77           
  Lines       11312    11312           
  Branches     1346     1346           
=======================================
  Hits        10681    10681           
  Misses        453      453           
  Partials      178      178           
Impacted Files Coverage Δ
pystac/extensions/datacube.py 65.67% <ø> (ø)
pystac/extensions/eo.py 93.15% <ø> (ø)
pystac/extensions/file.py 91.72% <ø> (ø)
pystac/extensions/item_assets.py 84.44% <ø> (ø)
pystac/extensions/label.py 93.75% <ø> (ø)
pystac/extensions/pointcloud.py 97.81% <ø> (ø)
pystac/extensions/projection.py 98.46% <ø> (ø)
pystac/extensions/raster.py 89.78% <ø> (ø)
pystac/extensions/sar.py 98.56% <ø> (ø)
pystac/extensions/sat.py 100.00% <ø> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca49adb...c39e43b. Read the comment docs.

duckontheweb added a commit to duckontheweb/pystac that referenced this pull request Jan 31, 2022
duckontheweb added a commit to duckontheweb/pystac that referenced this pull request Jan 31, 2022
@duckontheweb duckontheweb requested review from gadomski and removed request for lossyrob February 16, 2022 17:59
Copy link
Member

@gadomski gadomski left a comment

Choose a reason for hiding this comment

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

I got two batches of warnings when building locally, wanted to see if they were worth fixing with this PR. First:

/Users/gadomski/Code/pystac/pystac/extensions/datacube.py:docstring of pystac.extensions.datacube:3: WARNING: hardcoded link 'https://github.com/stac-extensions/datacube' could be replaced by an extlink (try using ':stac-ext:`datacube`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/eo.py:docstring of pystac.extensions.eo:3: WARNING: hardcoded link 'https://github.com/stac-extensions/eo' could be replaced by an extlink (try using ':stac-ext:`eo`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/file.py:docstring of pystac.extensions.file:3: WARNING: hardcoded link 'https://github.com/stac-extensions/file' could be replaced by an extlink (try using ':stac-ext:`file`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/item_assets.py:docstring of pystac.extensions.item_assets:3: WARNING: hardcoded link 'https://github.com/stac-extensions/item-assets' could be replaced by an extlink (try using ':stac-ext:`item-assets`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/label.py:docstring of pystac.extensions.label:3: WARNING: hardcoded link 'https://github.com/stac-extensions/label' could be replaced by an extlink (try using ':stac-ext:`label`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/pointcloud.py:docstring of pystac.extensions.pointcloud:3: WARNING: hardcoded link 'https://github.com/stac-extensions/pointcloud' could be replaced by an extlink (try using ':stac-ext:`pointcloud`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/projection.py:docstring of pystac.extensions.projection:3: WARNING: hardcoded link 'https://github.com/stac-extensions/projection' could be replaced by an extlink (try using ':stac-ext:`projection`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/raster.py:docstring of pystac.extensions.raster:3: WARNING: hardcoded link 'https://github.com/stac-extensions/raster' could be replaced by an extlink (try using ':stac-ext:`raster`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/raster.py:docstring of pystac.extensions.raster.RasterBand.apply:: WARNING: hardcoded link 'https://github.com/stac-extensions/raster/#data-types' could be replaced by an extlink (try using ':stac-ext:`raster/#data-types`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/raster.py:docstring of pystac.extensions.raster.RasterBand.create:: WARNING: hardcoded link 'https://github.com/stac-extensions/raster/#data-types' could be replaced by an extlink (try using ':stac-ext:`raster/#data-types`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/sar.py:docstring of pystac.extensions.sar:3: WARNING: hardcoded link 'https://github.com/stac-extensions/sar' could be replaced by an extlink (try using ':stac-ext:`sar`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/sat.py:docstring of pystac.extensions.sat:3: WARNING: hardcoded link 'https://github.com/stac-extensions/sat' could be replaced by an extlink (try using ':stac-ext:`sat`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/scientific.py:docstring of pystac.extensions.scientific:3: WARNING: hardcoded link 'https://github.com/stac-extensions/scientific' could be replaced by an extlink (try using ':stac-ext:`scientific`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/table.py:docstring of pystac.extensions.table:3: WARNING: hardcoded link 'https://github.com/stac-extensions/table' could be replaced by an extlink (try using ':stac-ext:`table`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/timestamps.py:docstring of pystac.extensions.timestamps:3: WARNING: hardcoded link 'https://github.com/stac-extensions/timestamps' could be replaced by an extlink (try using ':stac-ext:`timestamps`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/version.py:docstring of pystac.extensions.version:3: WARNING: hardcoded link 'https://github.com/stac-extensions/version' could be replaced by an extlink (try using ':stac-ext:`version`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/version.py:docstring of pystac.extensions.version.VersionRelType:3: WARNING: hardcoded link 'https://github.com/stac-extensions/version#relation-types' could be replaced by an extlink (try using ':stac-ext:`version#relation-types`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/view.py:docstring of pystac.extensions.view:3: WARNING: hardcoded link 'https://github.com/stac-extensions/view' could be replaced by an extlink (try using ':stac-ext:`view`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:736: WARNING: hardcoded link 'https://github.com/stac-extensions/eo' could be replaced by an extlink (try using ':stac-ext:`eo`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:736: WARNING: hardcoded link 'https://github.com/stac-extensions/view' could be replaced by an extlink (try using ':stac-ext:`view`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:736: WARNING: hardcoded link 'https://github.com/stac-extensions/projection' could be replaced by an extlink (try using ':stac-ext:`projection`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:817: WARNING: hardcoded link 'https://github.com/stac-extensions/eo#item-properties-or-asset-fields' could be replaced by an extlink (try using ':stac-ext:`eo#item-properties-or-asset-fields`' instead)

Second:

/Users/gadomski/Code/pystac/pystac/serialization/identify.py:docstring of pystac.serialization.identify.STACJSONDescription.extensions:1: WARNING: duplicate object description of pystac.serialization.identify.STACJSONDescription.extensions, other instance in api/serialization/identify, use :noindex: for one of them
/Users/gadomski/Code/pystac/pystac/serialization/identify.py:docstring of pystac.serialization.identify.STACJSONDescription.object_type:1: WARNING: duplicate object description of pystac.serialization.identify.STACJSONDescription.object_type, other instance in api/serialization/identify, use :noindex: for one of them
/Users/gadomski/Code/pystac/pystac/serialization/identify.py:docstring of pystac.serialization.identify.STACJSONDescription.version_range:1: WARNING: duplicate object description of pystac.serialization.identify.STACJSONDescription.version_range, other instance in api/serialization/identify, use :noindex: for one of them

I also have a couple of inline comments re: quick fixups.

pystac/utils.py Show resolved Hide resolved
pystac/utils.py Show resolved Hide resolved
duckontheweb added a commit to duckontheweb/pystac that referenced this pull request Feb 22, 2022
@duckontheweb
Copy link
Contributor Author

I got two batches of warnings when building locally, wanted to see if they were worth fixing with this PR. First:

/Users/gadomski/Code/pystac/pystac/extensions/datacube.py:docstring of pystac.extensions.datacube:3: WARNING: hardcoded link 'https://github.com/stac-extensions/datacube' could be replaced by an extlink (try using ':stac-ext:`datacube`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/eo.py:docstring of pystac.extensions.eo:3: WARNING: hardcoded link 'https://github.com/stac-extensions/eo' could be replaced by an extlink (try using ':stac-ext:`eo`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/file.py:docstring of pystac.extensions.file:3: WARNING: hardcoded link 'https://github.com/stac-extensions/file' could be replaced by an extlink (try using ':stac-ext:`file`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/item_assets.py:docstring of pystac.extensions.item_assets:3: WARNING: hardcoded link 'https://github.com/stac-extensions/item-assets' could be replaced by an extlink (try using ':stac-ext:`item-assets`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/label.py:docstring of pystac.extensions.label:3: WARNING: hardcoded link 'https://github.com/stac-extensions/label' could be replaced by an extlink (try using ':stac-ext:`label`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/pointcloud.py:docstring of pystac.extensions.pointcloud:3: WARNING: hardcoded link 'https://github.com/stac-extensions/pointcloud' could be replaced by an extlink (try using ':stac-ext:`pointcloud`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/projection.py:docstring of pystac.extensions.projection:3: WARNING: hardcoded link 'https://github.com/stac-extensions/projection' could be replaced by an extlink (try using ':stac-ext:`projection`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/raster.py:docstring of pystac.extensions.raster:3: WARNING: hardcoded link 'https://github.com/stac-extensions/raster' could be replaced by an extlink (try using ':stac-ext:`raster`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/raster.py:docstring of pystac.extensions.raster.RasterBand.apply:: WARNING: hardcoded link 'https://github.com/stac-extensions/raster/#data-types' could be replaced by an extlink (try using ':stac-ext:`raster/#data-types`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/raster.py:docstring of pystac.extensions.raster.RasterBand.create:: WARNING: hardcoded link 'https://github.com/stac-extensions/raster/#data-types' could be replaced by an extlink (try using ':stac-ext:`raster/#data-types`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/sar.py:docstring of pystac.extensions.sar:3: WARNING: hardcoded link 'https://github.com/stac-extensions/sar' could be replaced by an extlink (try using ':stac-ext:`sar`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/sat.py:docstring of pystac.extensions.sat:3: WARNING: hardcoded link 'https://github.com/stac-extensions/sat' could be replaced by an extlink (try using ':stac-ext:`sat`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/scientific.py:docstring of pystac.extensions.scientific:3: WARNING: hardcoded link 'https://github.com/stac-extensions/scientific' could be replaced by an extlink (try using ':stac-ext:`scientific`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/table.py:docstring of pystac.extensions.table:3: WARNING: hardcoded link 'https://github.com/stac-extensions/table' could be replaced by an extlink (try using ':stac-ext:`table`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/timestamps.py:docstring of pystac.extensions.timestamps:3: WARNING: hardcoded link 'https://github.com/stac-extensions/timestamps' could be replaced by an extlink (try using ':stac-ext:`timestamps`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/version.py:docstring of pystac.extensions.version:3: WARNING: hardcoded link 'https://github.com/stac-extensions/version' could be replaced by an extlink (try using ':stac-ext:`version`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/version.py:docstring of pystac.extensions.version.VersionRelType:3: WARNING: hardcoded link 'https://github.com/stac-extensions/version#relation-types' could be replaced by an extlink (try using ':stac-ext:`version#relation-types`' instead)
/Users/gadomski/Code/pystac/pystac/extensions/view.py:docstring of pystac.extensions.view:3: WARNING: hardcoded link 'https://github.com/stac-extensions/view' could be replaced by an extlink (try using ':stac-ext:`view`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:736: WARNING: hardcoded link 'https://github.com/stac-extensions/eo' could be replaced by an extlink (try using ':stac-ext:`eo`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:736: WARNING: hardcoded link 'https://github.com/stac-extensions/view' could be replaced by an extlink (try using ':stac-ext:`view`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:736: WARNING: hardcoded link 'https://github.com/stac-extensions/projection' could be replaced by an extlink (try using ':stac-ext:`projection`' instead)
/Users/gadomski/Code/pystac/docs/quickstart.ipynb:817: WARNING: hardcoded link 'https://github.com/stac-extensions/eo#item-properties-or-asset-fields' could be replaced by an extlink (try using ':stac-ext:`eo#item-properties-or-asset-fields`' instead)

This first batch of warnings was due to our use of hard-coded links in a lot of the extension modules (e.g. here) and in some of our tutorial notebooks. 6fc5008 replaces the hard-coded links in the source code with :stac-ext: extlink references. The links in the tutorial notebooks are a little trickier because we provide direct links to these notebooks in our docs (see the "GitHub Version" links to the tutorials here), so the :stac-ext: reference won't render properly as a link in those notebooks. Using Markdown syntax for the links results in the same warnings (see sphinx-doc/sphinx#10012(comment)).
I suppressed these warnings from the extlink extension in c39e43b, but I'm not sure if that's really the best approach since it suppresses all warnings coming out of that extension. We could also live with the remaining warnings for now until sphinx-doc/sphinx#10012 is resolved, I'm fine with either approach.

Second:

/Users/gadomski/Code/pystac/pystac/serialization/identify.py:docstring of pystac.serialization.identify.STACJSONDescription.extensions:1: WARNING: duplicate object description of pystac.serialization.identify.STACJSONDescription.extensions, other instance in api/serialization/identify, use :noindex: for one of them
/Users/gadomski/Code/pystac/pystac/serialization/identify.py:docstring of pystac.serialization.identify.STACJSONDescription.object_type:1: WARNING: duplicate object description of pystac.serialization.identify.STACJSONDescription.object_type, other instance in api/serialization/identify, use :noindex: for one of them
/Users/gadomski/Code/pystac/pystac/serialization/identify.py:docstring of pystac.serialization.identify.STACJSONDescription.version_range:1: WARNING: duplicate object description of pystac.serialization.identify.STACJSONDescription.version_range, other instance in api/serialization/identify, use :noindex: for one of them

I also have a couple of inline comments re: quick fixups.

This batch of warnings is fixed by 3d75e7a

@duckontheweb
Copy link
Contributor Author

I had to configure mypy to ignore missing sphinx.util type stubs to satisfy the CI even though I was unable to reproduce this issue locally.

@duckontheweb duckontheweb merged commit 2d175d1 into stac-utils:main Feb 23, 2022
@duckontheweb duckontheweb deleted the add/249-utils-documentation branch February 23, 2022 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document utils methods
3 participants