{"id":13737960,"url":"https://github.com/microsoft/planetary-computer-sdk-for-python","last_synced_at":"2025-09-22T12:30:57.985Z","repository":{"id":42711420,"uuid":"353473410","full_name":"microsoft/planetary-computer-sdk-for-python","owner":"microsoft","description":"Planetary Computer SDK for Python","archived":false,"fork":false,"pushed_at":"2024-07-15T17:30:19.000Z","size":94,"stargazers_count":75,"open_issues_count":7,"forks_count":17,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-01-06T12:17:17.310Z","etag":null,"topics":["aiforearth"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-31T19:52:20.000Z","updated_at":"2025-01-01T11:28:40.000Z","dependencies_parsed_at":"2022-07-14T01:10:36.820Z","dependency_job_id":"8d771d0e-a8b0-42c2-94ea-5af6dc03318f","html_url":"https://github.com/microsoft/planetary-computer-sdk-for-python","commit_stats":{"total_commits":58,"total_committers":9,"mean_commits":6.444444444444445,"dds":0.4137931034482759,"last_synced_commit":"30cc12bebe8a10bdd99bb0b32956cc2c8078a58d"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-sdk-for-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-sdk-for-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-sdk-for-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoft%2Fplanetary-computer-sdk-for-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoft","download_url":"https://codeload.github.com/microsoft/planetary-computer-sdk-for-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233846273,"owners_count":18739428,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiforearth"],"created_at":"2024-08-03T03:02:07.211Z","updated_at":"2025-09-22T12:30:57.471Z","avatar_url":"https://github.com/microsoft.png","language":"Python","funding_links":[],"categories":["Python","Planetary Computer"],"sub_categories":["Testing your code"],"readme":"# Planetary Computer SDK for Python\n\nPython library for interacting with the Microsoft Planetary Computer.\n\nFor general questions or discussions about the Planetary Computer, use the [microsoft/PlanetaryComputer](http://github.com/microsoft/PlanetaryComputer) repository.\n\n## Installation\n\n```python\npip install planetary-computer\n```\n\nIf you have an API subscription key, you may provide it to the library by using the included configuration CLI:\n\n```bash\nplanetarycomputer configure\n```\n\nAlternatively, a subscription key may be provided by specifying it in the `PC_SDK_SUBSCRIPTION_KEY` environment variable. A subcription key is not required for interacting with the service, however having one in place allows for less restricted rate limiting.\n\n\n## Usage\n\nThis library assists with signing Azure Blob Storage URLs. The `sign` function operates directly on an HREF string, as well as several [PySTAC](https://github.com/stac-utils/pystac) objects: `Asset`, `Item`, and `ItemCollection`. In addition, the `sign` function accepts a [STAC API Client](https://pystac-client.readthedocs.io/en/stable/) `ItemSearch`, which performs a search and returns the resulting `ItemCollection` with all assets signed.\n\n### Automatic signing\n\nIf you're using pystac-client we recommend you use its feature to [automatically sign results](https://pystac-client.readthedocs.io/en/stable/usage.html#automatically-modifying-results) with ``planetary_computer.sign_inplace``:\n\n```python\nimport planetary_computer\nimport pystac_client\n\nfrom pystac_client import Client\nimport planetary_computer, requests\napi = Client.open(\n   'https://planetarycomputer.microsoft.com/api/stac/v1',\n   modifier=planetary_computer.sign_inplace,\n)\n```\n\nNow all the results you get from that client will be signed.\n\n### Manual signing\n\nAlternatively, you can manually call ``planetary_computer.sign`` on your results.\n\n```python\nfrom pystac import Asset, Item, ItemCollection\nfrom pystac_client import ItemSearch\nimport planetary_computer as pc\n\n\n# The sign function may be called directly on the Item\nraw_item: Item = ...\nitem: Item = pc.sign(raw_item)\n# Now use the item however you want. All appropriate assets are signed for read access.\n\n# The sign function also works with an Asset\nraw_asset: Asset = raw_item.assets['SR_B4']\nasset = pc.sign(raw_asset)\n\n# The sign function also works with an HREF\nraw_href: str = raw_asset.href\nhref = pc.sign(raw_href)\n\n# The sign function also works with an ItemCollection\nraw_item_collection = ItemCollection([raw_item])\nitem_collection = pc.sign(raw_item_collection)\n\n# The sign function also accepts an ItemSearch, and signs the resulting ItemCollection\nsearch = ItemSearch(\n    url=...,\n    bbox=...,\n    collections=...,\n    limit=...,\n    max_items=...,\n)\nsigned_item_collection = pc.sign(search)\n```\n\n### Convenience methods\n\nYou'll occasionally need to interact with the Blob Storage container directly, rather than\nusing STAC items. We include two convenience methods for this:\n\n* `planetary_computer.get_container_client`: Get an [`azure.storage.blob.ContainerClient`](https://learn.microsoft.com/en-us/python/api/azure-storage-blob/azure.storage.blob.containerclient?view=azure-python)\n* `planetary_computer.get_adlfs_filesystem`: Get an [`adlfs.AzureBlobFilesystem`](https://github.com/fsspec/adlfs)\n\n## Development\n\nThe following steps may be followed in order to develop locally:\n\n```bash\n## Create and activate venv\npython3 -m venv env\nsource env/bin/activate\n\n## Install requirements\npython3 -m pip install -r requirements-dev.txt\n\n## Install locally\npip install -e .\n\n## Format code\n./scripts/format\n\n## Run tests\n./scripts/test\n```\n\n## Contributing\n\nThis project welcomes contributions and suggestions.  Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.\n\nWhen you submit a pull request, a CLA bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or\ncontact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n## Trademarks\n\nThis project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft\ntrademarks or logos is subject to and must follow\n[Microsoft's Trademark \u0026 Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).\nUse of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.\nAny use of third-party trademarks or logos are subject to those third-party's policies.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fplanetary-computer-sdk-for-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoft%2Fplanetary-computer-sdk-for-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoft%2Fplanetary-computer-sdk-for-python/lists"}