Skip to content

Commit 6c97fd4

Browse files
doc improvements (#21)
* Prefer "paramters" over "args" for function documentation. * working on improving the docs * change stats badge * split up the API docs into two pages. * fix broken link to readthedocs * link checkers for docs * reorder secetions * link to multiple sources of download stats * adjust nav * improve CLI example * small fixes
1 parent 01824ee commit 6c97fd4

File tree

50 files changed

+463
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+463
-339
lines changed

.github/workflows/release-build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
# - name: "Nox: MKDocs Build"
5858
# run: |
5959
# nox -s mkdocs_build
60+
# - name: "Nox: MKDocs Check Links"
61+
# run: |
62+
# nox -s mkdocs_checklinks
6063
# - name: "Save Artifacts - MkDocs"
6164
# uses: actions/upload-artifact@v4
6265
# with:

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,8 @@ jobs:
173173
- name: 'Nox: MKDocs Build'
174174
run: |
175175
nox -s mkdocs_build
176+
# Not checking the links in the pipeline right now.
177+
# This is throwing some false positives on intra-md links
178+
# that build OK, and would also be caught by our mkdocs
179+
# strict mode setting.
180+
# nox -s mkdocs_checklinks

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Planet Auth Utility Library
22
[![Build Status](https://github.com/planetlabs/planet-auth-python/actions/workflows/test.yml/badge.svg)](https://github.com/planetlabs/planet-auth-python/actions/workflows/test.yml)
3-
[![PyPI Downloads](https://static.pepy.tech/badge/planet-auth)](https://pepy.tech/projects/planet-auth)
43
[![Read The Docs](https://app.readthedocs.org/projects/planet-auth/badge/)](https://planet-auth.readthedocs.io/)
4+
[![PyPI Downloads (pypistats.org)](https://img.shields.io/pypi/dm/planet-auth)](https://pypistats.org/packages/planet-auth)
5+
[![PyPI Downloads (peppy.tech)](https://static.pepy.tech/badge/planet-auth)](https://pepy.tech/projects/planet-auth)
56

67
The Planet Auth Library provides generic authentication utilities for clients
78
and for services. For clients, it provides means to obtain access tokens that

docs/api-planet-auth-utils.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ::: planet_auth_utils
2+
options:
3+
show_root_full_path: true
4+
inherited_members: true
5+
show_submodules: true
6+
show_if_no_docstring: false

docs/api-planet-auth.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ::: planet_auth
2+
options:
3+
show_root_full_path: true
4+
inherited_members: true
5+
show_submodules: true
6+
show_if_no_docstring: false

docs/api.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/built-ins.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Built-in Auth Client Profile Injection
2+
3+
TODO: Document how applications may inject built-in auth client profiles for
4+
a smoother application user and developer experience.

docs/changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Changelog
22

3-
## 2.1.0 - 2025 TBD
3+
## 2.1.0 - 2025-??-??
44
- Initial public release targeting integration with the
55
[Planet Client for Python](https://github.com/planetlabs/planet-client-python).
66

7-
## [Unreleased: 2.0.*] - YYYY-MM-DD
7+
## [Unreleased: 2.0.*]
88
- All releases in the 2.0.X series are development releases, even if not
99
tagged as such. This work included some shakedowns of the release pipelines.

docs/configuration.md

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,40 +9,13 @@ AuthClient Configuration dictionaries may either be provided directly, or loaded
99
from disk when saved in a `Profile` (See below).
1010

1111
While it is possible to work directly with the lower level implementation
12-
classes, it is generally simpler to use the higher level management code in
13-
[planet_auth.Auth][], or the factory methods in [planet_auth.AuthClient][]
14-
and [planet_auth.AuthClientConfig][] to configure and instantiate instances.
15-
Directly using the lower level implementations should not be necessary in
16-
most cases.
12+
classes, it is generally simpler to organize the working set of objects
13+
with an [Auth Context][planet_auth.Auth] instance created from one of the
14+
factory methods in [planet_auth_utils.PlanetAuthFactory][]
1715

1816
A number of auth client implementations are provided. Clients should
1917
select the one most appropriate for their use case.
2018

21-
### Planet Legacy Client
22-
Implemented by [planet_auth.PlanetLegacyAuthClient][] and [planet_auth.PlanetLegacyAuthClientConfig][]
23-
24-
Configuration:
25-
```json linenums="1" title="~/.planet/_profile_name_/auth_client.json"
26-
{% include 'auth-client-config/planet-legacy.json' %}
27-
```
28-
29-
Profile Usage:
30-
```python linenums="1"
31-
from planet_auth import Auth
32-
33-
auth_ctx = Auth.initialize_from_profile(profile="_profile_name_")
34-
```
35-
36-
37-
Direct Usage:
38-
```python linenums="1"
39-
from planet_auth import Auth
40-
auth_ctx = Auth.initialize_from_config_dict(
41-
client_config={ ... content of auth_client.json ... },
42-
token_file="/my_token_file.json"
43-
)
44-
```
45-
4619
### OAuth Clients
4720
#### Auth Code with PKCE
4821
Implemented by [planet_auth.AuthCodeAuthClient][] and [planet_auth.AuthCodeClientConfig][]
@@ -54,18 +27,16 @@ Configuration:
5427

5528
Profile Usage:
5629
```python linenums="1"
30+
{% include 'snippets/auth-client-context-from-saved-profile.py' %}
31+
5732
from planet_auth import Auth
5833

5934
auth_ctx = Auth.initialize_from_profile(profile="_profile_name_")
6035
```
6136

6237
Direct Usage:
6338
```python linenums="1"
64-
from planet_auth import Auth
65-
auth_ctx = Auth.initialize_from_config_dict(
66-
client_config={ ... content of auth_client.json ... },
67-
token_file="/my_token_file.json"
68-
)
39+
{% include 'snippets/auth-client-context-oauth-direct.py' %}
6940
```
7041

7142
#### Auth Code with PKCE and Client Public Key
@@ -164,6 +135,25 @@ outbound calls, which is one of the primary aims of most auth client types.
164135
Instead, this client configuration can only be used to validate incoming
165136
tokens.
166137

138+
### Planet Legacy Client
139+
Implemented by [planet_auth.PlanetLegacyAuthClient][] and [planet_auth.PlanetLegacyAuthClientConfig][]
140+
141+
Configuration:
142+
```json linenums="1" title="~/.planet/_profile_name_/auth_client.json"
143+
{% include 'auth-client-config/planet-legacy.json' %}
144+
```
145+
146+
Profile Usage:
147+
```python linenums="1"
148+
{% include 'snippets/auth-client-context-from-saved-profile.py' %}
149+
```
150+
151+
152+
Direct Usage:
153+
```python linenums="1"
154+
{% include 'snippets/auth-client-context-pl-legacy-direct.py' %}
155+
```
156+
167157
## Environment Variables
168158
See [planet_auth_utils.EnvironmentVariables][] for a list of environment variables.
169159

docs/examples-cli.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# CLI Examples
2+
3+
## Embedding the `plauth` Command in Another `click` Program
4+
It is possible to embed the [`plauth`](./cli-plauth.md) command into other programs to
5+
present a unified experience that leverages the _Planet Auth Library_
6+
package for client authentication plumbing. This is done by using
7+
a special version of the command that is configured for embedding.
8+
9+
When using the embedded version of the command, the outer application
10+
must take on the responsibility of instantiating the auth context and
11+
handling command line options so that this context may be available
12+
to click commands that are outside the `plauth` root command.
13+
14+
```python linenums="1"
15+
{% include 'cli/embed-plauth-click.py' %}
16+
```
17+
18+
## Advanced Embedding
19+
Beyond simple embedding, it is possible for an application to customize some
20+
the appearance and behavior of the command.
21+
22+
For example, an application may rename commands or hide options and sub-commands
23+
it does not wish to expose to the user. For an extensive example of this in a
24+
downstream application, you can look at the
25+
[Planet SDK](https://github.com/planetlabs/planet-client-python)'s
26+
CLI program, which both embeds the whole `plauth` command as a hidden
27+
root level sub-command [`planet plauth`](https://github.com/planetlabs/planet-client-python/blob/main/planet/cli/cli.py),
28+
and cherry-picks specific sub-commands to power its own
29+
[`auth`](https://github.com/planetlabs/planet-client-python/blob/main/planet/cli/auth.py)
30+
sub-command. This allows the downstream application to leverage the _Planet Auth Library_,
31+
while also using [configuration injection](./built-ins.md) to provide a smoother end-user experience

0 commit comments

Comments
 (0)