unleashed-podcasts-cli 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unleashed_podcasts_cli-0.4.0/.github/workflows/ci.yml +42 -0
- unleashed_podcasts_cli-0.4.0/.github/workflows/release.yml +75 -0
- unleashed_podcasts_cli-0.4.0/.gitignore +16 -0
- unleashed_podcasts_cli-0.4.0/CHANGELOG.md +60 -0
- unleashed_podcasts_cli-0.4.0/CONTRIBUTING.md +77 -0
- unleashed_podcasts_cli-0.4.0/LICENSE +21 -0
- unleashed_podcasts_cli-0.4.0/Makefile +38 -0
- unleashed_podcasts_cli-0.4.0/PKG-INFO +461 -0
- unleashed_podcasts_cli-0.4.0/PRD.md +490 -0
- unleashed_podcasts_cli-0.4.0/README.md +437 -0
- unleashed_podcasts_cli-0.4.0/pyproject.toml +71 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/__init__.py +3 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/auth.py +209 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/cli.py +211 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/client.py +169 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/config.py +217 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/errors.py +109 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/generator.py +805 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/manifest.py +215 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/output.py +76 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/reporting.py +48 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/__init__.py +12 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/episodes.py +95 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/ideas.py +40 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/leads.py +55 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/people.py +46 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/short_form_videos.py +54 -0
- unleashed_podcasts_cli-0.4.0/src/unleashed/resources/tasks.py +31 -0
- unleashed_podcasts_cli-0.4.0/tests/conftest.py +99 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_episodes_actions.py +323 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_episodes_create.py +270 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_ideas.py +166 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_leads.py +208 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_people.py +260 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_short_form_videos.py +239 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_tasks.py +147 -0
- unleashed_podcasts_cli-0.4.0/tests/test_cli_transcript.py +193 -0
- unleashed_podcasts_cli-0.4.0/tests/test_client.py +153 -0
- unleashed_podcasts_cli-0.4.0/tests/test_config.py +197 -0
- unleashed_podcasts_cli-0.4.0/tests/test_configure_command.py +71 -0
- unleashed_podcasts_cli-0.4.0/tests/test_edge_cases.py +77 -0
- unleashed_podcasts_cli-0.4.0/tests/test_live.py +39 -0
- unleashed_podcasts_cli-0.4.0/tests/test_login.py +405 -0
- unleashed_podcasts_cli-0.4.0/tests/test_main.py +89 -0
- unleashed_podcasts_cli-0.4.0/tests/test_manifest.py +84 -0
- unleashed_podcasts_cli-0.4.0/tests/test_output.py +67 -0
- unleashed_podcasts_cli-0.4.0/uv.lock +694 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
10
|
+
cancel-in-progress: true
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v5
|
|
25
|
+
with:
|
|
26
|
+
enable-cache: true
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: uv sync --python ${{ matrix.python-version }}
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: uv run ruff check .
|
|
33
|
+
|
|
34
|
+
- name: Check formatting
|
|
35
|
+
run: uv run ruff format --check .
|
|
36
|
+
|
|
37
|
+
- name: Type check
|
|
38
|
+
run: uv run mypy
|
|
39
|
+
|
|
40
|
+
# Live tests are deselected by pytest config. No credentials reach CI.
|
|
41
|
+
- name: Test and enforce the 90% coverage gate
|
|
42
|
+
run: uv run pytest
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Publishing is driven by a tag, so the released artifact always corresponds to a
|
|
4
|
+
# commit that exists. Tag v0.1.0 -> builds -> publishes -> GitHub Release.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Install uv
|
|
16
|
+
uses: astral-sh/setup-uv@v5
|
|
17
|
+
with:
|
|
18
|
+
enable-cache: true
|
|
19
|
+
|
|
20
|
+
- name: Refuse to release a tag that disagrees with pyproject.toml
|
|
21
|
+
run: |
|
|
22
|
+
tag="${GITHUB_REF_NAME#v}"
|
|
23
|
+
version="$(uv run python -c 'import tomllib,pathlib; print(tomllib.loads(pathlib.Path("pyproject.toml").read_text())["project"]["version"])')"
|
|
24
|
+
if [ "$tag" != "$version" ]; then
|
|
25
|
+
echo "Tag $GITHUB_REF_NAME does not match project version $version." >&2
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
echo "Releasing $version"
|
|
29
|
+
|
|
30
|
+
# A release must not ship code that would fail CI.
|
|
31
|
+
- run: uv run ruff check .
|
|
32
|
+
- run: uv run ruff format --check .
|
|
33
|
+
- run: uv run mypy
|
|
34
|
+
- run: uv run pytest
|
|
35
|
+
|
|
36
|
+
- run: uv build
|
|
37
|
+
|
|
38
|
+
- uses: actions/upload-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: dist
|
|
41
|
+
path: dist/
|
|
42
|
+
|
|
43
|
+
publish:
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
# Trusted Publishing: GitHub proves its identity to PyPI over OIDC, so there is
|
|
47
|
+
# no long-lived API token in repository secrets to leak or rotate.
|
|
48
|
+
environment:
|
|
49
|
+
name: pypi
|
|
50
|
+
url: https://pypi.org/p/unleashed-podcasts-cli
|
|
51
|
+
permissions:
|
|
52
|
+
id-token: write
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/download-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: dist
|
|
57
|
+
path: dist/
|
|
58
|
+
|
|
59
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
60
|
+
|
|
61
|
+
github-release:
|
|
62
|
+
needs: publish
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
permissions:
|
|
65
|
+
contents: write
|
|
66
|
+
steps:
|
|
67
|
+
- uses: actions/download-artifact@v4
|
|
68
|
+
with:
|
|
69
|
+
name: dist
|
|
70
|
+
path: dist/
|
|
71
|
+
|
|
72
|
+
- uses: softprops/action-gh-release@v2
|
|
73
|
+
with:
|
|
74
|
+
files: dist/*
|
|
75
|
+
generate_release_notes: true
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.4.0] - 2026-11-02
|
|
10
|
+
|
|
11
|
+
First published release. It covers the v0.1, v0.2, and v0.4 milestones in
|
|
12
|
+
[PRD.md](PRD.md); v0.3 (podcasts) is still blocked on server work.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
|
|
16
|
+
- `episodes transcript get` (with `--format none` for status polling) and
|
|
17
|
+
`episodes transcript utterances list` (paginated, with `--with-words`), from new
|
|
18
|
+
manifest `Document` and `Listing` declarations.
|
|
19
|
+
- `leads` — all five standard actions, generated from the existing manifest.
|
|
20
|
+
- `leads create --cli-input-json '[...]'` sends a batch of up to 25. Every per-item
|
|
21
|
+
outcome is printed, and the command exits 3 if any item was invalid. From a new
|
|
22
|
+
manifest `batch_create_max` attribute.
|
|
23
|
+
- `tasks` — all five standard actions, generated from a manifest.
|
|
24
|
+
- `unleashed login` now asks for `tasks:read` and `tasks:write` by default.
|
|
25
|
+
- `ideas` — all five standard actions, generated from a manifest.
|
|
26
|
+
- `unleashed login` — approve the CLI in a browser and save the personal access token
|
|
27
|
+
it is issued. Loopback redirect to 127.0.0.1 plus a code-and-verifier exchange, so
|
|
28
|
+
the token never passes through the browser. `--ability`, `--device-name`,
|
|
29
|
+
`--api-url`, `--no-browser`, `--profile`, and `--local`.
|
|
30
|
+
- `unleashed whoami` — the user, device name, and abilities behind the current token.
|
|
31
|
+
- Exit code 8 for a 403: the token is valid but lacks the ability the route needs.
|
|
32
|
+
401 and 403 errors now say to run `unleashed login`.
|
|
33
|
+
- `short-form-videos` — all five standard actions, generated from a manifest.
|
|
34
|
+
- `short-form-videos video-file attach|detach`, from a new manifest `Attachment`
|
|
35
|
+
declaration that any resource can reuse.
|
|
36
|
+
- `people` — all five standard actions, with repeatable `--metadata KEY=VALUE` on
|
|
37
|
+
create and update.
|
|
38
|
+
- `people metadata merge|replace`, from a new manifest `KeyValueMap` declaration.
|
|
39
|
+
`merge` takes `--set` and `--unset`; both take `--cli-input-json` for typed values.
|
|
40
|
+
- A manifest `singular_name`, so help reads "Create one person."
|
|
41
|
+
- All five standard actions for episodes — `list`, `create`, `get`, `update`, `delete` —
|
|
42
|
+
generated from a declarative resource manifest.
|
|
43
|
+
- `list` auto-paginates, with `--no-paginate` and `--max-items` to spend less.
|
|
44
|
+
- `list` filters and `--sort` are generated from the manifest; a sort outside the
|
|
45
|
+
allowlist is rejected before the request is sent.
|
|
46
|
+
- `update` distinguishes an omitted flag from `--clear-<field>`, which sends null.
|
|
47
|
+
- Layered configuration: a local `.unleashed/config` overrides `~/.unleashed/config`
|
|
48
|
+
key by key, with `UNLEASHED_API_URL` / `UNLEASHED_API_TOKEN` as the lowest fallback.
|
|
49
|
+
- The local config is found by walking up from the working directory.
|
|
50
|
+
- Named profiles via `--profile` and `UNLEASHED_PROFILE`.
|
|
51
|
+
- `unleashed configure`, writing one profile at mode 0600 and leaving others intact.
|
|
52
|
+
- A warning when a config file holding a token is readable by other users.
|
|
53
|
+
- `--dry-run`, which prints the request with the token redacted and sends nothing.
|
|
54
|
+
- `--output json|text|table` and `--query` (JMESPath).
|
|
55
|
+
- `--cli-input-json` as an alternative to field flags.
|
|
56
|
+
- Distinct exit codes per API failure mode.
|
|
57
|
+
- Bounded retry on 429 that honours `Retry-After`.
|
|
58
|
+
|
|
59
|
+
[Unreleased]: https://github.com/ScottKeckWarren/UnleashedPodcastsCli/compare/v0.4.0...HEAD
|
|
60
|
+
[0.4.0]: https://github.com/ScottKeckWarren/UnleashedPodcastsCli/releases/tag/v0.4.0
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
uv sync
|
|
7
|
+
uv run pytest
|
|
8
|
+
make install-hooks # run `make pre-commit` before every commit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`make pre-commit` runs exactly what CI runs: `ruff check .`, `ruff format --check .`,
|
|
12
|
+
`mypy`, and `pytest` with the coverage gate. Note that `ruff format` also checks Python
|
|
13
|
+
code blocks inside Markdown files such as `PRD.md`.
|
|
14
|
+
|
|
15
|
+
## The two rules
|
|
16
|
+
|
|
17
|
+
**1. Test first.** Every behavioural change lands as a failing test before the code that
|
|
18
|
+
makes it pass. A pull request whose tests would have passed before the change is not
|
|
19
|
+
finished.
|
|
20
|
+
|
|
21
|
+
**2. Coverage stays at or above 90%.** `pytest` is configured with `--cov-fail-under=90`,
|
|
22
|
+
so a shortfall fails locally and in CI. Do not lower the threshold to make a build pass —
|
|
23
|
+
raise the coverage, or explain in the pull request why a line is genuinely untestable and
|
|
24
|
+
mark it `# pragma: no cover`.
|
|
25
|
+
|
|
26
|
+
## Tests never hit the network
|
|
27
|
+
|
|
28
|
+
The default suite mocks every HTTP call with `respx` against the contract in `PRD.md`.
|
|
29
|
+
Contributors need no credentials and no server to run everything.
|
|
30
|
+
|
|
31
|
+
An optional live suite is marked `@pytest.mark.live` and is deselected by default. It runs
|
|
32
|
+
against a local Sail host to catch drift between the documented contract and the real API.
|
|
33
|
+
It never counts toward the coverage gate and never runs in CI.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
UNLEASHED_API_URL=http://localhost/apiv1 UNLEASHED_API_TOKEN=... uv run pytest -m live --no-cov
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Every test runs with `HOME` and the working directory pointed at a temporary directory,
|
|
40
|
+
so a test can never read — or write — your real `~/.unleashed/config`. That isolation is
|
|
41
|
+
automatic; do not disable it.
|
|
42
|
+
|
|
43
|
+
## Adding a resource
|
|
44
|
+
|
|
45
|
+
Resources are declared, not hand-written. Add a manifest under `src/unleashed/resources/`
|
|
46
|
+
and register it. If you find yourself editing the generator to accommodate one resource,
|
|
47
|
+
stop — that behaviour belongs in the manifest as a new field attribute, the same rule the
|
|
48
|
+
API itself follows.
|
|
49
|
+
|
|
50
|
+
## Before opening a pull request
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
uv run ruff check .
|
|
54
|
+
uv run ruff format --check .
|
|
55
|
+
uv run mypy
|
|
56
|
+
uv run pytest
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Releasing
|
|
60
|
+
|
|
61
|
+
Releases are tag-driven. The workflow refuses to publish a tag that disagrees with the
|
|
62
|
+
version in `pyproject.toml`, and re-runs lint, types, and the full test suite before
|
|
63
|
+
building — a release must never ship code that would fail CI.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# bump version in pyproject.toml, update CHANGELOG.md, commit
|
|
67
|
+
git tag v0.1.0
|
|
68
|
+
git push origin v0.1.0
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
That builds, publishes to PyPI via Trusted Publishing, and cuts a GitHub Release with
|
|
72
|
+
the artifacts attached. There is no PyPI API token in repository secrets; GitHub proves
|
|
73
|
+
its identity to PyPI over OIDC instead.
|
|
74
|
+
|
|
75
|
+
One-time setup on PyPI, done in a browser: register this repository as a trusted
|
|
76
|
+
publisher for the `unleashed-podcasts-cli` project, with workflow `release.yml` and
|
|
77
|
+
environment `pypi`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Scott Keck-Warren
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Developer tasks. `make pre-commit` runs the same checks as CI, in the same order.
|
|
2
|
+
|
|
3
|
+
.PHONY: help install lint format format-check typecheck test pre-commit install-hooks
|
|
4
|
+
|
|
5
|
+
help:
|
|
6
|
+
@echo "make install Sync dependencies"
|
|
7
|
+
@echo "make lint ruff check"
|
|
8
|
+
@echo "make format ruff format (rewrites files)"
|
|
9
|
+
@echo "make format-check ruff format --check"
|
|
10
|
+
@echo "make typecheck mypy --strict"
|
|
11
|
+
@echo "make test pytest with the 90% coverage gate"
|
|
12
|
+
@echo "make pre-commit Everything CI runs"
|
|
13
|
+
@echo "make install-hooks Run 'make pre-commit' before every git commit"
|
|
14
|
+
|
|
15
|
+
install:
|
|
16
|
+
uv sync
|
|
17
|
+
|
|
18
|
+
lint:
|
|
19
|
+
uv run ruff check .
|
|
20
|
+
|
|
21
|
+
format:
|
|
22
|
+
uv run ruff format .
|
|
23
|
+
|
|
24
|
+
format-check:
|
|
25
|
+
uv run ruff format --check .
|
|
26
|
+
|
|
27
|
+
typecheck:
|
|
28
|
+
uv run mypy
|
|
29
|
+
|
|
30
|
+
test:
|
|
31
|
+
uv run pytest
|
|
32
|
+
|
|
33
|
+
pre-commit: lint format-check typecheck test
|
|
34
|
+
|
|
35
|
+
install-hooks:
|
|
36
|
+
@printf '#!/bin/sh\n# Installed by `make install-hooks`. Skip once with: git commit --no-verify\nexec make pre-commit\n' > .git/hooks/pre-commit
|
|
37
|
+
@chmod +x .git/hooks/pre-commit
|
|
38
|
+
@echo "Installed .git/hooks/pre-commit"
|