Skip to content

Commit c716299

Browse files
work to integrate with public python SDK. (#1)
Many changes. Initial refactoring while integrating with the Planet public python SDK
1 parent 59e78b9 commit c716299

File tree

95 files changed

+3385
-1440
lines changed

Some content is hidden

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

95 files changed

+3385
-1440
lines changed

.github/workflows/release-orchestrate.yml

+77-11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ on:
1717
- beta
1818
- rc
1919
- release
20+
publish-to:
21+
description: "Where to publish the package to"
22+
type: choice
23+
default: "none"
24+
options:
25+
- none
26+
- all
27+
- pypi-test
28+
- pypi-prod
2029

2130
env:
2231
PYTHON_VERSION: "3.13"
@@ -30,6 +39,10 @@ jobs:
3039
contents: write
3140
env:
3241
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
outputs:
43+
version: ${{steps.gen-buildnum.outputs.version}}
44+
version-with-buildnum: ${{steps.gen-buildnum.outputs.version-with-buildnum}}
45+
version-variant-raw: ${{steps.gen-buildnum.outputs.variant-raw}}
3346
steps:
3447
- name: "Checkout code"
3548
uses: actions/checkout@v4
@@ -39,34 +52,87 @@ jobs:
3952
with:
4053
build-variant: ${{ inputs.build-variant }}
4154
- name: "Tag repository"
42-
# Tagging is part of the build number generation in part because
43-
# tag uniqueness serves as a synchronization mechanism to prevent
44-
# multiple releases of the same version.
55+
# Tagging is part of the build number generation at the start of the
56+
# pipeline because tag uniqueness serves as a synchronization
57+
# mechanism to prevent multiple releases of the same version.
4558
run: |
4659
set -x
4760
git config --global user.email "[email protected]"
4861
git config --global user.name "CICD for github repository ${GITHUB_REPOSITORY}"
4962
if [ "${{ steps.gen-buildnum.outputs.variant-raw }}" = "release" ]
5063
then
51-
git tag -a -m "test tag comment for final release" "${{steps.gen-buildnum.outputs.version}}"
52-
git push origin "${{steps.gen-buildnum.outputs.version}}"
64+
git tag -a -m "Tagging from release orchestration pipeline" "${{steps.gen-buildnum.outputs.version}}"
65+
git push origin "${{steps.gen-buildnum.outputs.version}}"
5366
fi
54-
git tag -a -m "test tag comment" "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
55-
git push origin "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
67+
git tag -a -m "Tagging from release orchestration pipeline" "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
68+
git push origin "${{steps.gen-buildnum.outputs.version-with-buildnum}}"
5669
test:
5770
name: "Prerelease Tests"
5871
uses: ./.github/workflows/test.yml
59-
needs: generate-build-number # Doesn't really need it, but gates the pipeline to not waste time.
72+
# We do not really need the build number, but this gates the job so we do not waste
73+
# time testing a build that is attempting an illegal clobbering of a released version.
74+
needs: generate-build-number
75+
generate-release:
76+
name: "Create Github Release"
77+
runs-on: ubuntu-latest
78+
needs: [test, generate-build-number]
79+
permissions: write-all
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
steps:
83+
- name: "Create Github Release (Version candidate release)"
84+
# if: needs.generate-build-number.outputs.version-variant-raw != 'release'
85+
uses: actions/create-release@v1
86+
with:
87+
tag_name: "${{ needs.generate-build-number.outputs.version-with-buildnum }}"
88+
release_name: "${{ needs.generate-build-number.outputs.version-with-buildnum }}"
89+
draft: false
90+
prerelease: ${{ inputs.version-prerelease }}
91+
- name: "Create Github Release (Final version release)"
92+
if: needs.generate-build-number.outputs.version-variant-raw == 'release'
93+
uses: actions/create-release@v1
94+
with:
95+
tag_name: "${{ needs.generate-build-number.outputs.version }}"
96+
release_name: "${{ needs.generate-build-number.outputs.version }}"
97+
draft: false
98+
prerelease: ${{ inputs.version-prerelease }}
6099
package:
61100
name: "Build Release Artifacts"
62101
uses: ./.github/workflows/release-build.yml
63102
needs: [test, generate-build-number]
64103
publish:
65104
name: "Publish Release Artifacts"
66105
uses: ./.github/workflows/release-publish.yml
67-
needs: [package, generate-build-number]
106+
needs: [package, generate-release, generate-build-number]
107+
with:
108+
publish-to: ${{inputs.publish-to}}
68109
secrets:
69110
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
70111
PYPI_API_TOKEN_TEST: ${{ secrets.PYPI_API_TOKEN_TEST }}
71-
# with:
72-
# version-with-buildnumber: ${{needs.generate-build-number.outputs.version-with-buildnum}}
112+
publish-2:
113+
# Python trusted publishing does not currently support
114+
# reusable workflows. I really would prefer this be part
115+
# of "uses: ./.github/workflows/release-publish.yml" for
116+
# better encapsulation.
117+
# See https://github.com/pypi/warehouse/issues/11096
118+
name: "Publish Release Artifacts (Trusted)"
119+
needs: [package, generate-release, generate-build-number]
120+
if: inputs.publish-to == 'pypi-prod' || inputs.publish-to == 'all'
121+
runs-on: ubuntu-latest
122+
environment: pypi-prod
123+
permissions:
124+
# Needed for Trusted Publishing
125+
id-token: write
126+
steps:
127+
- name: "Download Wheel Package"
128+
uses: actions/download-artifact@v4
129+
with:
130+
name: planet-auth-wheel
131+
path: dist
132+
- name: "Download Source Package"
133+
uses: actions/download-artifact@v4
134+
with:
135+
name: planet-auth-src-targz
136+
path: dist
137+
- name: "Trusted Publishing - Publish to PyPi (Production)"
138+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/release-publish.yml

+38-20
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
name: Publish Release
22

3-
# TODO: create a github release. This is needed to trigger webhooks.
4-
53
permissions:
64
actions: read
75
contents: read
86

97
on:
108
workflow_call:
11-
# inputs:
12-
# version-with-buildnumber:
13-
# required: true
14-
# type: string
15-
# description: "The fully qualified unique version build number."
169
secrets:
1710
PYPI_API_TOKEN:
1811
PYPI_API_TOKEN_TEST:
12+
inputs:
13+
publish-to:
14+
description: "Where to publish the package to"
15+
type: string
16+
default: "none"
1917

2018
env:
2119
PYTHON_VERSION: "3.13"
2220

2321
jobs:
2422
release-pypi-test:
2523
name: "Release package to PyPi (Test)"
24+
if: inputs.publish-to == 'pypi-test' || inputs.publish-to == 'all'
2625
runs-on: ubuntu-latest
27-
# environment: staging
26+
# environment: pypi-test
2827
steps:
2928
- name: "Checkout code"
3029
uses: actions/checkout@v4
@@ -52,14 +51,35 @@ jobs:
5251
env:
5352
NOX_PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN_TEST }}
5453
run: |
55-
false
56-
# TODO: re-enable. Disabled for pipeline development
57-
# nox -s pkg_publish_pypi_test
54+
nox -s pkg_publish_pypi_test
55+
56+
# release-pypi-production:
57+
# name: "Release package to PyPi (Production)"
58+
# if: inputs.publish-to == 'pypi-prod' || inputs.publish-to == 'all'
59+
# runs-on: ubuntu-latest
60+
# # environment: pypi-prod
61+
# permissions:
62+
# # Needed for Trusted Publishing
63+
# id-token: write
64+
# steps:
65+
# - name: "Download Wheel Package"
66+
# uses: actions/download-artifact@v4
67+
# with:
68+
# name: planet-auth-wheel
69+
# path: dist
70+
# - name: "Download Source Package"
71+
# uses: actions/download-artifact@v4
72+
# with:
73+
# name: planet-auth-src-targz
74+
# path: dist
75+
# - name: "Trusted Publishing - Publish to PyPi (Production)"
76+
# uses: pypa/gh-action-pypi-publish@release/v1
5877

59-
release-pypi-production:
60-
name: "Release package to PyPi (Production)"
78+
release-none:
79+
name: "Release (None)"
80+
if: inputs.publish-to == 'none'
6181
runs-on: ubuntu-latest
62-
# environment: staging
82+
# environment: none
6383
steps:
6484
- name: "Checkout code"
6585
uses: actions/checkout@v4
@@ -77,13 +97,11 @@ jobs:
7797
with:
7898
name: planet-auth-src-targz
7999
path: dist
80-
- name: "Nox: Publish to PyPi (Production)"
81-
env:
82-
NOX_PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
100+
- name: "Nox: check package only. (Publishing NoOp / dry-run)"
83101
run: |
84-
false
85-
# TODO: re-enable. Disabled for pipeline development
86-
# nox -s pkg_publish_pypi_prod
102+
echo "Skipping publishing of python package."
103+
nox -s pkg_check
104+
87105
88106
# Read the docs is published via webhook GitHub webhook
89107
# release-readthedocs:

CONTRIBUTING.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
TODO: document submitting tickets and PRs. We will likely lean on the SDK process.
1+
This project is currently run as a child project of the
2+
[Planet SDK for Python](https://developers.planet.com/docs/pythonclient/)
3+
([on github](https://github.com/planetlabs/planet-client-python)).
4+
Please refer to that project for submitting issues and general discussion.

RELEASE.md

+14-4
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,15 @@ changes (like documentation).
1919
The `main` branch is intended to be kept stable with the most up-to-date
2020
feature set, and should normally be the branch used for new feature releases.
2121
Patch branches may be necessary when the need to fix older versions arises.
22+
The release pipelines supports releasing from any branch.
2223

2324
To release a new version, complete the following steps:
2425

2526
1. Create a release branch off of `main` that bumps the version number in
26-
[version.txt](./version.txt), and updates the
27-
[changelog.md](./docs/changelog.md).
27+
branch invariant [version.txt](./version.txt) file, and updates the
28+
[changelog.md](./docs/changelog.md). The [version-with-buildnum.txt](./version-with-buildnum.txt)
29+
should also be kept up to date, and is used to assign versions to local
30+
builds.
2831
2. Collect all features targeted for the intended release in the branch, and
2932
create a PR to merge the release branch into `main`.
3033
3. Ensure that all tests are passing on `main` branch after all merges.
@@ -35,11 +38,18 @@ To release a new version, complete the following steps:
3538
* `beta` - A beta release.
3639
* `alpha` - An alpha release
3740
* `dev` - A development release. This is the default.
38-
5. Initiate a release by activating the [Release Orchestration Workflow](./.github/workflows/release-orchestrate.yml) pipeline:
41+
5. Determine where to publish the python package to. This will be passed to the
42+
release workflow pipeline as the `publish-to` argument:
43+
* `none` - Skip actual publishing to PyPi servers. This is a dry-run pipeline.
44+
This is the default.
45+
* `pypi-test` - Publish to the test PyPi server
46+
* `pypi-prod` - Publish to the production PyPi server
47+
* `all` - Publish to all PyPi servers.
48+
6. Initiate a release by activating the [Release Orchestration Workflow](./.github/workflows/release-orchestrate.yml) pipeline:
3949
* The release pipeline may be initiated in the GUI.
4050
* The release pipeline may be initiated by the `gh` CLI as follows:
4151
```bash
42-
gh workflow run .github/workflows/release-orchestrate.yml -f build-variant=_selected_release_variation_
52+
gh workflow run .github/workflows/release-orchestrate.yml --ref _branch to release_ -f build-variant=_selected_release_variation_ -f publish-to=_selected_publication_target_
4353
```
4454

4555
## Local Publishing

docs/changelog.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Changelog
22

3-
## [Unreleased:2.0.0] - YYYY-MM-DD
4-
- 2.X is the initial public release of Planet auth libraries, targeting integration
5-
with our public Python SDK [`planet-client-python`](https://github.com/planetlabs/planet-client-python)/
6-
- 2.0.X is a development series, not intended for production. When ready,
7-
the version will be bumped to 2.1.
3+
## 2.0.4.X - 2025-03-09
4+
- Initial Beta release series to shakedown public release pipelines and
5+
initial integrations.
6+
7+
## [Unreleased: 2.0.0 - 2.0.3] - YYYY-MM-DD
8+
- 2.X is the initial public release of Planet auth libraries, targeting
9+
integration with our public Python SDK [`planet-client-python`](https://github.com/planetlabs/planet-client-python)

docs/cli-plauth.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% raw %}
44
::: mkdocs-click
55
:module: planet_auth_utils.commands.cli.main
6-
:command: plauth_cmd_group
6+
:command: cmd_plauth
77
:prog_name: plauth
88
:depth: 1
99
{% endraw %}

docs/examples.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ For example, to create a custom profile named "my-custom-profile", create the fo
5151
{% include 'auth-client-config/oauth-auth-code-grant-public-client.json' %}
5252
```
5353
2. Initialize the client library with the specified profile. Note: if the environment variable
54-
`PL_AUTH_PROFILE` is set, it will be detected automatically by [planet_auth.Auth.initialize_from_profile][],
54+
`PL_AUTH_PROFILE` is set, it will be detected automatically by [planet_auth_utils.PlanetAuthFactory][],
5555
and it will not be necessary to explicitly pass in the profile name:
5656
```python linenums="1"
5757
{% include 'auth-client/oauth/initialize-client-lib-on-disk-profile.py' %}

docs/examples/auth-client/oauth/initialize-client-lib-on-disk-profile.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
from planet_auth import Auth
1+
import planet_auth_utils
22

33

44
def main():
5-
auth_ctx = Auth.initialize_from_profile(profile="my-custom-profile")
5+
auth_ctx = planet_auth_utils.PlanetAuthFactory.initialize_auth_client_context(auth_profile_opt="my-custom-profile")
66
print("Auth context initialized from on disk profile {}".format(auth_ctx.profile_name()))
77

88

docs/examples/cli/embed-plauth-click.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
# TODO: Update (look at current planet SDK)
1111
@click.group(help="my cli main help message")
12-
@planet_auth_utils.opt_auth_profile
12+
@planet_auth_utils.opt_profile
1313
@planet_auth_utils.opt_token_file
1414
@click.pass_context
1515
def my_cli_main(ctx, auth_profile, token_file):
@@ -48,7 +48,7 @@ def do_cmd2(ctx):
4848
print("Payload:\n{}".format(result.text))
4949

5050

51-
my_cli_main.add_command(planet_auth_utils.embedded_plauth_cmd_group)
51+
my_cli_main.add_command(planet_auth_utils.cmd_plauth_embedded)
5252

5353
if __name__ == "__main__":
5454
my_cli_main() # pylint: disable=E1120

docs/img/logo-color.svg

+1
Loading

docs/img/logo-white.svg

+56
Loading

docs/index.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,5 @@ This library does not make any assumptions about the specific environment in whi
1818
it is operating, leaving that for higher level applications to configure.
1919

2020
The [Planet SDK for Python](https://developers.planet.com/docs/pythonclient/)
21-
leverages this library, and is pre-configured for the Planet Cloud Service used
21+
leverages this library, and is pre-configured for the Planet Insights Platform used
2222
by customers.
23-
s

0 commit comments

Comments
 (0)