Skip to content

Commit bedbf62

Browse files
DRAFT: Update docs prior to pushing alpha out (#1140)
* update CONTRIBUTING and README to account for use of github projects and milestones. * minor updates to examples. * minor updates to auth guide. * 3.0 migration guide.
1 parent 154f418 commit bedbf62

12 files changed

+126
-50
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ insofar as is practical within the scope of changes targeted to the next major r
1919
versioning, major releases do not guarantee backwards compatibility. Stability is not guaranteed
2020
during the development cycle.
2121

22-
During the development cycle of a new major release, `RELEASE-PLANNING-X.0.md` should be maintained
23-
with a brief summary of the major and breaking changes underpinning the reason for the upcoming
24-
major release version. Upon release, this content is expected to be folded into package documentation
25-
as appropriate, and this file should be removed.
22+
During the development cycle of a new major release, a GitHub Project and Milestone should be
23+
created to track changes targeted the release. A file such as `RELEASE-PLANNING-X.0.md` in the
24+
root of the source tree may be used for early development prior to the creation of a GitHub
25+
project, but should be retired when a new release becomes more formalized. Upon release,
26+
all content is expected to be folded into package documentation as appropriate (announcements,
27+
company blog posts, changelogs, migration guides, etc.).
2628

2729
When a new major release is ready, the development mainline branch will be renamed to `main`, and the
2830
old mainline branch will be renamed to `maint-X.0` and will be used as the base for maintenance releases.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ See [CONTRIBUTING.md](CONTRIBUTING.md#branches) for more information on branches
8181

8282
##### Current Mainline Versions and Branches
8383

84-
| Version | Status | Branch | Documentation | Initial Release | End of Active Development | End of Maintenance | Notes |
85-
|---------|---------------|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------|---------------------------|--------------------|------------------------------------------------------------------------------------------------------------------------------|
86-
| 3.x | `development` | [`main-3.0-dev`](https://github.com/planetlabs/planet-client-python/tree/main-3.0-dev) | TBD | TBD | TBD | TBD | See [RELEASE-PLANNING-X.0.md](https://github.com/planetlabs/planet-client-python/tree/main-3.0-dev/RELEASE-PLANNING-3.0.md). |
87-
| 2.x | `active` | [`main`](https://github.com/planetlabs/planet-client-python/tree/main) | [Planet Labs Python Client v2 on Readthedocs.io](https://planet-sdk-for-python-v2.readthedocs.io/en/latest/) | April 2023 | TBD | TBD | |
88-
| 1.x | `end-of-life` | [`v1`](https://github.com/planetlabs/planet-client-python/tree/v1) | [Planet Labs Python Client v1 on Github.io](https://planetlabs.github.io/planet-client-python/) | April 2017 | April 2023 | TBD | |
84+
| Version | Status | Branch | Documentation | Initial Release | End of Active Development | End of Maintenance | Notes |
85+
|---------|---------------|----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|-----------------|---------------------------|--------------------|-------------------------------------------------------------------------------------------------|
86+
| 3.x | `development` | [`main-3.0-dev`](https://github.com/planetlabs/planet-client-python/tree/main-3.0-dev) | [Planet Labs Python Client on ReadTheDocs.io](https://planet-sdk-for-python.readthedocs.io/en/latest/) | TBD | TBD | TBD | See [3.0.0 Release Milestone](https://github.com/planetlabs/planet-client-python/milestone/31). |
87+
| 2.x | `active` | [`main`](https://github.com/planetlabs/planet-client-python/tree/main) | [Planet Labs Python Client v2 on ReadTheDocs.io](https://planet-sdk-for-python-v2.readthedocs.io/en/latest/) | April 2023 | TBD | TBD | |
88+
| 1.x | `end-of-life` | [`v1`](https://github.com/planetlabs/planet-client-python/tree/v1) | [Planet Labs Python Client v1 on Github.io](https://planetlabs.github.io/planet-client-python/) | April 2017 | April 2023 | TBD | |
8989

9090
## Installation and Quick Start
9191

RELEASE-PLANNING-3.0.md

Lines changed: 0 additions & 13 deletions
This file was deleted.
File renamed without changes.

docs/get-started/upgrading-v3.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Upgrade from Version 2 to Version 3
2+
3+
Version 3 of the Planet SDK for Python is a major update of the SDK offering
4+
new features, not all of which are backwards compatible with version 2.
5+
6+
## Authentication
7+
Version 3 of the SDK removes support for Planet's legacy authentication network
8+
protocols in favor of OAuth2 based mechanisms. The legacy protocols
9+
were never a [documented Planet API](https://docs.planet.com/develop/apis/), but could
10+
easily be understood by inspection of the SDK code.
11+
12+
Specifically, what is being deprecated in version 3 are the paths where the SDK
13+
handled a username and password to obtain the user's API key for forward
14+
operations. Users may still operate with an API key by retrieving it from the
15+
Planet user interface under [My Settings](https://www.planet.com/account/#/user-settings)
16+
and providing it to the SDK. While API keys remain supported for machine-to-machine
17+
API use cases using `api.planet.com` APIs, OAuth2 mechanisms should be preferred
18+
where the use case allows for it.
19+
20+
Users may also continue to initialize SDK and CLI sessions with their username
21+
and password, but rather than being processed by the SDK itself a browser must
22+
be invoked to complete OAuth2 client session initialization.
23+
This new method is intended to offer a number of long term benefits, including:
24+
25+
* The new method provides the SDK and the CLI with access tokens that may be
26+
used with both `api.planet.com` and `services.sentinel-hub.com` endpoints. The method
27+
used by version 2 of the SDK was specific to `api.planet.com` endpoints, and
28+
will never be supported by `services.sentinel-hub.com` endpoints.
29+
* The new method extends (currently optional) multifactor authentication (MFA)
30+
to SDK and CLI client use cases.
31+
* The new method is compatible with other platform enhancements currently under
32+
development by Planet's software engineering team.
33+
34+
For complete details on the new mechanisms, see the [Client Authentication Guide](../python/sdk-client-auth.md).
35+
36+
### CLI Usage
37+
The [`planet auth`](../../cli/cli-reference/#auth) command has been substantially
38+
revised to align to the new authentication mechanisms. For migration from version 2
39+
of the SDK, the following changes are the most important to note:
40+
41+
* The `planet auth init` command has been replaced with [`planet auth login`](../../cli/cli-reference/#login).
42+
By default, this command will open a browser window to allow the user to log
43+
in to their Planet account and authorize the SDK or CLI to access their account.
44+
Other options are available to support a variety of use cases, including a
45+
`--no-open-browser` option for remote shells. See `planet auth login --help`
46+
for complete details.
47+
* The `planet auth value` command has been deprecated. Depending on whether the SDK
48+
has been initialized with OAuth2 or API key authentication,
49+
[`planet auth print-access-token`](../../cli/cli-reference/#print-access-token)
50+
or [`planet auth print-api-key`](../../cli/cli-reference/#print-api-key) may
51+
be used. OAuth2 sessions should be preferred where possible.
52+
* The `planet auth store` command has been deprecated. The various options to the
53+
`planet auth login` command should provide suitable alternatives for all use cases.
54+
OAuth2 sessions should be favored for user interactive use cases, such as CLI usage.
55+
`planet auth login --auth-api-key YOUR_API_KEY` may be used to initialize the SDK
56+
with API key based authentication where the use case requires it.
57+
58+
### Session Persistence
59+
Both version 2 and version 3 of the SDK use the `~/.planet.json` file in the user's
60+
home directory to store user's API key. If this file is present and was configured
61+
by version 2 of the SDK, it should continue to work.
62+
63+
While the `~/.planet.json` file continues to be used by version 3, and version 3
64+
understands files written by version 2, version 3 will not write the same information
65+
to this file that version 2 did. Version 3 uses this file in conjunction with the
66+
`~/.planet` directory and subdirectories to store OAuth2 tokens and additional
67+
session information needed for a smooth user experience.
68+
69+
Version 3 of the SDK provides a [`planet auth reset`](../../cli/cli-reference/#reset)
70+
command to reset all saved state should it become corrupted. When this command is run,
71+
the old files are moved aside rather than deleted.
72+
73+
### SDK Session Initialization
74+
See the [Client Authentication Guide](../python/sdk-client-auth.md) for a complete
75+
discussion of all options now available.
76+
77+
Basic SDK use cases should work with no alterations.
78+
User sessions initialized by [`planet auth login`](../../cli/cli-reference/#login)
79+
will be detected by an application using a default Planet client when
80+
run in an environment with access to the user's home directory. For example:
81+
82+
```python linenums="1"
83+
{% include 'auth-session-management/cli_managed_auth_state__implicit.py' %}
84+
```
85+
86+
Applications may also continue to initialize the SDK with a specific API key as follows:
87+
```python linenums="1"
88+
{% include 'auth-session-management/app_managed_auth_state__in_memory__api_key.py' %}
89+
```
90+
91+
Users developing new applications should consult the [Client Authentication Guide](../python/sdk-client-auth.md)
92+
for a complete discussion of all OAuth2 based mechanisms. OAuth2 mechanisms
93+
should be preferred to the use of Planet API keys.
94+
95+
----

docs/python/sdk-client-auth.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,22 @@ For general information on how to authenticate to Planet APIs, please see
88
the [Authentication](https://docs.planet.com/develop/authentication) section of Planet's platform documentation.
99

1010
!!! warning
11-
Some statements are forward-looking. OAuth2 M2M tokens are
12-
currently only supported by `services.sentine-hub.com` and not supported
13-
by `api.planet.com`.
11+
Some statements in this guide are forward-looking.
12+
13+
OAuth2 M2M tokens are currently only supported by `services.sentine-hub.com`,
14+
and are not yet supported by `api.planet.com`. This is planned for a future date
15+
to be announced.
1416

1517
All APIs support interactive user OAuth2 access tokens, but a process for
1618
developers to register and manage clients has not yet been made public.
1719
We have also not yet release a way for end-users of such applications to
1820
manage which applications have been authorized to access the platform on
1921
their behalf.
2022

21-
If you would like to developed an interactive application that uses
22-
Planet's APIs on behalf of a user (as the `planet` CLI utility does),
23-
please contact Planet and work with engineering to register your
24-
application.
23+
If you would like to develop an interactive application that uses
24+
Planet's APIs on behalf of a logged-in user (as the `planet` CLI utility
25+
does), please contact Planet support and work with engineering to
26+
register your application.
2527

2628
----
2729
## Authentication Protocols
@@ -213,7 +215,7 @@ complete user authentication. This architecture allows for greater security
213215
by keeping the user's password from being directly exposed to the application
214216
code. This also allows for flexibility in user federation and multifactor
215217
authentication procedures without the complexity of these needing to
216-
be exposes to the application developer who is focused on geospatial
218+
be exposed to the application developer who is focused on geospatial
217219
operations using the Planet platform, and not the nuances of user
218220
authentication and authorization.
219221

examples/auth-session-management/app_managed_auth_state__app_custom_storage__oauth_m2m.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ def _save_file(file_path: pathlib.Path, data: dict):
7575

7676

7777
def example_main():
78-
# Create an auth context with a client ID that
79-
# is unique to this application.
78+
# Create an auth context with the client ID and secret of the service account.
8079
plsdk_auth = planet.Auth.from_oauth_m2m(
8180
client_id="__MUST_BE_END_USER_SUPPLIED__",
8281
client_secret="__MUST_BE_END_USER_SUPPLIED__",

examples/auth-session-management/app_managed_auth_state__in_memory__api_key.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
import json
2-
import logging
32
import planet
43

5-
logging.basicConfig(level=logging.CRITICAL)
6-
74

85
def example_main():
96
# Create an auth context with the specified API key

examples/auth-session-management/app_managed_auth_state__in_memory__oauth_m2m.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
import json
2-
import logging
32
import planet
43

5-
logging.basicConfig(level=logging.CRITICAL)
6-
74

85
def example_main():
9-
# Create an auth context with a client ID that
10-
# is unique to this application.
6+
# Create an auth context with the client ID and secret of the service account.
117
plsdk_auth = planet.Auth.from_oauth_m2m(
128
client_id="__MUST_BE_END_USER_SUPPLIED__",
139
client_secret="__MUST_BE_END_USER_SUPPLIED__",
@@ -17,7 +13,7 @@ def example_main():
1713
# Explicit login is not required for M2M client use. The above is sufficient.
1814
# plsdk_auth.user_login()
1915

20-
# Create a Planet SDK object that uses the loaded auth session/
16+
# Create a Planet SDK object that uses the loaded auth session.
2117
sess = planet.Session(plsdk_auth)
2218
pl = planet.Planet(sess)
2319

examples/auth-session-management/app_managed_auth_state__on_disk_cli_shared__oauth_m2m.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66

77

88
def example_main():
9-
# Create an auth context with a client ID that
10-
# is unique to this application.
9+
# Create an auth context with the client ID and secret of the service account.
1110
plsdk_auth = planet.Auth.from_oauth_m2m(
1211
client_id="__MUST_BE_END_USER_SUPPLIED__",
1312
client_secret="__MUST_BE_END_USER_SUPPLIED__",

examples/auth-session-management/cli_managed_auth_state__implicit.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import json
2-
import logging
32
import planet
43

5-
logging.basicConfig(level=logging.CRITICAL)
6-
74

85
def example_main():
96
# By default, the Planet SDK will be instantiated with the default auth
107
# session configured by `planet auth` and saved to disk. This default
11-
# initialization will also take information from environment variables.
8+
# initialization will also inspect environment variables for configuration.
129
pl = planet.Planet()
1310

1411
# Use the SDK to call Planet APIs.
15-
# Refreshing access tokens will be managed automatically by the SDK.
12+
# Refreshing OAuth2 access tokens will be managed automatically by the SDK.
1613
for item in pl.data.list_searches():
1714
print(json.dumps(item, indent=2, sort_keys=True))
1815

mkdocs.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ plugins:
6262
selection:
6363
inherited_members: true
6464
filters:
65-
- "!^_" # exlude all members starting with _
65+
- "!^_" # exclude all members starting with _
6666
- "^__init__$" # but always include __init__ modules and methods
6767
watch:
6868
- planet
@@ -76,7 +76,9 @@ nav:
7676
- get-started/quick-start-guide.md
7777
- get-started/get-your-planet-account.md
7878
- get-started/venv-tutorial.md
79-
- get-started/upgrading.md
79+
- "Upgrade Guides":
80+
- get-started/upgrading-v3.md
81+
- get-started/upgrading-v2.md
8082
- "No Code CLI":
8183
- cli/cli-guide.md
8284
- cli/cli-intro.md

0 commit comments

Comments
 (0)