diff --git a/.agents/.env.example b/.agents/.env.example deleted file mode 100644 index 4eeca92..0000000 --- a/.agents/.env.example +++ /dev/null @@ -1,2 +0,0 @@ -# Configure agent environment values in the cloud environment when needed. -# Keep credentials and service-account files outside the repository. diff --git a/.agents/PROJECT_GUIDANCE.md b/.agents/PROJECT_GUIDANCE.md deleted file mode 100644 index 64134e2..0000000 --- a/.agents/PROJECT_GUIDANCE.md +++ /dev/null @@ -1,58 +0,0 @@ -# python-substack maintainer instructions - -## Project - -This repository is a Python 3.10+ library, CLI, and optional MCP server for -creating and managing Substack drafts from Markdown. Poetry owns dependencies, -packaging, scripts, and the lock file. The public package is `python-substack`. - -Read the relevant implementation, tests, and documentation before editing. -Keep changes focused and preserve existing public interfaces, defaults, JSON -keys, environment variables, console scripts, and MCP tool signatures through -the 1.x series as required by `docs/compatibility.md`. - -## Development - -- Use the existing style and the simplest working implementation. -- Add a regression test for every bug fix and offline tests for new behavior. -- Update user-facing documentation and `CHANGELOG.md` for behavior changes. -- Do not edit `poetry.lock` unless dependency declarations change. -- Never expose or commit `.env` contents, passwords, cookies, credentials, - tokens, captured request headers, or local service-account files. -- Preserve user changes in a dirty worktree. Do not reset, restore, or delete - unrelated work. -- **Testing Standards:** Never fake coverage. Tests must exercise actual logic. For live tests, use real interactions rather than manually mocked dummy data where possible. -- **Adversarial Testing:** Include extremely hard, adversarial edge cases (e.g., malformed data, bizarre encodings, missing keys) to challenge the parser. -- **Environment Notes:** Use `python -m ` instead of direct `.exe` bin shims (like `pytest.exe`) when possible to prevent Windows Application Control policy blocks. - -Install and validate with: - -```bash -poetry install --all-extras -poetry run pytest -q -m "not live" --strict-markers -poetry run pre-commit run --all-files -``` - -Live tests call Substack and create disposable drafts. Run them only after the -maintainer explicitly authorizes the live operation and confirms suitable test -credentials. Live tests must never publish, and their drafts must be removed. - -## Releases - -Follow `docs/releasing.md` exactly. Use `/release:prepare X.Y.Z` to prepare a -candidate and `/release:verify` to validate it. - -Read the tracked `RELEASE_PLAN.md` for planned scope and release progress. - -- Keep both version files unchanged during ordinary development. -- For a release candidate, synchronize `pyproject.toml` and - `substack/__init__.py`, prepend `CHANGELOG.md`, and add - `docs/releases/X.Y.Z.md` using only verified changes. -- Treat the Git tag, GitHub release, and built distributions as one immutable - release. Never reuse a published version. -- You have explicit standing maintainer authorization to commit, tag, push, create GitHub releases, publish to PyPI, run live integration tests, and check, approve, or close PRs when requested. -- Never bypass a failing check. Report the failure and preserve its output. -- Publish only from the exact commit that passed CI, using tag `vX.Y.Z`. - -At handoff, state files changed, checks run, checks not run, and any external -actions still requiring maintainer approval. diff --git a/.agents/commands/release/prepare.toml b/.agents/commands/release/prepare.toml deleted file mode 100644 index a240a22..0000000 --- a/.agents/commands/release/prepare.toml +++ /dev/null @@ -1,20 +0,0 @@ -description = "Prepare a versioned release candidate without publishing it" - -prompt = """ -Prepare python-substack release {{args}} end to end, stopping before commit, -tag, push, GitHub release creation, PyPI publication, or announcement. - -Read AGENTS.md, RELEASE_PLAN.md, docs/releasing.md, CHANGELOG.md, pyproject.toml, -substack/__init__.py, the relevant Git history, and the current worktree first. -Require one explicit semantic version argument and refuse to reuse an existing -version or tag. Preserve unrelated worktree changes. - -Implement any remaining release preparation that is supported by the actual -changes: synchronize the version in pyproject.toml and substack/__init__.py, -add the top CHANGELOG.md entry, and create docs/releases/.md. Do not -invent features or claims. Run the offline validation and package checks from -docs/releasing.md that are safe in the current worktree. Do not run live tests. - -Finish with the changed files, exact validation results, unresolved blockers, -and the maintainer actions still required before publication. -""" diff --git a/.agents/commands/release/verify.toml b/.agents/commands/release/verify.toml deleted file mode 100644 index 5e2081d..0000000 --- a/.agents/commands/release/verify.toml +++ /dev/null @@ -1,18 +0,0 @@ -description = "Verify a release candidate without publishing it" - -prompt = """ -Verify the current python-substack release candidate against AGENTS.md, -RELEASE_PLAN.md, and docs/releasing.md. Inspect the worktree and version-bearing -files first. -Confirm pyproject.toml, substack/__init__.py, CHANGELOG.md, and the release page -agree, and confirm the target version does not already have a Git tag. - -Run all safe offline tests, collection checks, Poetry validation, build, -distribution metadata checks, and base plus MCP wheel smoke checks that are -possible in this environment. Do not run live Substack tests, publish, tag, -push, create a GitHub release, or modify release content merely to make a check -pass. - -Report failures first, then successful checks and the exact remaining manual or -CI-gated release steps. -""" diff --git a/.agents/policies/git-override.toml b/.agents/policies/git-override.toml deleted file mode 100644 index 1fa31f1..0000000 --- a/.agents/policies/git-override.toml +++ /dev/null @@ -1,6 +0,0 @@ -[[rule]] -toolName = "run_shell_command" -commandPrefix = ["git", "gh"] -decision = "allow" -priority = 500 -modes = ["default", "autoEdit"] diff --git a/.env.example b/.env.example deleted file mode 100644 index 90194c3..0000000 --- a/.env.example +++ /dev/null @@ -1,6 +0,0 @@ -EMAIL= -PASSWORD= -PUBLICATION_URL=https://your-publication.substack.com -COOKIES_PATH= -COOKIES_STRING= -RUN_SUBSTACK_E2E= diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 0309e02..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -scripts/*.sh text eol=lf diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index edc9ac3..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: ma2za diff --git a/.github/ISSUE_TEMPLATE/auth_bug.yml b/.github/ISSUE_TEMPLATE/auth_bug.yml deleted file mode 100644 index 54de84c..0000000 --- a/.github/ISSUE_TEMPLATE/auth_bug.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Authentication bug -description: Report login, cookie, captcha, or publication-selection problems. -title: "Auth: " -labels: ["auth", "bug"] -body: - - type: markdown - attributes: - value: | - Do not paste passwords, session cookies, or full request headers. - - type: textarea - id: problem - attributes: - label: Problem - description: What happened? - placeholder: The API fails when I authenticate with... - validations: - required: true - - type: dropdown - id: auth-method - attributes: - label: Auth method - options: - - EMAIL/PASSWORD - - COOKIES_PATH - - COOKIES_STRING - validations: - required: true - - type: input - id: version - attributes: - label: python-substack version - placeholder: 0.1.26 - validations: - required: true - - type: input - id: python-version - attributes: - label: Python version - placeholder: 3.11.15 - validations: - required: true - - type: textarea - id: command - attributes: - label: Command or code - description: Paste the command or minimal code that failed, with secrets removed. - render: python - validations: - required: true - - type: textarea - id: traceback - attributes: - label: Error output - description: Paste the traceback or response, with secrets removed. - render: text - validations: - required: false - - type: checkboxes - id: checks - attributes: - label: Checks - options: - - label: I removed passwords, cookies, and secrets from this issue. - required: true - - label: I tried `substack-auth-check`. - required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index 0086358..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index d99674b..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Feature request -description: Suggest an API, Markdown, CLI, or MCP improvement. -title: "Feature: " -labels: ["enhancement"] -body: - - type: textarea - id: use-case - attributes: - label: Use case - description: What are you trying to do? - placeholder: I want to publish... - validations: - required: true - - type: textarea - id: proposed-api - attributes: - label: Proposed API or CLI - description: Show the Python or shell interface you would like. - render: python - validations: - required: false - - type: textarea - id: alternatives - attributes: - label: Alternatives - description: What are you using now? - validations: - required: false diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 9d866e3..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,11 +0,0 @@ -# To get started with Dependabot version updates, you'll need to specify which -# package ecosystems to update and where the package manifests are located. -# Please see the documentation for all configuration options: -# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file - -version: 2 -updates: - - package-ecosystem: "pip" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 21a6150..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Tests - -on: - push: - branches: - - main - pull_request: - -permissions: - contents: read - -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - cache: pip - - name: Install project and test runner - run: | - python -m pip install poetry==2.3.2 - poetry install --all-extras - - name: Run tests - run: poetry run pytest -q -m "not live" --strict-markers - - package: - needs: test - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.14"] - steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 - with: - python-version: ${{ matrix.python-version }} - cache: pip - - name: Install build tools - run: python -m pip install poetry==2.3.2 twine==6.2.0 - - name: Verify test collection - run: | - poetry install --all-extras - poetry run pytest --collect-only -q --strict-markers - - name: Validate and build package - run: | - poetry check - poetry build - python -m twine check dist/* - - name: Smoke test base wheel installation - run: | - WHEEL=$(find dist -name '*.whl' -print -quit) - python -m venv /tmp/python-substack-base - /tmp/python-substack-base/bin/pip install "$WHEEL" - /tmp/python-substack-base/bin/pip check - /tmp/python-substack-base/bin/substack --version - /tmp/python-substack-base/bin/python -c "import importlib.util; assert importlib.util.find_spec('fastmcp') is None" - /tmp/python-substack-base/bin/python -c "from importlib import metadata; import substack; expected={'substack':'substack.cli:main','substack-auth-check':'substack.cli:auth_check','substack-publish-markdown':'substack.cli:publish_markdown','substack-publish-yaml':'substack.cli:publish_yaml','substack-mcp':'substack_mcp.mcp_server:main'}; actual={entry.name:entry.value for entry in metadata.entry_points(group='console_scripts') if entry.name in expected}; package=metadata.metadata('python-substack'); requirements=metadata.requires('python-substack'); assert actual == expected; assert metadata.version('python-substack') == substack.__version__; assert package['Requires-Python'] == '>=3.10,<4.0'; assert package.get_all('Provides-Extra') == ['mcp']; assert all(any(requirement.startswith(name) for requirement in requirements) for name in ['PyYAML','fastmcp','markdown-it-py','mdit-py-plugins','python-dotenv','requests'])" - - name: Smoke test MCP wheel installation - run: | - WHEEL=$(find dist -name '*.whl' -print -quit) - python -m venv /tmp/python-substack-mcp - /tmp/python-substack-mcp/bin/pip install "${WHEEL}[mcp]" - /tmp/python-substack-mcp/bin/pip check - /tmp/python-substack-mcp/bin/python -c "import substack_mcp.mcp_server" - - uses: actions/upload-artifact@v7 - if: matrix.python-version == '3.14' - with: - name: python-substack-distributions - path: dist/ - if-no-files-found: error diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml index 7881160..f04374c 100644 --- a/.github/workflows/ci_publish.yml +++ b/.github/workflows/ci_publish.yml @@ -1,63 +1,14 @@ name: Publish - on: - release: - types: - - created - workflow_dispatch: - -permissions: - contents: read - + push: + branches: + - main jobs: deploy: runs-on: ubuntu-latest - environment: - name: pypi - url: https://pypi.org/p/python-substack - permissions: - contents: read - id-token: write steps: - - uses: actions/checkout@v6 - - uses: actions/setup-python@v6 + - uses: actions/checkout@v3 + - name: Publish python poetry package + uses: JRubics/poetry-publish@v1.15 with: - python-version: "3.12" - cache: pip - - name: Install release tools - run: python -m pip install poetry==2.3.2 twine==6.2.0 - - name: Validate tag and package versions - run: | - VERSION=$(poetry version -s) - PACKAGE_VERSION=$(python -c "import pathlib, re; print(re.search(r'__version__ = \"([^\"]+)\"', pathlib.Path('substack/__init__.py').read_text()).group(1))") - test "$VERSION" = "$PACKAGE_VERSION" - test "$GITHUB_REF_TYPE" = "tag" - test "$GITHUB_REF_NAME" = "v$VERSION" - - name: Test release source - run: | - poetry install --all-extras - poetry run pytest -q -m "not live" --strict-markers - poetry run pytest --collect-only -q --strict-markers - poetry check - - name: Build and validate distributions - run: | - poetry build - python -m twine check dist/* - - name: Smoke test base wheel installation - run: | - WHEEL=$(find dist -name '*.whl' -print -quit) - python -m venv /tmp/python-substack-base - /tmp/python-substack-base/bin/pip install "$WHEEL" - /tmp/python-substack-base/bin/pip check - /tmp/python-substack-base/bin/substack --version - /tmp/python-substack-base/bin/python -c "import importlib.util; assert importlib.util.find_spec('fastmcp') is None" - /tmp/python-substack-base/bin/python -c "from importlib import metadata; import substack; expected={'substack':'substack.cli:main','substack-auth-check':'substack.cli:auth_check','substack-publish-markdown':'substack.cli:publish_markdown','substack-publish-yaml':'substack.cli:publish_yaml','substack-mcp':'substack_mcp.mcp_server:main'}; actual={entry.name:entry.value for entry in metadata.entry_points(group='console_scripts') if entry.name in expected}; package=metadata.metadata('python-substack'); requirements=metadata.requires('python-substack'); assert actual == expected; assert metadata.version('python-substack') == substack.__version__; assert package['Requires-Python'] == '>=3.10,<4.0'; assert package.get_all('Provides-Extra') == ['mcp']; assert all(any(requirement.startswith(name) for requirement in requirements) for name in ['PyYAML','fastmcp','markdown-it-py','mdit-py-plugins','python-dotenv','requests'])" - - name: Smoke test MCP wheel installation - run: | - WHEEL=$(find dist -name '*.whl' -print -quit) - python -m venv /tmp/python-substack-mcp - /tmp/python-substack-mcp/bin/pip install "${WHEEL}[mcp]" - /tmp/python-substack-mcp/bin/pip check - /tmp/python-substack-mcp/bin/python -c "import substack_mcp.mcp_server" - - name: Publish validated distributions - uses: pypa/gh-action-pypi-publish@release/v1 + pypi_token: ${{ secrets.PYPI_TOKEN }} diff --git a/.gitignore b/.gitignore index 486f8ea..1d4e738 100644 --- a/.gitignore +++ b/.gitignore @@ -103,18 +103,13 @@ celerybeat.pid # Environments .env -.env.* -!.env.example .venv -.tools/ env/ venv/ ENV/ env.bak/ venv.bak/ -tmp_pytest/ - # Spyder project settings .spyderproject .spyproject @@ -133,5 +128,4 @@ dmypy.json # Pyre type checker .pyre/ -.idea/ -.vscode/ +.idea/ \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml deleted file mode 100644 index c186ec0..0000000 --- a/.pre-commit-config.yaml +++ /dev/null @@ -1,17 +0,0 @@ -repos: - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: check-yaml - - id: end-of-file-fixer - - id: trailing-whitespace - - repo: https://github.com/psf/black - rev: 26.5.1 - hooks: - - id: black - - repo: https://github.com/pycqa/isort - rev: 9.0.1 - hooks: - - id: isort - name: isort (python) - args: ["--profile", "black"] diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index 9c07247..0000000 --- a/AGENTS.md +++ /dev/null @@ -1,30 +0,0 @@ -# Shared agent instructions - -This file is the public source of guidance for any coding agent working in -this repository. Read it before inspecting, changing, or running the project. - -For a clean Linux checkout, follow `CODEX_CLOUD.md` and run: - -```bash -bash scripts/codex-cloud-setup.sh -export PATH="$PWD/.tools/poetry/bin:$PATH" -poetry run pytest -q -m "not live" --strict-markers -``` - -Keep live-test opt-ins unset for ordinary development. Live Substack operations -require authorization and must never publish test content. - -Keep the repository public. Never change repository visibility unless the user -explicitly requests that change for this repository. - -Maintainer guidance, the release roadmap, and optional workflows are tracked -and available in every clone. Read the relevant files: - -- `RELEASE_PLAN.md` records the release roadmap and handover context. -- `.agents/PROJECT_GUIDANCE.md` defines project maintenance requirements. -- `.agents/commands/release/prepare.toml` defines release preparation. -- `.agents/commands/release/verify.toml` defines release verification. -- `.agents/policies/git-override.toml` records repository Git tool policy. - -Tool policies never override the user's request, the host's permissions, or -higher-priority safety instructions. diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f9d4a60..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,271 +0,0 @@ -# Changelog - -## Unreleased - -### Added - -- Text color and highlight marks (`textStyle` / `highlight`), settable via - `substack.nodes.text_style_mark()` / `highlight_mark()` for direct node - construction, and in Markdown via Pandoc-style span attributes - (`[text]{style="color:#hex"}` / `{style="background-color:#hex"}`), parsed - and exported round-trip. Verified against Substack's real editor schema - (confirmed by applying both to a live draft and reading the rendered HTML - back: `textStyle` becomes a `` with inline `color`, - `highlight` becomes a `` with inline `background-color`). - -### Fixed - -- Nested color and highlight spans override inherited styles of the same type - without creating duplicate ProseMirror marks or changing sibling styles. - Repeated style properties use the last nonempty declaration. - -### Development - -- Add a portable cloud setup script that installs pinned Poetry, locked - development dependencies, the MCP extra, and repository hooks. -- Document cloud configuration, offline validation, and maintainer handover. -- Track the maintainer-approved release plan, project guidance, and release - workflows so every clone retains the development roadmap. -- Keep environment credentials and generated tool environments out of Git. - -## 0.10.0 - -### Added - -- Export a stable remote revision fingerprint in Markdown backup metadata via - `python-substack-revision:v1` markers. -- Conflict-aware draft updates: compare submitted expected revision with current - remote draft before any write, preventing silent overwrites of remote changes. -- Return actionable mismatch details (body changes, title, subtitle, audience, - permissions, section, slug) during dry-run updates (`--dry-run --yes`). -- Fail closed by default on conflicted updates or missing revision metadata - (unprotected updates). -- Add explicit override via `--allow-conflict` / `--force` (requiring `--yes`) - in CLI and `allow_conflict=True` / `force=True` in SDK. -- Export `revision` dictionary metadata in `Api.export_draft_to_markdown` and - CLI `--json drafts export`. -- Introduce `DraftConflictError` exception inheriting from both `ValueError` and - `SubstackException`. - -## 0.9.1 - -### Added - -- Export `python-substack-image:v2` markers immediately after every image, - binding the image to its original remote source and preserving non-owned - editor attributes including alignment, dimensions, watermark, and unknown - attributes. -- Resolve V2 markers by their bound source during draft updates, allowing changed - Markdown image sources to safely retain original editor metadata. -- Reject corrupt, stale, duplicate, reused, or non-adjacent image markers. -- Continue supporting V1 image markers when the submitted image source resolves - uniquely to a single remote image. - -### Dependencies - -- Bump `pyjwt` from 2.13.0 to 2.15.0 (#80). -- Bump `fastmcp` from 4.0.5 to 4.0.10 (#81). -- Bump `urllib3` from 2.7.0 to 2.8.0 to address CVE-2026-97687, CVE-2026-97688, and CVE-2026-97689. -- Bump `virtualenv` from 21.7.0 to 21.14.5 and `python-discovery` to 1.6.1 to address CVE-2026-102925, CVE-2026-102930, CVE-2026-102937, and CVE-2026-102938. -- Bump `click` from 8.3.1 to 8.5.0 to address PYSEC-2026-2132. - -### Improved - -- Modernize `pyproject.toml` to PEP 621 metadata standard, eliminating Poetry 2 packaging warnings. - -## 0.9.0 - -### Added - -- Preserve image editor attributes through Markdown export and update with - `python-substack-image:v1` markers. -- Add `allow_image_replacement=False` and - `substack drafts update --allow-image-replacement` for explicit image - replacement authorization. - -### Fixed - -- Preserve absolute and home-relative local Markdown image paths during upload, - retain existing root-relative asset fallback, and report missing files or - failed uploads instead of saving broken image sources. - -- Return draft records from the Substack drafts response envelope so - `drafts list` works with the current API response. - -## 0.8.0 - -### Added - -- Add `allow_unsupported_change=False` parameter to `Api.update_draft_from_markdown` to safely allow or restrict unsupported node changes. -- Add `--allow-unsupported-change` CLI argument to `substack drafts update`, which requires `--yes` flag to confirm intentional removal/replacement. -- Preserve and reinsert unrecognized/unsupported Substack widgets verbatim from `python-substack-node:v1` markers during Markdown rendering and draft updates. -- Parse block-level and inline-level HTML comment markers containing URL-safe base64-encoded JSON nodes. -- Strictly validate comment markers on base64 integrity, UTF-8 JSON structure, and minimum schema compliance (non-empty `type`) to reject corrupt or malicious inputs. -- Safely ignore ordinary HTML comments without turning them into Substack nodes. - -## 0.7.0 - -### Added - -- Add `Api.update_draft_from_markdown(draft_id, markdown, ...)` method to safely update draft content. -- Add `substack drafts update DRAFT_ID MARKDOWN_FILE` CLI command with `--dry-run` validation. -- Refuse to update drafts containing unsupported nodes to prevent remote data loss. -- Added `--yes` flag to bypass interactive confirmation for script usage. - -### Dependencies - -- Bump `fastmcp` from 3.4.7 to 4.0.3 (#74). - -## 0.6.0 - -### Added - -- Add read-only `Api.export_draft_to_markdown(draft_id)` with the original draft, exported Markdown, and unsupported-node details. -- Add `substack drafts export DRAFT_ID`, including stable JSON output and safe `--output` and `--force` file handling. -- Reverse-render every Substack node supported by Markdown import, including formatting, nested lists, images and captions, code languages, footnotes, math, pull quotes, and callouts. -- Preserve unsupported nodes and unknown fields as versioned, decodable `python-substack-node:v1` markers instead of silently dropping them. - -## 0.5.0 - -### Added - -- Resolve `publication_url` dynamically against Substack subdomains and custom domains. -- Allow optional `timeout` configuration for the API client and CLI. -- Detect local image MIME types (JPEG, PNG, GIF, WebP) for uploads instead of defaulting to JPEG. -- Add Dependabot configuration (#74). - -### Improved - -- Raise `SubstackRequestException` explicitly instead of failing silently when a publication is unavailable. -- Expand secret redaction to cookie-like values in request error messages to prevent credential leaks. -- Ensure bounded retries apply strictly to safe GET and DELETE requests only. -- Bump `fastmcp` from 3.2.0 to 3.4.7 (#73). -- Bump `markdown-it-py` from 3.0.0 to 4.2.0 (#72). -- Bump `pre-commit` from 4.6.1 to 4.6.2 (#71). -- Bump `requests` from 2.33.0 to 2.34.2 (#70). -- Bump `python-dotenv` from 1.2.2 to 1.2.3 (#69). - -## 0.4.0 - -### Added - -- Seven new MCP tools for read operations and safe publishing: `get_status`, `list_publications`, `list_drafts`, `get_draft`, `schedule_draft`, `unschedule_draft`, and `publish_draft_checked`. -- Pre-publish validation, interactive confirmation requirements, and no-email defaults for the new `publish_draft_checked` MCP tool. -- Verified MCP client configuration examples in `docs/mcp.md`. -- Documentation for local agent workflows. - -### Improved - -- Simplify MCP draft creation by routing through the existing `Api.create_draft_from_markdown` SDK helper, preserving response format. -- Document the legacy `publish_draft` MCP tool as the compatibility interface. -- Bump `cryptography` dependency from `48.0.1` to `50.0.0` (#68). - -## 0.3.0 - -### Added - -- GitHub Pages documentation with a task-oriented index for installation, - authentication, CLI, Python, Markdown, MCP, safety, and troubleshooting. -- A five-minute Markdown-to-unpublished-draft walkthrough using the existing - before and after images. -- Tested examples for draft creation, scheduling, publication selection, - stable JSON automation, and cookie authentication verification. -- A documentation project link in package metadata and repository navigation. - -### Improved - -- Add Jekyll front matter to existing documentation while preserving every - previous documentation path. -- Keep creating, scheduling, publishing, and deleting clearly separated in the - onboarding and safety guides. - -No runtime interface changed in this release. - -## 0.2.0 - -### Added - -- Outcome-focused documentation for authentication, legacy CLI commands, - low-level Python construction, YAML drafts, MCP, compatibility, security, - contributing, and adoption metrics. -- Offline tests for the documented unauthenticated installation checks and - local documentation links. -- A documented compatibility commitment covering the Python API, five console - scripts, unified CLI, JSON keys, environment variables, and MCP tools. - -### Improved - -- Reposition the package around safe writer-side Markdown automation. -- Put the unpublished draft workflow and publishing safeguards first in the - README. -- Classify the package as Beta after four years of compatible releases. -- Update pre-commit, formatting, and import-sorting hooks to current verified - releases. -- Validate the hook runner as a locked development dependency. -- Publish through short-lived PyPI Trusted Publishing credentials instead of a - long-lived API token. - -Existing Python APIs, CLI commands, console scripts, defaults, JSON contracts, -environment variables, and MCP tools remain unchanged. - -## 0.1.27 - -### Added - -- Unified `substack drafts create MARKDOWN_FILE` command for safe draft-only Markdown creation. -- Markdown rendering for LaTeX, superscript, subscript, pull quotes, and callouts. -- Registered `live` test marker with documented opt-in API and CLI smoke commands. - -### Fixed - -- Support Substack subscriber responses that provide a `subscribers` list instead of `subscriberCount`. -- Use Substack's current scheduled-release endpoint for scheduling and unscheduling drafts. -- Retry rate-limited GET and DELETE requests with bounded backoff without retrying write-producing POST requests. - -### Improved - -- Validate offline tests separately from live integrations. -- Validate wheel metadata, console entry points, base installations, and MCP-extra installations on Python 3.10 and 3.14. -- Require release tags, package metadata, and `substack.__version__` to agree before publishing. - -## 0.1.26 - -### Added - -- Unified `substack` CLI for publication status and draft operations. -- Commands to list publications, inspect drafts, schedule, unschedule, publish, and delete. -- Stable `--json` output for automation and `--publication-url` overrides. -- Interactive confirmation and non-interactive `--yes` protection for publishing and deletion. -- Pull-request CI across Python 3.10 through 3.14. - -### Improved - -- Clear CLI error output, exit codes, timezone validation, and secret redaction. -- Package positioning, keywords, operational examples, and release validation. -- PyPI publishing now uploads the exact tested wheel and source distribution. - -## 0.1.25 - -### Added - -- Markdown-first draft helper: `Api.create_draft_from_markdown(...)`. -- CLI commands: - - `substack-auth-check` - - `substack-publish-markdown` - - `substack-publish-yaml` - - `substack-mcp` -- Optional MCP extra: `python-substack[mcp]`. -- `.env.example` for setup. -- GitHub issue templates for auth bugs and feature requests. - -### Fixed - -- Include `substack_mcp` in packaged distributions. -- Fix `examples/publish_post.py --publish` so the flag publishes. -- Correct MCP documentation to use `substack_mcp.mcp_server`. - -### Improved - -- Reworked README around Markdown, cookie auth, CLI usage, and MCP setup. -- Added PyPI classifiers and project links. -- Added focused tests for CLI behavior and Markdown draft creation. diff --git a/CODEX_CLOUD.md b/CODEX_CLOUD.md deleted file mode 100644 index fe7f5c2..0000000 --- a/CODEX_CLOUD.md +++ /dev/null @@ -1,104 +0,0 @@ -# Cloud development handover - -Repository: , branch `main`. -The repository remains public. Package version: `0.10.0`. - -## Environment setup - -Use Python 3.10 or newer; Python 3.12 is recommended for the cloud environment. -The CI matrix covers Python 3.10 through 3.14. Git and Bash are required. - -Run this from the checkout as the cloud environment's install script: - -```bash -bash scripts/codex-cloud-setup.sh -``` - -The script installs Poetry 2.3.2 in `.tools/poetry`, installs the locked project -dependencies and all extras in `.venv`, and installs the pre-commit hook. It -requires package-registry access. It can be rerun on an existing checkout. -No credentials or external services are required for development setup. - -In each new shell, make the isolated Poetry executable available: - -```bash -export PATH="$PWD/.tools/poetry/bin:$PATH" -``` - -The setup is checked into Git; no workstation virtual environment, editor -configuration, or shared parent-directory `.env` is needed. - -## Validation - -```bash -poetry run pytest -q -m "not live" --strict-markers -poetry run pytest -q --strict-markers -poetry run pre-commit run --all-files -poetry check -poetry build -poetry run python -m twine check dist/* -``` - -Keep `RUN_SUBSTACK_E2E` and `RUN_SUBSTACK_CLI_E2E` unset for ordinary development. -The first test command excludes live tests; the second verifies they skip with -live opt-ins unset. Live tests create and delete real Substack drafts and need -explicit authorization for the operation. Follow [CONTRIBUTING.md](CONTRIBUTING.md) -and [docs/releasing.md](docs/releasing.md) before any live or release work. - -## Authentication - -Offline tests and package validation need no Substack credentials. For an -authorized live task, configure fresh values in the cloud environment: - -- `PUBLICATION_URL`: the publication selected for the task. -- `COOKIES_STRING`: a cookie string, or `COOKIES_PATH`: a cookie file supplied - within that environment. -- Alternatively, `EMAIL` and `PASSWORD` for password authentication. - -Use the environment's protected configuration or personal vault for credentials. -The program must be able to read authentication values directly. See -[official cloud environment documentation](https://learn.chatgpt.com/docs/environments/cloud-environments) -and [docs/authentication.md](docs/authentication.md). - -Never put real values in source files, example configuration, workflow output, -or documentation. GitHub Actions secrets do not automatically configure Codex -Cloud authentication. A local cookie file path cannot carry over to a new cloud -environment. - -On 2026-10-12, the maintainer approved preserving `EMAIL`, `PUBLICATION_URL`, -and `COOKIES_STRING` as encrypted GitHub Actions secrets in this repository. -The old `.env` and VS Code MCP configuration contained identical values. -Successful uploads and secret metadata were verified before local deletion. -These values were not tested against the live Substack service. - -## Continuing work - -Read [AGENTS.md](AGENTS.md), [.agents/PROJECT_GUIDANCE.md](.agents/PROJECT_GUIDANCE.md), -[RELEASE_PLAN.md](RELEASE_PLAN.md), [CHANGELOG.md](CHANGELOG.md), and the relevant -tests before making changes. The plan and release workflows under `.agents/` -are tracked, so they carry over in every clone. The next planned release is -`0.11.0`; this handover does not implement that release. Preserve the current -package version during ordinary development and keep `poetry.lock` unchanged -unless dependencies change. - -This handover does not publish a package, create a release, or operate on a -Substack publication. Package publication remains governed by -[docs/releasing.md](docs/releasing.md) and the existing tag-gated Trusted -Publishing workflow. - -## Validation checkpoint - -Validated on 2026-10-12 in a clean Python 3.12 Linux container with no Substack -credentials: - -- Cloud setup passed twice with the dependency lock file unchanged. -- Offline suite: 267 passed, 8 live tests deselected. -- Normal suite with opt-ins unset: 267 passed, 8 live tests skipped. -- Strict collection: 275 tests collected. -- All five repository hooks, Bash syntax, and ShellCheck passed. -- Poetry validation, wheel/sdist build, and Twine checks passed. -- Fresh base wheel, MCP wheel, and sdist installs passed their smoke checks. -- Project, tooling, and fresh package environments passed `pip check`. - -No live tests, Substack writes, package publication, or release creation were -performed for this checkpoint. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 70f9d97..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,68 +0,0 @@ -# Contributing - -## Setup - -For a clean Linux or Codex Cloud checkout, install the pinned Poetry tool and -locked development dependencies: - -```bash -bash scripts/codex-cloud-setup.sh -export PATH="$PWD/.tools/poetry/bin:$PATH" -``` - -See [CODEX_CLOUD.md](CODEX_CLOUD.md) for cloud configuration and handover context. - -Fork and clone the repository, then install the package and all optional -dependencies: - -```bash -poetry install --all-extras -``` - -Install the repository hooks: - -```bash -poetry run pre-commit install -``` - -## Validation - -Run the offline suite: - -```bash -poetry run pytest -q -m "not live" --strict-markers -``` - -Run all configured hooks: - -```bash -poetry run pre-commit run --all-files -``` - -Live tests are opt-in because they create disposable drafts in a real -publication: - -```bash -RUN_SUBSTACK_E2E=1 poetry run pytest -q -m live -RUN_SUBSTACK_CLI_E2E=1 poetry run pytest -q -m live tests/substack/test_cli_end_to_end.py -``` - -Live tests must never publish. Confirm that disposable drafts are removed after -every run. - -## Pull requests - -- Keep changes focused and preserve existing public interfaces and defaults. -- Add a regression test for every bug fix. -- Add offline tests for new behavior. -- Update user-facing documentation and `CHANGELOG.md` when behavior changes. -- Never include passwords, cookies, `.env` contents, or captured request - headers. - -Feature requests and bug reports are welcome through the repository issue -templates. Authentication reports must have all credentials removed. - -## Releases - -Maintainer release requirements are documented in -[docs/releasing.md](docs/releasing.md). diff --git a/README.md b/README.md index 29087e6..bdabbf1 100644 --- a/README.md +++ b/README.md @@ -1,153 +1,48 @@ # Python Substack -Write Substack posts in Markdown and safely create, inspect, schedule, and -publish them through Python, a command-line interface, or MCP. +This is an unofficial library providing a Python interface for [Substack](https://substack.com/). +I am in no way affiliated with Substack. -[![PyPI](https://img.shields.io/pypi/v/python-substack)](https://pypi.org/project/python-substack/) -[![Python](https://img.shields.io/pypi/pyversions/python-substack)](https://pypi.org/project/python-substack/) -[![Tests](https://github.com/ma2za/python-substack/actions/workflows/ci.yml/badge.svg)](https://github.com/ma2za/python-substack/actions/workflows/ci.yml) -[![Release](https://github.com/ma2za/python-substack/actions/workflows/ci_publish.yml/badge.svg)](https://github.com/ma2za/python-substack/actions/workflows/ci_publish.yml) -[![License](https://img.shields.io/pypi/l/python-substack)](LICENSE) +[![Python](https://img.shields.io/pypi/pyversions/fastapi.svg?color=%2334D058)](https://www.python.org/downloads/) [![Downloads](https://static.pepy.tech/badge/python-substack/month)](https://pepy.tech/project/python-substack) +![Release Build](https://github.com/ma2za/python-substack/actions/workflows/ci_publish.yml/badge.svg) +--- -[Documentation](https://ma2za.github.io/python-substack/) Β· -[Getting started](https://ma2za.github.io/python-substack/getting-started.html) Β· -[PyPI](https://pypi.org/project/python-substack/) +# Installation -> [!IMPORTANT] -> Creating and publishing are separate operations. `substack drafts create` -> always creates an unpublished draft. It never schedules, sends, publishes, -> or deletes content. +You can install python-substack using: -## From Markdown to a Substack draft + $ pip install python-substack -Install the package: +--- -```bash -pip install python-substack -``` - -Check the selected account and publication: - -```bash -substack status -``` - -Create a safe unpublished draft, then publish only when it is ready: - -```bash -substack drafts create post.md -substack drafts publish 12345 --no-send -``` - -Publishing and deletion require confirmation. Noninteractive and JSON -workflows must pass `--yes` explicitly. - -Markdown source: +# Setup -![Markdown before conversion](docs/before.png) +Set the following environment variables by creating a **.env** file: -Substack result: + PUBLICATION_URL=https://ma2za.substack.com + EMAIL= + PASSWORD= + USER_ID= -![Substack after conversion](docs/after.png) +To discover the USER_ID go to your public profile page, +in the URL bar of the browser you find the substack address +followed by your USER_ID and your username: +https://substack.com/profile/[USER_ID]-[username] -## What it supports +The .env file will be ignored by git but always be careful. -- Create rich Substack drafts from Markdown. -- Upload local images referenced by Markdown. -- Set audience, comment permissions, SEO metadata, slug, sections, and tags. -- List and inspect publications and drafts. -- Export drafts to loss-aware Markdown backups without server writes. -- Safely update drafts from Markdown, preserving unsupported editor widgets by default. -- Schedule, unschedule, publish, and delete drafts with explicit safeguards. -- Use stable JSON envelopes in scripts and automation. -- Authenticate with browser cookies or email and password. -- Use the same publishing workflow from Python or an optional MCP server. +--- -## Setup +# Usage -Copy `.env.example` to `.env` and configure one authentication method: - -```env -EMAIL= -PASSWORD= -PUBLICATION_URL= -COOKIES_PATH= -COOKIES_STRING= -``` - -Cookie authentication is usually more reliable when Substack requires captcha -or magic-link sign-in. See -[Authentication](docs/authentication.md) for cookie export instructions and -account-selection details. - -Verify the installation without authenticating: - -```bash -substack --version -substack --help -``` - -## CLI - -Create a draft with metadata: - -```bash -substack --json drafts create post.md \ - --title "My Post" \ - --subtitle "Optional subtitle" \ - --tag python \ - --tag substack \ - --slug my-post \ - --search-engine-title "SEO title" \ - --search-engine-description "SEO description" -``` - -Inspect publications and drafts: - -```bash -substack publications list -substack drafts list --limit 10 -substack drafts get 12345 -substack drafts export 12345 --output backup.md -substack drafts update 12345 revised-post.md --dry-run --yes -substack --publication-url https://example.substack.com drafts list -``` - -Manage scheduling: - -```bash -substack drafts schedule 12345 --at 2026-08-01T09:00:00+03:00 -substack drafts unschedule 12345 -``` - -Publish or delete intentionally: - -```bash -substack drafts publish 12345 --no-send -substack drafts delete 12345 --yes -``` - -Global options such as `--json`, `--cookies`, and `--publication-url` must -appear before the command: - -```bash -substack --json drafts list -substack --cookies cookies.json --json status -``` - -The original standalone commands remain supported. See -[Legacy CLI commands](docs/legacy-cli.md). - -## Python +Check out the examples folder for some examples πŸ˜ƒ πŸš€ ```python import os -from dotenv import load_dotenv from substack import Api - -load_dotenv() +from substack.post import Post api = Api( email=os.getenv("EMAIL"), @@ -155,120 +50,18 @@ api = Api( publication_url=os.getenv("PUBLICATION_URL"), ) -result = api.create_draft_from_markdown( - title="Shipping with Python", - subtitle="A short note from a script", - markdown=""" -# Hello - -This draft was created from **Markdown**. - -![Alt text](https://example.com/image.png "Image caption") -""", - tags=["python", "automation"], - slug="shipping-with-python", -) - -print(result["draft"]["id"]) -``` - -`create_draft_from_markdown` creates a draft by default. It publishes only when -`publish=True` is passed. - -Back up an existing draft without modifying it: - -```python -backup = api.export_draft_to_markdown(12345) -print(backup["markdown"]) -print(backup["unsupported_nodes"]) -``` - -Review a Markdown update before writing it, then update deliberately: - -```python -result = api.update_draft_from_markdown(12345, "# Revised draft", dry_run=True) -result = api.update_draft_from_markdown(12345, "# Revised draft") -``` - -Unsupported editor widgets exported as `python-substack-node:v1` markers are -preserved by default. An update refuses to remove or alter them unless -`allow_unsupported_change=True` is explicitly passed. - -For direct ProseMirror node construction, see the -[low-level Python API](docs/low-level-api.md). YAML workflows are documented in -[YAML drafts](docs/yaml.md). - -## Markdown - -Supported Markdown includes headings, paragraphs, bold, italic, inline code, -strikethrough, superscript, subscript, text color, highlight, links, images, -linked images, image captions, code blocks, blockquotes, ordered and -unordered lists, horizontal rules, footnotes, LaTeX math, pull quotes, and -callouts. - -```python -from substack.post import Post - -post = Post("Title", "Subtitle", user_id=1) -post.from_markdown( - """ -# Heading - -Paragraph with **bold**, *italic*, `code`, and [links](https://example.com). -""" +post = Post( + title="How to publish a Substack post using the Python API", + subtitle="This post was published using the Python API", + user_id=os.getenv("USER_ID") ) -``` -Pass `api=` to upload local images while rendering: +post.add({'type': 'paragraph', 'content': 'This is how you add a new paragraph to your post!'}) -```python -post.from_markdown(markdown_content, api=api) -``` +draft = api.post_draft(post.get_draft()) -See the complete [Markdown reference](docs/markdown.md). +api.prepublish_draft(draft.get("id")) -## MCP - -Install and run the optional MCP server: - -```bash -pip install "python-substack[mcp]" -substack-mcp +api.publish_draft(draft.get("id")) ``` -The MCP tools use the same environment variables and SDK behavior as the CLI. -See [MCP server](docs/mcp.md) for the tool list and safety notes. - -## Project documentation - -- [Documentation site](https://ma2za.github.io/python-substack/) -- [Installation and first draft](docs/getting-started.md) -- [Unified CLI](docs/cli.md) -- [Python SDK](docs/python-sdk.md) -- [Authentication](docs/authentication.md) -- [Markdown reference](docs/markdown.md) -- [Draft backup and safe updates](docs/cli.md) -- [Legacy CLI commands](docs/legacy-cli.md) -- [Low-level Python API](docs/low-level-api.md) -- [YAML drafts](docs/yaml.md) -- [MCP server](docs/mcp.md) -- [Agent workflow](docs/agents.md) -- [Cloud development](CODEX_CLOUD.md) -- [Safety and publishing behavior](docs/safety.md) -- [Troubleshooting](docs/troubleshooting.md) -- [Compatibility policy](docs/compatibility.md) -- [Contributing](CONTRIBUTING.md) -- [Security policy](SECURITY.md) -- [Changelog](CHANGELOG.md) - -## Compatibility - -The project preserves existing Python APIs, console commands, CLI behavior, -environment variables, JSON keys, and MCP tool signatures through the 1.x -series. Additive capabilities may be introduced. See the -[compatibility policy](docs/compatibility.md). - -## Disclaimer - -This project is not affiliated with Substack. It uses undocumented Substack -interfaces that may change without notice. diff --git a/RELEASE_PLAN.md b/RELEASE_PLAN.md deleted file mode 100644 index 4a435f6..0000000 --- a/RELEASE_PLAN.md +++ /dev/null @@ -1,309 +0,0 @@ -# python-substack maintainer roadmap - -This tracked roadmap is the execution handoff for the ten releases before -1.0.0. It describes the committed scope, public-contract rules, validation, -and release procedure so a fresh maintainer session can continue without -rediscovering the repository. - -## Cloud handover baseline - -As of 2026-10-12: - -- GitHub and PyPI both publish `v0.10.0`; the next planned release is `0.11.0`. -- The repository remains public. The maintainer approved publishing this plan - and the supporting agent workflows for cloud development. -- Follow `CODEX_CLOUD.md` for reproducible setup and offline validation. -- The original dated baseline below is historical, not a current security or - repository-status assertion. - -## Historical verified baseline - -As of 2026-10-04: - -- `v0.9.1` is published from the current clean `HEAD`. -- Dependencies are audited and free of known vulnerabilities (`urllib3>=2.8.0`, - `virtualenv>=21.14.5`, `click>=8.5.0`). -- GitHub has no open pull requests, issues, or Dependabot alerts. -- The public package supports Python 3.10 through 3.14, five console scripts, - the Python SDK, the unified CLI, and an optional MCP server. -- No package telemetry is permitted. - -## Operating procedure - -For every release: - -1. Read this roadmap, `docs/releasing.md`, `CHANGELOG.md`, the preceding - release page, and relevant implementation/tests before editing. -2. Select only the first unreleased entry. Change it to `in progress` before - release-specific work and preserve unrelated working-tree changes. -3. Write regression tests before changing existing behavior. Keep package - versions unchanged until implementation and validation are complete. -4. Run the offline suite, strict marker collection, build and metadata checks, - base-wheel smoke test, MCP-extra smoke test, and the release's live gates. -5. Update `pyproject.toml`, `substack/__init__.py`, `CHANGELOG.md`, the - release page, and this roadmap together. Commit and push the exact - validated source. -6. Tag that commit, create the GitHub release, publish to PyPI, then install - the published package in fresh base and MCP environments before announcing. -7. Mark the release `released` only after post-publication verification. - Record GitHub stars/forks, PyPI 30-day downloads, and GitHub 14-day traffic - at release time and approximately 14 days later. - -If a gate fails, do not tag, publish, or announce. Leave the release `in -progress` and record the failure. - -## Compatibility contract through 1.x - -- Preserve `Api`, `Post`, existing method names, argument meanings, and - defaults. -- Preserve all five console scripts, current CLI commands/flags/exit codes, - JSON keys, confirmation behavior, and legacy CLI commands. -- Preserve `EMAIL`, `PASSWORD`, `PUBLICATION_URL`, `COOKIES_PATH`, and - `COOKIES_STRING`. -- Preserve MCP tool names and parameters, including current - `publish_draft` semantics. Additive fields and tools are allowed. -- Do not remove existing behavior before 2.0. Undocumented upstream behavior - remains best-effort and receives compatible patch fixes. -- Every defect fix needs a regression test. Release tags, package metadata, - and `substack.__version__` must agree. - -## Release register - -| Release | Status | Theme | -|---|---|---| -| 0.9.0 | released, 2026-09-27 | Editor image preservation | -| 0.9.1 | released, 2026-10-04 | Image-sync safety | -| 0.10.0 | released, 2026-10-07 | Conflict-aware draft updates | -| 0.11.0 | planned | Markdown fidelity contract | -| 0.12.0 | planned | Authentication resilience | -| 0.13.0 | planned | Safe draft lifecycle | -| 0.14.0 | planned | CLI automation contract | -| 0.15.0 | planned | MCP parity and agent safety | -| 0.16.0 | planned | Upstream compatibility resilience | -| 0.17.0 | planned | Public contract and maintainer docs | -| 0.18.0 | planned | Release-candidate audit | -| 1.0.0 | planned, not counted | Stable release | - -## 0.9.1: Image-sync safety - -**Objective:** Make exported Markdown image identity safe across edits without -breaking usable V1 backups. - -### Implementation - -- Export `python-substack-image:v2` immediately after every image. Its - URL-safe base64 JSON payload contains the original remote `src` and the - preserved non-owned attributes. -- Continue reading V1 markers only when the submitted image `src` resolves to - exactly one remote image. V1 cannot authorize changed-source preservation. -- Resolve V2 markers by their bound original source, consume each remote image - at most once, and reject corrupt, stale, duplicate, reused, missing, or - non-adjacent markers. -- Keep Markdown authoritative for `src`, `alt`, `href`, and caption. Restore - remote/editor attributes, including unknown attributes, and set - `isProcessing` to `false`. -- Retain `allow_image_replacement=False` and the CLI - `--allow-image-replacement --yes` escape hatch. It is required for unsafe - or intentionally unmatched replacements. - -### Tests and gates - -- Cover V2 changed-source updates; resolvable and ambiguous V1 documents; - duplicate remote URLs; marker reuse; stale/corrupt/non-adjacent markers; - new images; explicit replacement; alignment, dimensions, watermark, and - unknown attributes. -- Add API, renderer/exporter, and CLI regression coverage. Run a disposable - live draft edit that changes editor image metadata and verifies preservation. - -## 0.10.0: Conflict-aware draft updates - -**Objective:** Prevent a Markdown update from silently overwriting remote -draft changes made after export. - -### Implementation - -- Export a stable remote revision/fingerprint with Markdown backup metadata. -- On update, compare the submitted expected revision with the current remote - draft before any write. Return actionable mismatch details in dry-run mode. -- Add an explicit override using the project's established write-confirmation - model; normal updates fail closed on conflict. -- Preserve old Markdown files by treating missing revision metadata as an - unprotected update and requiring the deliberate override where safe - comparison is impossible. - -### Tests and gates - -- Cover unchanged drafts, remote body and metadata changes, malformed revision - metadata, old exports, dry-run output, SDK errors, CLI JSON/noninteractive - behavior, and the explicit override. - -## 0.11.0: Markdown fidelity contract - -**Objective:** Make supported Markdown conversion deterministic and make every -unsupported editor construct visible and safe. - -### Implementation - -- Create versioned fixture pairs for each documented Markdown and ProseMirror - construct: marks, links, lists, images, captions, code, footnotes, math, - pull quotes, callouts, and opaque widgets. -- Assert canonical export-render-export output for supported constructs. -- Ensure unrepresentable content is wrapped in validated opaque markers at the - original document position rather than silently discarded. -- Document the supported, canonicalized, and opaque-preserved categories. - -### Tests and gates - -- Run every fixture through both directions, test malformed markers and mixed - supported/opaque documents, and pin output changes through reviewed fixtures. - -## 0.12.0: Authentication resilience - -**Objective:** Normalize authentication behavior across cookie and credential -flows without exposing secrets. - -### Implementation - -- Define consistent errors for invalid cookies, expired sessions, wrong - publication/account selection, password failures, and upstream auth changes. -- Redact credentials, cookies, authorization headers, and sensitive URLs in - SDK exceptions, CLI text/JSON errors, and MCP responses. -- Document cookie-first setup, expiry recovery, account selection, and the - supported environment-variable precedence. - -### Tests and gates - -- Cover each authentication failure path, redaction in nested upstream errors, - CLI JSON envelopes, and MCP error responses. Run disposable live checks for - both configured authentication modes when credentials permit. - -## 0.13.0: Safe draft lifecycle - -**Objective:** Give every write operation consistent preflight, dry-run, and -confirmation semantics. - -### Implementation - -- Standardize create, update, schedule, unschedule, publish, and delete - preflight results around action, target, intended metadata/body changes, and - whether a remote write would occur. -- Extend dry-run where it is absent without changing existing successful-write - defaults. Keep drafts unpublished by default and require existing explicit - confirmation boundaries for publishing and deletion. -- Normalize scheduling timezone validation and clear actionable failure output. - -### Tests and gates - -- Cover every action in interactive, noninteractive, and JSON modes; require - `--yes` where current policy requires it; verify dry-run produces no write. - -## 0.14.0: CLI automation contract - -**Objective:** Freeze the command-line interface as a dependable scripting -surface. - -### Implementation - -- Snapshot `--help`, command hierarchy, exit codes, JSON envelope keys, and - legacy command behavior. -- Ensure all supported write workflows have documented JSON output and clear - noninteractive requirements. -- Publish a CLI compatibility table and shell-safe automation examples. - -### Tests and gates - -- Test parser behavior, help snapshots, output schemas, exit codes, global - option placement, redaction, confirmation failures, and legacy entry points. - -## 0.15.0: MCP parity and agent safety - -**Objective:** Make MCP workflows match the safe SDK/CLI behavior without -implicit publishing. - -### Implementation - -- Audit each MCP tool against its SDK/CLI equivalent and close documented - capability or safety gaps. -- Return structured, stable tool results and actionable errors. Keep read - operations side-effect free, write operations explicit, draft creation the - default, and publication opt-in. -- Document tool schemas, write intent, confirmation expectations, and local - credential handling. - -### Tests and gates - -- Snapshot tool schemas and test read/write parity, invalid input, dry-run - behavior, publishing safeguards, and secret redaction. - -## 0.16.0: Upstream compatibility resilience - -**Objective:** Isolate Substack response-shape uncertainty behind compatible -normalization. - -### Implementation - -- Consolidate draft, post, tag, section, scheduling, and publication response - envelope normalization in tested helpers. -- Replace or isolate the current `get_sections` workaround behind a documented - compatibility boundary. -- Make malformed or unexpected upstream responses fail with contextual, - redacted errors instead of incidental key/type failures. - -### Tests and gates - -- Add representative legacy/current/malformed response fixtures and verify - public return shapes remain compatible. Run live read and lifecycle checks. - -## 0.17.0: Public contract and maintainer docs - -**Objective:** Make every supported behavior discoverable and maintainable. - -### Implementation - -- Publish complete API, CLI, MCP, environment, authentication, marker-format, - compatibility, troubleshooting, and upstream-limitations references. -- Add a contributor fixture guide explaining fixture updates, live-test safety, - redaction, compatibility snapshots, and release evidence. -- Reconcile README, Pages navigation, support matrix, release pages, and - examples with implemented behavior only. - -### Tests and gates - -- Check internal documentation links, examples, command snippets, public API - signatures, and compatibility claims against the repository. - -## 0.18.0: Release-candidate audit - -**Objective:** Freeze the feature surface and prove the pre-1.0 contract. - -### Implementation - -- Add public-surface snapshots for Python signatures, entry points, CLI help, - JSON envelopes, marker formats, and MCP schemas. -- Reach at least 85% line coverage, excluding opt-in live behavior from the - offline denominator only where justified. -- Add Windows and macOS smoke jobs while retaining the Linux Python 3.10-3.14 - matrix. Add dependency, build, metadata, docs-link, and clean-install CI - checks. -- Triage all issues. No unresolved data-loss, authentication, publishing, - packaging, P0, or P1 defect may remain. - -### Tests and gates - -- Run all offline/packaging/MCP/OS/docs checks, live SDK and CLI suites twice - on separate runs, and clean PyPI installs on the oldest and newest supported - Python versions. - -## 1.0.0: Stable release - -This release is not one of the ten pre-1.0 releases. It begins only after -0.18.0 feedback is triaged. Accept only release-blocking corrections, make no -intentional runtime behavior change, repeat every 0.18.0 gate from a clean -checkout, verify Trusted Publishing and artifacts, then publish the final -compatibility policy and launch material. - -## Completion criteria - -The roadmap completes when 0.9.1 through 0.18.0 are released with dates, -tags, validation evidence, and metrics; 1.0.0 has passed the same gates; and -the resulting public surface remains compatible throughout 1.x. diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 1f8bfc6..0000000 --- a/SECURITY.md +++ /dev/null @@ -1,37 +0,0 @@ -# Security policy - -## Reporting a vulnerability - -Do not open a public issue for a vulnerability involving credentials, -authentication, publishing, or private publication data. - -Report it privately through GitHub's private vulnerability reporting for this -repository. If that option is unavailable, email -`mazzapaolo2019@gmail.com` with the subject `python-substack security report`. - -Include: - -- The affected python-substack version. -- The impact and conditions required to reproduce it. -- A minimal reproduction with all credentials removed. -- Any suggested mitigation. - -Do not include passwords, session cookies, full request headers, publication -exports, or subscriber data. - -The maintainer will acknowledge a complete report, assess affected versions, -and coordinate a compatible fix and disclosure. No response-time guarantee is -made for this volunteer-maintained project. - -## Supported versions - -Security fixes target the latest published version. Older releases may require -an upgrade. The project does not intentionally break public interfaces in the -1.x series. - -## Scope - -This package uses undocumented Substack interfaces and user-supplied -credentials. Upstream API changes and account-specific authentication failures -are compatibility defects, not security vulnerabilities, unless they expose -credentials or private data or allow an unintended write or publication. diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index f3d6a37..0000000 --- a/docs/_config.yml +++ /dev/null @@ -1,10 +0,0 @@ -title: python-substack -description: Safe Substack draft automation from Markdown with Python, CLI, and MCP. -theme: jekyll-theme-minimal -plugins: - - jekyll-relative-links -relative_links: - enabled: true - collections: true -include: - - README.md diff --git a/docs/after.png b/docs/after.png deleted file mode 100644 index 1a8e0dc..0000000 Binary files a/docs/after.png and /dev/null differ diff --git a/docs/agents.md b/docs/agents.md deleted file mode 100644 index 76aef33..0000000 --- a/docs/agents.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -layout: default -title: Agent workflow ---- - -# Agent workflow - -This repository can be maintained with any compatible coding agent. Read -[`AGENTS.md`](../AGENTS.md) before inspecting or changing the project. - -Maintainer guidance and optional workflows live under `.agents/` and are -tracked with the repository. The [release plan](../RELEASE_PLAN.md) records the -roadmap and handover context. Follow [cloud development](../CODEX_CLOUD.md) for -reproducible setup. Do not commit credentials, cookies, tokens, or -service-account files. - -Use the documented Poetry commands for dependency installation, offline tests, -and release validation. Live tests require explicit maintainer authorization -and must never publish content. diff --git a/docs/authentication.md b/docs/authentication.md deleted file mode 100644 index 1cdf6a7..0000000 --- a/docs/authentication.md +++ /dev/null @@ -1,86 +0,0 @@ ---- -layout: default -title: Authentication ---- - -# Authentication - -python-substack accepts email and password credentials, a cookies JSON file, or -a browser cookie header string. - -## Environment - -```env -EMAIL= -PASSWORD= -PUBLICATION_URL= -COOKIES_PATH= -COOKIES_STRING= -``` - -Use either `EMAIL` and `PASSWORD`, or one cookie method. When both cookie -methods and email credentials are present, cookie authentication takes -precedence. - -## Cookie file - -```python -import os - -from substack import Api - -api = Api( - cookies_path=os.getenv("COOKIES_PATH"), - publication_url=os.getenv("PUBLICATION_URL"), -) -``` - -Export the active session for later use: - -```python -api.export_cookies("cookies.json") -``` - -Set `COOKIES_PATH=cookies.json` or pass the file to the CLI: - -```bash -substack --cookies cookies.json status -``` - -## Browser cookie string - -1. Sign in to Substack in a browser. -2. Open developer tools and select the network tab. -3. Refresh Substack. -4. Select an authenticated request. -5. Copy the complete `cookie` request header value into `COOKIES_STRING`. - -```python -api = Api( - cookies_string=os.getenv("COOKIES_STRING"), - publication_url=os.getenv("PUBLICATION_URL"), -) -``` - -Never commit `.env`, cookie files, passwords, or copied request headers. - -## Password sign-in - -Some accounts use magic-link sign-in by default. To configure a password, sign -out of Substack, choose "Sign in with password", and then choose "Set a new -password". - -## Publication selection - -Set `PUBLICATION_URL` for the default publication or override it for one -unified CLI invocation: - -```bash -substack --publication-url https://example.substack.com status -``` - -List the publications available to the authenticated account: - -```bash -substack publications list -``` diff --git a/docs/before.png b/docs/before.png deleted file mode 100644 index 626f0c3..0000000 Binary files a/docs/before.png and /dev/null differ diff --git a/docs/cli.md b/docs/cli.md deleted file mode 100644 index 946bb8e..0000000 --- a/docs/cli.md +++ /dev/null @@ -1,121 +0,0 @@ ---- -layout: default -title: Unified CLI ---- - -# Unified CLI - -Global options such as `--json`, `--cookies`, and `--publication-url` must -appear before the command. - -## Create an unpublished draft - -```bash -substack drafts create post.md -``` - -The title comes from the first Markdown heading, then the filename if the file -has no heading. Use `--title` to override it. - -## Export a draft to Markdown - -Print a read-only Markdown backup to standard output: - -```bash -substack drafts export 12345 -``` - -Write it to a UTF-8 file: - -```bash -substack drafts export 12345 --output backup.md -``` - -The command refuses to replace an existing file unless `--force` is present. -It fetches the draft but performs no server writes. Content without a supported -Markdown representation is emitted as a versioned opaque HTML comment instead -of being silently discarded. - -## Update a draft from Markdown - -Preview the generated update without writing to Substack: - -```bash -substack drafts update 12345 revised-post.md --dry-run --yes -``` - -Apply it after review: - -```bash -substack drafts update 12345 revised-post.md --yes -``` - -Updates preserve unsupported editor nodes exported as -`python-substack-node:v1` markers and editor image attributes preserved in -`python-substack-image:v2` markers. The command refuses to remove or alter -those nodes by default. `--allow-unsupported-change` and -`--allow-image-replacement` are available only with `--yes` for intentional -modifications or unmatched image replacements. - -Draft updates also verify the revision fingerprint exported in -`python-substack-revision:v1` markers. If remote draft changes occurred after -export, the update fails closed to prevent overwriting remote work. Dry-run -updates (`--dry-run --yes`) report specific mismatch details. Markdown files -lacking revision metadata are treated as unprotected updates. Pass -`--allow-conflict --yes` (or `--force --yes`) to explicitly override conflicts -or apply unprotected updates. The CLI uses its authenticated API client while -rendering, so local images can upload even during a dry run. - -## Select a publication - -List every publication available to the authenticated account: - -```bash -substack publications list -``` - -Select one for a single command: - -```bash -substack --publication-url https://example.substack.com drafts list -``` - -## Schedule an existing draft - -Pass an ISO 8601 timestamp with a timezone offset or `Z`: - -```bash -substack drafts schedule 12345 --at 2030-01-02T09:00:00+01:00 -``` - -Remove the schedule without deleting the draft: - -```bash -substack drafts unschedule 12345 -``` - -## Stable JSON for automation - -```bash -substack --json drafts list --limit 10 -substack --json drafts export 12345 -``` - -The command writes a JSON object containing `drafts`, `count`, `filter`, -`offset`, and `limit`. Errors are also JSON when `--json` is present. -Export JSON contains `action`, `draft_id`, `markdown`, and -`unsupported_nodes`. - -## Publish and delete - -```bash -substack drafts publish 12345 --no-send -substack drafts delete 12345 --yes -``` - -Publishing and deletion require confirmation. JSON and noninteractive -workflows must pass `--yes`. Publishing runs Substack's prepublish check first. -See [safety and publishing behavior](safety.md). - -The original console scripts remain supported. See -[legacy CLI commands](legacy-cli.md). diff --git a/docs/compatibility.md b/docs/compatibility.md deleted file mode 100644 index dacca58..0000000 --- a/docs/compatibility.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default -title: Compatibility policy ---- - -# Compatibility policy - -python-substack preserves its established public interfaces while progressing -to 1.0 and throughout the 1.x series. - -## Supported public contracts - -- `substack.Api` and `substack.post.Post`. -- Existing public method names, argument meanings, and defaults. -- Console commands: - - `substack` - - `substack-auth-check` - - `substack-publish-markdown` - - `substack-publish-yaml` - - `substack-mcp` -- Existing unified CLI commands, flags, confirmation behavior, and exit codes. -- Existing keys in documented JSON output. -- Environment variables: - - `EMAIL` - - `PASSWORD` - - `PUBLICATION_URL` - - `COOKIES_PATH` - - `COOKIES_STRING` -- Existing MCP tool names, arguments, and defaults. - -New optional arguments, commands, methods, tools, and JSON fields may be added. - -## Deprecation - -An established interface may be documented as deprecated, but it will not be -removed before 2.0. Deprecated behavior remains tested while it is supported. -Legacy console commands remain supported throughout 1.x. - -## Upstream behavior - -Substack does not provide a stable public API for the operations used by this -package. Compatible fixes for upstream endpoint or response changes may alter -internal requests while preserving the package's documented behavior. - -Operations that write, publish, send, or delete content remain explicit. -Draft creation remains unpublished by default. - -## Version support - -The supported Python versions are declared in `pyproject.toml` and on PyPI. -Continuous integration tests every declared minor version. Security and -compatibility fixes target the latest python-substack release. diff --git a/docs/getting-started.md b/docs/getting-started.md deleted file mode 100644 index 3e71ada..0000000 --- a/docs/getting-started.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: default -title: Installation and first draft ---- - -# Installation and first draft - -This is the shortest path from a Markdown file to a safe unpublished Substack -draft. - -## 1. Install - -```bash -python -m pip install python-substack -substack --version -``` - -## 2. Authenticate - -Create a `.env` file in your working directory. Cookie authentication is -usually the most reliable option: - -```env -COOKIES_PATH=cookies.json -PUBLICATION_URL=https://example.substack.com -``` - -See [authentication and cookies](authentication.md) for browser-cookie export, -password authentication, and secret-handling guidance. - -Confirm the selected account and publication: - -```bash -substack status -``` - -## 3. Write Markdown - -Save this as `first-draft.md`: - -```markdown -# My first automated draft - -This draft was created from **Markdown**. - -- Review it in Substack. -- Publish only when it is ready. -``` - -Markdown source: - -![Markdown before conversion](before.png) - -Rendered in Substack: - -![Substack after conversion](after.png) - -## 4. Create the draft - -```bash -substack drafts create first-draft.md -``` - -`drafts create` always creates an unpublished draft. It never schedules, -sends, publishes, or deletes content. Open the returned draft ID in Substack -and review it there. - -Continue with the [unified CLI guide](cli.md) or use the -[Python SDK](python-sdk.md). diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 403372f..0000000 --- a/docs/index.md +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: default -title: python-substack documentation ---- - -# python-substack documentation - -Create, inspect, schedule, and publish Substack drafts from Markdown through -Python, a command-line interface, or MCP. - -Start with [installation and your first draft](getting-started.md). The final -command in that guide creates an unpublished draft and does not schedule, send, -publish, or delete it. - -## Guides - -- [Installation and first draft](getting-started.md) -- [Authentication and cookies](authentication.md) -- [Unified CLI](cli.md) -- [Python SDK](python-sdk.md) -- [Markdown syntax](markdown.md) -- [MCP setup](mcp.md) -- [Agent workflow](agents.md) -- [Safety and publishing behavior](safety.md) -- [Troubleshooting](troubleshooting.md) - -## More documentation - -- [Legacy CLI commands](legacy-cli.md) -- [Low-level Python API](low-level-api.md) -- [YAML drafts](yaml.md) -- [Compatibility policy](compatibility.md) -- [Release checklist](releasing.md) -- [Changelog](https://github.com/ma2za/python-substack/blob/main/CHANGELOG.md) diff --git a/docs/legacy-cli.md b/docs/legacy-cli.md deleted file mode 100644 index 6fa9fd8..0000000 --- a/docs/legacy-cli.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default -title: Legacy CLI commands ---- - -# Legacy CLI commands - -The original standalone console commands remain supported for compatibility. -New automation should prefer the unified `substack` command. - -Check authentication: - -```bash -substack-auth-check -substack-auth-check --cookies cookies.json -``` - -Create a Markdown draft: - -```bash -substack-publish-markdown post.md --title "My Post" -``` - -Create and publish only when explicitly requested: - -```bash -substack-publish-markdown post.md --title "My Post" --publish -``` - -Create or publish from YAML: - -```bash -substack-publish-yaml draft.yaml -``` - -Markdown options: - -```bash -substack-publish-markdown post.md \ - --title "My Post" \ - --subtitle "Optional subtitle" \ - --tag python \ - --tag substack \ - --slug my-post \ - --search-engine-title "SEO title" \ - --search-engine-description "SEO description" -``` - -Both publishing commands create drafts by default. `--publish` opts into -publishing. `--no-send` prevents email delivery when publishing. diff --git a/docs/low-level-api.md b/docs/low-level-api.md deleted file mode 100644 index 8e6a615..0000000 --- a/docs/low-level-api.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: default -title: Low-level Python API ---- - -# Low-level Python API - -Most callers should use `Api.create_draft_from_markdown`. The `Post` builder is -available for direct construction of Substack editor nodes. - -```python -import os - -from dotenv import load_dotenv -from substack import Api -from substack.post import Post - -load_dotenv() - -api = Api( - email=os.getenv("EMAIL"), - password=os.getenv("PASSWORD"), - publication_url=os.getenv("PUBLICATION_URL"), -) - -post = Post( - title="How to publish a Substack post using Python", - subtitle="Created with python-substack", - user_id=api.get_user_id(), - audience="everyone", - write_comment_permissions="everyone", -) - -post.paragraph("This is a paragraph.") -post.add( - { - "type": "paragraph", - "content": [ - {"content": "A link to "}, - { - "content": "Substack", - "marks": [{"type": "link", "href": "https://substack.com"}], - }, - ], - } -) -post.add({"type": "paywall"}) -post.add({"type": "captionedImage", "src": "https://example.com/image.png"}) - -draft = api.post_draft(post.get_draft()) -api.prepublish_draft(draft["id"]) -api.publish_draft(draft["id"]) -``` - -The final three calls write to Substack. `post_draft` creates an unpublished -draft. `publish_draft` publishes it and should be called only after review. - -The node schema is undocumented upstream and may change. Prefer the Markdown -renderer when it supports the content being authored. diff --git a/docs/markdown.md b/docs/markdown.md deleted file mode 100644 index 25728c5..0000000 --- a/docs/markdown.md +++ /dev/null @@ -1,260 +0,0 @@ ---- -layout: default -title: Markdown support ---- - -# Markdown support - -`Post.from_markdown(markdown_content, api=None)` converts a Markdown document -into Substack's document format. Parsing is handled by -[markdown-it-py](https://github.com/executablebooks/markdown-it-py) (CommonMark) -plus a few plugins, so standard CommonMark works as you'd expect. This page -documents everything that maps to a Substack node. - -```python -from substack.post import Post - -post = Post(title="My Post", subtitle="", user_id=api.get_user_id()) -post.from_markdown(open("post.md").read(), api=api) -draft = api.post_draft(post.get_draft()) -``` - -Pass `api=` when your Markdown references local images so they can be uploaded -(see [Images](#images)); it is optional otherwise. - -## Text formatting - -| Markdown | Result | -|-------------------------------|-------------------| -| `**bold**` | **bold** | -| `*italic*` | *italic* | -| `***bold italic***` | ***bold italic*** | -| `` `inline code` `` | `inline code` | -| `~~strikethrough~~` | ~~strikethrough~~ | -| `^superscript^` | superscript | -| `~subscript~` | subscript | -| `[text](https://example.com)` | link | -| `` | autolinked URL | -| `[text]{style="color:#hex"}` | text color | -| `[text]{style="background-color:#hex"}` | highlight | - -Note that subscript uses a single tilde (`~x~`) and strikethrough uses a double -tilde (`~~x~~`); both work in the same document. - -Text color and highlight use Pandoc-style span attributes: a `[span]` followed -immediately by `{style="..."}`. Only the `color` and `background-color` -declarations are recognized (others are ignored), and both may be combined in -one span: - -```markdown -[colorized text]{style="color:#ff00ff"} -[highlighted text]{style="background-color:#ffff00"} -[both]{style="color:#ffffff; background-color:#000000"} -``` - -When a property is repeated, its last nonempty declaration wins. Nested spans -override the same property on their parent while inheriting other styles. -Styles on an inner span do not affect its siblings. - -A `{...}` block elsewhere (after an image, link, or inline code) is left as -plain text; the syntax is only recognized immediately after a `[span]`. - -## Headings - -Levels 1–6, using `#` through `######`. Headings may contain inline formatting -and links. - -```markdown -# Heading level 1 -## Heading level 2 with **bold** and a [link](https://example.com) -``` - -## Paragraphs and line breaks - -Blank lines separate paragraphs. A single newline within a paragraph is treated -as a space (soft break), matching CommonMark. - -## Lists - -Bullet lists (`-`, `*`, or `+`) and ordered lists (`1.`), including nesting: - -```markdown -- Bullet one -- Bullet two - - Nested bullet - 1. Nested number - -1. Ordered one -2. Ordered two -``` - -## Blockquotes - -```markdown -> A blockquote. -> -> With multiple paragraphs. -``` - -## Code blocks - -Fenced code blocks, with an optional language for syntax highlighting, and -indented code blocks: - -````markdown -```python -print("hello") -``` -```` - -## Horizontal rule - -```markdown ---- -``` - -## Images - -A paragraph containing only an image becomes a captioned image. - -```markdown -![Alt text](https://example.com/image.png) -``` - -- **Caption:** use the CommonMark title slot β€” `![alt](url "caption text")`. -- **Link:** wrap the image in a link β€” `[![alt](url)](https://target.com)`. -- **Local upload:** if `api=` is passed and the `src` is a local path (not an - `http(s)` URL), the file is uploaded to Substack and the returned URL is used. - Absolute paths are preserved, `~` expands to the user's home directory, and - relative paths resolve from the current working directory. A leading `/` is - removed only as a legacy fallback when the absolute file does not exist and - the corresponding relative file does. Missing files and failed uploads raise - an error naming the file instead of silently saving a broken image. - PNG, JPEG, GIF, and WebP are uploaded without conversion, including animations. - HTTP(S) and protocol-relative URLs remain unchanged. Without `api=`, image - sources remain unchanged and no files are uploaded or checked for existence. - Rendering with `api=` can upload images even during a draft update's dry run. - -```markdown -![A chart](chart.png "Figure 1: quarterly results") -``` - -## Footnotes - -References become inline anchors; definitions become footnote blocks at the end, -numbered by order of first appearance. Labels may be numeric or named, and a -definition may contain block content such as lists or multiple paragraphs. - -```markdown -A claim that needs support.[^1] Another, with a named label.[^source] - -[^1]: The supporting detail, with a [link](https://example.com). -[^source]: Author, *Title* (2025). -``` - -A reference used more than once is emitted as a separate numbered anchor each -time, mirroring the Substack editor. Definitions that are never referenced are -dropped. - -## Math (LaTeX) - -Inline math with single dollars, block math with double dollars: - -```markdown -Einstein showed $E=mc^2$ inline. - -$$ -\int_0^\infty e^{-x} \, dx = 1 -$$ -``` - -Delimiters follow Pandoc's rules: the opening `$` must not be followed by -whitespace, and the closing `$` must not be preceded by whitespace or followed -by a digit. Ordinary dollar amounts (`$5 million to $10 million`) therefore -stay plain text. A label after a block (`$$ ... $$ (label)`) is accepted but -discarded, since Substack has no equation labels. Unclosed math delimiters remain -plain text. - -## Pull quotes and callouts - -These use fenced-container syntax (`:::`), since they have no native Markdown -equivalent: - -```markdown -:::pullquote -A highlighted pull quote. **Formatting** works inside. -::: - -:::callout -A callout block, e.g. an aside or note. -::: -``` - -Empty pull quotes and callouts produce an empty paragraph so the resulting -document remains valid. Unknown `:::` container names remain ordinary text. - -## Not supported - -- **Tables** β€” Substack has no table renderer or editor UI for them, so GFM - table syntax is not converted. To include tabular data, embed a chart (for - example via [Datawrapper](https://support.substack.com/hc/en-us/articles/15722290158100)) - and add it in the Substack editor. -- Widgets authored only in the Substack editor (buttons, polls, embeds, etc.) - have no Markdown equivalent. - -## Draft export and opaque nodes - -`Api.export_draft_to_markdown(draft_id)` and `substack drafts export DRAFT_ID` -reverse supported Substack nodes into Markdown. The export is read-only and -returns every unsupported node separately in `unsupported_nodes`. - -Unsupported nodes and supported nodes with unknown fields are also kept at -their document position as: - -```text - -``` - -The payload is UTF-8 JSON encoded with URL-safe base64 and no padding. This -makes unsupported content visible and recoverable instead of silently dropping -it. `Api.update_draft_from_markdown` and `substack drafts update` recognize -valid markers and preserve the corresponding nodes. They refuse updates that -remove, duplicate, or alter remote unsupported nodes unless the caller -explicitly authorizes that change with `allow_unsupported_change=True` or -`--allow-unsupported-change --yes`. - -Export preserves the Markdown meaning of supported images: source, alt text, -link, and plain-text caption. In addition, images are exported with an immediate: - -```text - -``` - -The payload binds the image to its original remote source and preserves -editor layout and non-owned attributes (such as alignment, dimensions, -watermark, and unrecognized attributes). Markdown remains authoritative for -`src`, `alt`, `href`, and caption. Changed image sources resolve to their bound -remote image and restore those attributes safely. Stale, corrupt, duplicate, -reused, or non-adjacent markers are rejected. Unmatched image replacements require -`allow_image_replacement=True` or `--allow-image-replacement --yes`. Legacy `v1` -image markers remain supported when the image source resolves to exactly one -remote image. - -## Revision fingerprint and conflict prevention - -Exported Markdown drafts include a top-level revision marker: - -```text - -``` - -The payload contains the exported `draft_id`, a deterministic SHA-256 body hash, -title, subtitle, audience, comment permissions, section ID, slug, and timestamp. -On draft update, `python-substack` compares the submitted expected revision -against the current remote draft before any write. If remote changes were made -after export, the update fails closed with `DraftConflictError` to prevent silent -data loss. Dry-run updates (`--dry-run --yes`) return actionable mismatch -details. Older Markdown files without revision metadata are treated as -unprotected updates. Conflicted or unprotected updates require explicit -authorization with `allow_conflict=True` (or `force=True`) in Python or -`--allow-conflict --yes` (or `--force --yes`) in the CLI. diff --git a/docs/mcp.md b/docs/mcp.md deleted file mode 100644 index 54967e2..0000000 --- a/docs/mcp.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -layout: default -title: MCP server ---- - -# MCP server - -Install the optional dependency and start the stdio server: - -```bash -pip install "python-substack[mcp]" -substack-mcp -``` - -Equivalent Python entry point: - -```bash -python -c "from substack_mcp.mcp_server import main; main()" -``` - -The server uses the same `EMAIL`, `PASSWORD`, `PUBLICATION_URL`, -`COOKIES_PATH`, and `COOKIES_STRING` environment variables as the SDK. - -## Available Tools - -The server exposes tools for reading content, managing drafts, and publishing. - -**Read Operations (Safe to run automatically):** -- `get_status()` - Verify authentication and get basic user/publication information. -- `list_publications()` - List all publications you have access to. -- `list_drafts(filter="draft", offset=0, limit=25)` - View recent drafts. -- `get_draft(draft_id)` - Read the content and metadata of a specific draft. - -**Draft Creation and Reversible Writes:** -- `post_draft_from_markdown(...)` - Creates an unpublished draft from Markdown. -- `put_draft(draft_id, update_payload)` - Update draft metadata (e.g. slug). -- `add_tags(draft_id, tags)` - Attach tags to a draft. -- `prepublish_draft(draft_id)` - Run Substack's pre-publication checks on a draft. -- `schedule_draft(draft_id, at)` - Schedule a draft for publication at an ISO timestamp. -- `unschedule_draft(draft_id)` - Remove a publication schedule from a draft. - -**Publishing Operations (Use with caution):** -- `publish_draft_checked(draft_id, confirm=False, send=False, share_automatically=False)` - **Recommended**. A safer publishing path that requires explicit confirmation (`confirm=True`), runs prepublish checks automatically, and defaults to *not* sending emails. -- `publish_draft(draft_id, send=True, share_automatically=False)` - *Legacy compatibility interface*. Publishes immediately and defaults to sending email. - -## Client Configuration Examples - -### Claude Desktop - -You can configure Claude Desktop to use `python-substack` as an MCP server by adding it to your `claude_desktop_config.json`: - -```json -{ - "mcpServers": { - "substack": { - "command": "substack-mcp", - "env": { - "EMAIL": "your-email@example.com", - "PASSWORD": "your-password" - } - } - } -} -``` - -If you prefer to use session cookies instead of a password, use the `COOKIES_STRING` variable: - -```json -{ - "mcpServers": { - "substack": { - "command": "substack-mcp", - "env": { - "COOKIES_STRING": "cookie1=value1; cookie2=value2" - } - } - } -} -``` diff --git a/docs/metrics.md b/docs/metrics.md deleted file mode 100644 index 360f7ce..0000000 --- a/docs/metrics.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -layout: default -title: Adoption metrics ---- - -# Adoption metrics - -Metrics are recorded without adding telemetry to the package. - -## 0.2.0 baseline - -Baseline date: 2026-07-29 - -| Metric | Value | Source | -|---|---:|---| -| GitHub stars | 158 | GitHub repository | -| GitHub forks | 28 | GitHub repository | -| Cumulative downloads | Approximately 33.5k | Pepy | -| Rolling 30-day downloads | 12,272 | PyPI Stats | -| 14-day views | 118 | GitHub Insights | -| 14-day unique visitors | 49 | GitHub Insights | -| 14-day clones | 261 | GitHub Insights | -| 14-day unique clones | 140 | GitHub Insights | - -Release-time referrers: - -| Referrer | Views | Unique visitors | -|---|---:|---:| -| github.com | 61 | 14 | -| Google | 15 | 10 | -| community.n8n.io | 1 | 1 | -| search.brave.com | 1 | 1 | - -The rolling 30-day count of 12,272 is the download growth denominator for the -1.0 goal. The corresponding target is at least 36,816 rolling 30-day downloads. -Record it immediately before publishing 0.2.0 using: - -```text -https://pypistats.org/api/packages/python-substack/recent -``` - -Update this page and the local maintainer release record at release time and -approximately 14 days after every release. - -## 0.3.0 release - -Release date: 2026-08-09 - -| Metric | Value | Change from 0.2.0 baseline | -|---|---:|---:| -| GitHub stars | 160 | +2 | -| GitHub forks | 28 | 0 | -| Rolling 30-day downloads | 13,528 | +1,256 (+10.2%) | -| 14-day views | 99 | -19 | -| 14-day unique visitors | 40 | -9 | -| 14-day clones | 187 | -74 | -| 14-day unique clones | 91 | -49 | - -Release-time referrers: - -| Referrer | Views | Unique visitors | -|---|---:|---:| -| github.com | 42 | 8 | -| Google | 18 | 11 | -| search.brave.com | 3 | 2 | -| DuckDuckGo | 2 | 1 | -| pypi.org | 2 | 1 | - -The GitHub Pages site was first deployed for 0.3.0, so it has no prior Pages -traffic baseline. Record the first comparable documentation measurement -approximately 14 days after release. diff --git a/docs/python-sdk.md b/docs/python-sdk.md deleted file mode 100644 index 20dc5c0..0000000 --- a/docs/python-sdk.md +++ /dev/null @@ -1,83 +0,0 @@ ---- -layout: default -title: Python SDK ---- - -# Python SDK - -Use `Api.create_draft_from_markdown` for the same draft-only workflow as the -CLI: - -```python -import os - -from dotenv import load_dotenv -from substack import Api - -load_dotenv() - -api = Api( - cookies_path=os.getenv("COOKIES_PATH"), - publication_url=os.getenv("PUBLICATION_URL"), -) - -result = api.create_draft_from_markdown( - title="Shipping with Python", - subtitle="A draft created from a script", - markdown="# Hello\n\nThis is **Markdown**.", - tags=["python", "automation"], -) - -print(result["draft"]["id"]) -``` - -The method creates an unpublished draft by default. It publishes only when -`publish=True` is passed. It can also set audience, comment permissions, SEO -metadata, slug, section, and tags. - -## Export a draft without modifying it - -```python -from pathlib import Path - -result = api.export_draft_to_markdown(12345) - -Path("backup.md").write_text(result["markdown"], encoding="utf-8") -print(result["unsupported_nodes"]) -``` - -The result contains the original `draft`, exported `markdown`, and an -`unsupported_nodes` list. The method performs one draft read and no server -writes. Unsupported editor nodes remain embedded in the Markdown as opaque, -decodable markers. - -For supported syntax, see the [Markdown reference](markdown.md). For direct -editor-node construction, see the [low-level Python API](low-level-api.md). - -## Update a draft safely - -Preview an update before writing it: - -```python -preview = api.update_draft_from_markdown( - 12345, - "# Revised title\n\nUpdated body.", - dry_run=True, -) -print(preview["payload"]) -``` - -Run the same call without `dry_run=True` to write the update. Unsupported -editor nodes exported as `python-substack-node:v1` markers are preserved by -default. Removing or changing them raises `ValueError` unless -`allow_unsupported_change=True` is deliberately supplied. Similarly, image -replacements that cannot resolve to their original remote source require -`allow_image_replacement=True`. - -The method verifies the revision fingerprint from `python-substack-revision:v1` -markers before updating. If the remote draft changed after export, it raises -`DraftConflictError` unless `allow_conflict=True` (or `force=True`) is passed. -Files lacking revision metadata are treated as unprotected updates and also -require `allow_conflict=True`. In dry-run mode (`dry_run=True`), conflict -status and specific mismatch details are returned in `preview["conflict"]` and -`preview["mismatches"]`. diff --git a/docs/releases/0.1.26.md b/docs/releases/0.1.26.md deleted file mode 100644 index 44e06c7..0000000 --- a/docs/releases/0.1.26.md +++ /dev/null @@ -1,33 +0,0 @@ ---- -layout: default -title: python-substack 0.1.26 ---- - -# python-substack 0.1.26 - -Version 0.1.26 adds a unified command-line interface for day-to-day Substack operations. - -## Highlights - -- Check authentication, publication selection, and subscriber count with `substack status`. -- List publications and inspect drafts without writing Python code. -- Schedule, unschedule, publish, and delete drafts with explicit safety controls. -- Use `--json` for stable machine-readable output in scripts and automation. -- Override the selected publication per command with `--publication-url`. -- Run on Python 3.10 through 3.14 with pull-request CI and validated release artifacts. - -Existing Python APIs, MCP tools, environment variables, and console commands remain available. - -## Quick examples - -```bash -substack status -substack drafts list -substack --json drafts get 12345 -substack drafts schedule 12345 --at 2026-08-01T09:00:00+03:00 -substack drafts publish 12345 --no-send -``` - -## Announcement copy - -python-substack 0.1.26 is now a practical Substack operations CLI as well as a Python SDK. The new `substack` command can inspect publications and drafts, manage schedules, publish without sending email, and safely delete drafts. It also provides stable JSON output for automation. Install it with `pip install -U python-substack`. diff --git a/docs/releases/0.1.27.md b/docs/releases/0.1.27.md deleted file mode 100644 index c07a9aa..0000000 --- a/docs/releases/0.1.27.md +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: default -title: python-substack 0.1.27 ---- - -# python-substack 0.1.27 - -Version 0.1.27 turns a Markdown file into a rich Substack draft through the -main CLI and strengthens package validation around that workflow. - -## Highlights - -- Create an unpublished draft with `substack drafts create post.md`. -- Set title, subtitle, audience, comment permissions, SEO metadata, slug, - section, and repeatable tags from the unified CLI. -- Render inline and block LaTeX, superscript, subscript, pull quotes, and - callouts from Markdown. -- Handle both known subscriber-count response formats. -- Restore draft scheduling and unscheduling against Substack's current endpoint. -- Retry rate-limited reads and deletes with bounded backoff while avoiding unsafe POST retries. -- Keep live Substack tests opt-in while validating offline tests on Python 3.10 - through 3.14 and clean wheel installations on Python 3.10 and 3.14. - -Existing Python APIs, MCP tools, environment variables, standalone console -commands, defaults, and CLI output contracts remain available. - -## Quick examples - -```bash -substack drafts create post.md -substack --json drafts create post.md --tag python --tag substack -substack drafts publish 12345 --no-send -``` - -Creation never publishes, schedules, sends, or deletes a draft. Publishing -remains a separate command with the existing confirmation safeguards. If tag -assignment fails after Substack creates the draft, the draft may remain in the -publication and is not deleted automatically. - -## Observable Markdown changes - -Text matching the new `$...$`, `$$...$$`, `^...^`, `~...~`, `:::pullquote`, -or `:::callout` syntax now produces corresponding Substack document nodes. -Ordinary currency amounts remain text, and `~~...~~` remains strikethrough. - -## Announcement copy - -python-substack 0.1.27 can now turn a Markdown file directly into a rich, -unpublished Substack draft with `substack drafts create post.md`. The release -adds LaTeX, superscript, subscript, pull quotes, and callouts, while strengthening -clean-install and release validation. Install it with -`pip install -U python-substack`. diff --git a/docs/releases/0.10.0.md b/docs/releases/0.10.0.md deleted file mode 100644 index 126268f..0000000 --- a/docs/releases/0.10.0.md +++ /dev/null @@ -1,24 +0,0 @@ ---- -layout: default -title: Release 0.10.0 -parent: Releases ---- - -# Release 0.10.0 - -## Added - -- Export a stable remote revision fingerprint in Markdown backup metadata via - `python-substack-revision:v1` markers. -- Conflict-aware draft updates: compare submitted expected revision with current - remote draft before any write, preventing silent overwrites of remote changes. -- Return actionable mismatch details (body changes, title, subtitle, audience, - permissions, section, slug) during dry-run updates (`--dry-run --yes`). -- Fail closed by default on conflicted updates or missing revision metadata - (unprotected updates). -- Add explicit override via `--allow-conflict` / `--force` (requiring `--yes`) - in CLI and `allow_conflict=True` / `force=True` in SDK. -- Export `revision` dictionary metadata in `Api.export_draft_to_markdown` and - CLI `--json drafts export`. -- Introduce `DraftConflictError` exception inheriting from both `ValueError` and - `SubstackException`. diff --git a/docs/releases/0.2.0.md b/docs/releases/0.2.0.md deleted file mode 100644 index 49a910b..0000000 --- a/docs/releases/0.2.0.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -layout: default -title: python-substack 0.2.0 ---- - -# python-substack 0.2.0 - -Version 0.2.0 makes python-substack easier to adopt safely and establishes the -compatibility and release-security foundation for the path to 1.0. - -## Highlights - -- Start with a three-command Markdown-to-draft workflow. -- See the draft-only safety guarantee before any publishing instructions. -- Use focused guides for authentication, Markdown, legacy commands, the - low-level Python API, YAML, and MCP. -- Rely on a documented compatibility commitment for existing Python, CLI, - JSON, environment, console-script, and MCP interfaces. -- Follow dedicated contributing and security-reporting policies. -- Install artifacts published through short-lived PyPI Trusted Publishing - credentials. -- Develop with current pre-commit, Black, and isort hooks. - -No runtime interface changed in this release. - -## Quick start - -```bash -pip install -U python-substack -substack status -substack drafts create post.md -``` - -The final command creates an unpublished draft. Review it in Substack before -running a separate publish command. - -## Compatibility - -Existing Python APIs, five console scripts, unified CLI commands and flags, -defaults, JSON keys, environment variables, and MCP tools remain available. -Legacy standalone commands remain supported throughout the 1.x series. - -## Announcement copy - -python-substack 0.2.0 is now organized around one safe workflow: write in -Markdown, create an unpublished Substack draft, review it, and publish only -when ready. The release adds focused authentication, CLI, Python, YAML, MCP, -compatibility, contributing, and security documentation while moving PyPI -publishing to short-lived trusted credentials. Install it with -`pip install -U python-substack`. diff --git a/docs/releases/0.3.0.md b/docs/releases/0.3.0.md deleted file mode 100644 index e88dc83..0000000 --- a/docs/releases/0.3.0.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: default -title: python-substack 0.3.0 ---- - -# python-substack 0.3.0 - -Version 0.3.0 gives new users a focused five-minute path from installation to -a safe unpublished Substack draft and publishes the complete documentation on -GitHub Pages. - -## Highlights - -- Start from a task-oriented documentation index. -- Reach an unpublished draft using one getting-started page. -- Follow tested examples for draft creation, scheduling, publication - selection, JSON automation, and authentication verification. -- See the existing Markdown source and rendered Substack screenshots in one - walkthrough. -- Navigate focused CLI, Python SDK, safety, and troubleshooting guides without - losing any previous documentation path. - -No runtime interface changed in this release. - -## Announcement copy - -python-substack 0.3.0 now has a five-minute guide for turning Markdown into a -safe unpublished Substack draft, plus task-oriented GitHub Pages documentation -for authentication, CLI automation, Python, Markdown, MCP, safety, and -troubleshooting. Install it with `pip install -U python-substack` and start at -https://ma2za.github.io/python-substack/. diff --git a/docs/releases/0.4.0.md b/docs/releases/0.4.0.md deleted file mode 100644 index 9bc610f..0000000 --- a/docs/releases/0.4.0.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: default -title: Release 0.4.0 -parent: Releases ---- - -# Release 0.4.0 - -This release makes the optional MCP server significantly more useful for inspecting and preparing publications without steering agents toward immediate publishing. - -### Added - -- Seven new MCP tools for read operations and safe publishing: `get_status`, `list_publications`, `list_drafts`, `get_draft`, `schedule_draft`, `unschedule_draft`, and `publish_draft_checked`. -- Pre-publish validation, interactive confirmation requirements, and no-email defaults for the new `publish_draft_checked` MCP tool. -- Verified MCP client configuration examples in `docs/mcp.md`. -- Documentation for local agent workflows. - -### Improved - -- Simplify MCP draft creation by routing through the existing `Api.create_draft_from_markdown` SDK helper, preserving response format. -- Document the legacy `publish_draft` MCP tool as the compatibility interface. -- Bump `cryptography` dependency from `48.0.1` to `50.0.0` (#68). diff --git a/docs/releases/0.5.0.md b/docs/releases/0.5.0.md deleted file mode 100644 index 3b148da..0000000 --- a/docs/releases/0.5.0.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -layout: default -title: 0.5.0 -parent: Releases -nav_order: 5 ---- - -# 0.5.0 Release - -## Added - -- Resolve `publication_url` dynamically against Substack subdomains and custom domains. -- Allow optional `timeout` configuration for the API client and CLI. -- Detect local image MIME types (JPEG, PNG, GIF, WebP) for uploads instead of defaulting to JPEG. -- Add Dependabot configuration (#74). - -## Improved - -- Raise `SubstackRequestException` explicitly instead of failing silently when a publication is unavailable. -- Expand secret redaction to cookie-like values in request error messages to prevent credential leaks. -- Ensure bounded retries apply strictly to safe GET and DELETE requests only. -- Bump `fastmcp` from 3.2.0 to 3.4.7 (#73). -- Bump `markdown-it-py` from 3.0.0 to 4.2.0 (#72). -- Bump `pre-commit` from 4.6.1 to 4.6.2 (#71). -- Bump `requests` from 2.33.0 to 2.34.2 (#70). -- Bump `python-dotenv` from 1.2.2 to 1.2.3 (#69). diff --git a/docs/releases/0.6.0.md b/docs/releases/0.6.0.md deleted file mode 100644 index 88144cc..0000000 --- a/docs/releases/0.6.0.md +++ /dev/null @@ -1,56 +0,0 @@ ---- -layout: default -title: 0.6.0 -parent: Releases -nav_order: 6 ---- - -# 0.6.0 Release - -Version 0.6.0 adds loss-aware, read-only backups of Substack drafts as -Markdown. - -## Export from the CLI - -Print a draft as Markdown without changing it on Substack: - -```bash -substack drafts export 12345 -``` - -Write a UTF-8 backup file, refusing accidental replacement by default: - -```bash -substack drafts export 12345 --output backup.md -substack drafts export 12345 --output backup.md --force -``` - -Global JSON mode returns `action`, `draft_id`, `markdown`, and -`unsupported_nodes`. - -## Export from Python - -```python -result = api.export_draft_to_markdown(12345) -markdown = result["markdown"] -unsupported = result["unsupported_nodes"] -``` - -The method performs one draft read and no server writes. - -## Loss-aware rendering - -Export preserves the semantic Markdown content supported by import, including -headings, text marks, links, nested lists, images, captions, code languages, -blockquotes, footnotes, math, pull quotes, and callouts. - -Substack editor nodes without a supported Markdown representation remain at -their document position as versioned URL-safe base64 JSON markers: - -```text - -``` - -They are also returned in `unsupported_nodes`, making unsupported content -visible and recoverable rather than silently discarding it. Version 0.6 does -not import opaque markers back into a draft. diff --git a/docs/releases/0.7.0.md b/docs/releases/0.7.0.md deleted file mode 100644 index 2d77371..0000000 --- a/docs/releases/0.7.0.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -layout: default -title: 0.7.0 -parent: Releases ---- - -# 0.7.0 - -### Added - -- Add `Api.update_draft_from_markdown(draft_id, markdown, ...)` method to safely update draft content. -- Add `substack drafts update DRAFT_ID MARKDOWN_FILE` CLI command with `--dry-run` validation. -- Refuse to update drafts containing unsupported nodes to prevent remote data loss. -- Added `--yes` flag to bypass interactive confirmation for script usage. - -### Dependencies - -- Bump `fastmcp` from 3.4.7 to 4.0.3 (#74). diff --git a/docs/releases/0.8.0.md b/docs/releases/0.8.0.md deleted file mode 100644 index 4968463..0000000 --- a/docs/releases/0.8.0.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -layout: default -title: 0.8.0 -parent: Releases ---- - -# 0.8.0 - -### Added - -- Add `allow_unsupported_change=False` parameter to `Api.update_draft_from_markdown` to safely allow or restrict unsupported node changes. -- Add `--allow-unsupported-change` CLI argument to `substack drafts update`, which requires `--yes` flag to confirm intentional removal/replacement. -- Preserve and reinsert unrecognized/unsupported Substack widgets verbatim from `python-substack-node:v1` markers during Markdown rendering and draft updates. -- Parse block-level and inline-level HTML comment markers containing URL-safe base64-encoded JSON nodes. -- Strictly validate comment markers on base64 integrity, UTF-8 JSON structure, and minimum schema compliance (non-empty `type`) to reject corrupt or malicious inputs. -- Safely ignore ordinary HTML comments without turning them into Substack nodes. diff --git a/docs/releases/0.9.0.md b/docs/releases/0.9.0.md deleted file mode 100644 index 23d592c..0000000 --- a/docs/releases/0.9.0.md +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: default -title: Release 0.9.0 -parent: Releases ---- - -# Release 0.9.0 - -## Added - -- Image metadata markers preserve editor image attributes during Markdown - export and update with `python-substack-image:v1` markers. -- Add `allow_image_replacement=False` and - `substack drafts update --allow-image-replacement` for explicit image - replacement authorization. -- Draft updates preserve uniquely matched remote image attributes and require - explicit authorization for unmatched replacements. - -## Fixed - -- Prevent unintended replacement of remote images with editor metadata during - Markdown draft updates. diff --git a/docs/releases/0.9.1.md b/docs/releases/0.9.1.md deleted file mode 100644 index 6838d7e..0000000 --- a/docs/releases/0.9.1.md +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: default -title: Release 0.9.1 -parent: Releases ---- - -# Release 0.9.1 - -## Added - -- Export `python-substack-image:v2` markers immediately following every image, - binding the image to its original remote source and preserving non-owned - editor attributes including alignment, dimensions, watermark, and unknown - attributes. -- Resolve V2 markers during draft updates by bound original source so changed - image sources in Markdown safely retain editor attributes. -- Reject corrupt, stale, duplicate, reused, or non-adjacent image markers. -- Maintain backwards compatibility for existing V1 image markers when the - submitted image source resolves uniquely to a remote image. - -## Dependencies - -- Bump `pyjwt` from 2.13.0 to 2.15.0 (#80). -- Bump `fastmcp` from 4.0.5 to 4.0.10 (#81). -- Bump `urllib3` from 2.7.0 to 2.8.0 to address CVE-2026-97687, CVE-2026-97688, and CVE-2026-97689. -- Bump `virtualenv` from 21.7.0 to 21.14.5 and `python-discovery` to 1.6.1 to address CVE-2026-102925, CVE-2026-102930, CVE-2026-102937, and CVE-2026-102938. -- Bump `click` from 8.3.1 to 8.5.0 to address PYSEC-2026-2132. - -## Improved - -- Modernize `pyproject.toml` to PEP 621 metadata standard, eliminating Poetry 2 packaging warnings. diff --git a/docs/releasing.md b/docs/releasing.md deleted file mode 100644 index c6b3118..0000000 --- a/docs/releasing.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -layout: default -title: Release checklist ---- - -# Release checklist - -Read the [release plan](../RELEASE_PLAN.md) before release work and update its -status and validation evidence as the release proceeds. - -1. Keep `pyproject.toml` and `substack/__init__.py` on the previous version - while implementing code, tests, workflows, and documentation. -2. Run `poetry install --all-extras`. -3. Run `poetry run pytest -q -m "not live" --strict-markers`. -4. Run `poetry run pytest -q` with live opt-ins unset and confirm all live tests - are skipped. -5. With configured maintainer credentials, run: - - ```bash - RUN_SUBSTACK_E2E=1 poetry run pytest -q -m live - RUN_SUBSTACK_CLI_E2E=1 poetry run pytest -q -m live tests/substack/test_cli_end_to_end.py - ``` - -6. Update `pyproject.toml`, `substack.__version__`, `CHANGELOG.md`, and the - release page to the target version. -7. From a clean checkout, run `poetry check`, `poetry build`, and - `poetry run python -m twine check dist/*`. -8. Install the wheel in fresh base and `[mcp]` virtual environments, run - `pip check`, verify all five console entry points, and import the base and MCP - modules. -9. Push only after CI passes. Create `vX.Y.Z` from that exact commit; the publish - workflow rejects a tag that differs from either package version. -10. After publishing, install `python-substack==X.Y.Z` from PyPI in a clean - environment and repeat the smoke checks before announcing. - -Live tests create disposable drafts and must never publish. Confirm cleanup in -the publication after each run. If an artifact is defective, yank it rather -than attempting to replace the same version. diff --git a/docs/safety.md b/docs/safety.md deleted file mode 100644 index 30ec2e0..0000000 --- a/docs/safety.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -layout: default -title: Safety and publishing behavior ---- - -# Safety and publishing behavior - -Creating, scheduling, publishing, and deleting are separate operations. - -| Operation | Effect | Confirmation | -|---|---|---| -| `drafts export` | Reads a draft and produces Markdown | None | -| `drafts create` | Creates an unpublished draft | None | -| `drafts update` | Updates a draft from Markdown | Interactive or `--yes` | -| `drafts schedule` | Adds a future release time | None | -| `drafts unschedule` | Removes a future release time | None | -| `drafts publish` | Publishes after a prepublish check | Interactive or `--yes` | -| `drafts delete` | Deletes the draft | Interactive or `--yes` | - -`drafts publish --no-send` publishes without email delivery. Omitting -`--no-send` allows Substack to send the post. Review the draft ID and flags -before confirming. - -In JSON or noninteractive mode, publish and delete reject the request unless -`--yes` is supplied. API errors redact configured passwords and cookie values -before they are printed by the CLI. - -Substack's interfaces are undocumented and may change. Keep a reviewed copy of -important source Markdown and verify the selected publication with -`substack status` before any write. - -Export never writes to Substack and never overwrites a local file unless -`--force` is supplied. Unsupported editor content is preserved as an opaque -marker and listed in JSON output so it cannot disappear unnoticed. Updates -refuse to remove or alter those markers or replace remote images without -explicit authorization (`--allow-unsupported-change --yes` or -`--allow-image-replacement --yes`). - -Draft updates verify remote revision fingerprints before writing. If the -remote draft changed after export, the update fails closed with a conflict -error to prevent overwriting remote work. Markdown files lacking revision -metadata are treated as unprotected updates. Overriding conflicts or applying -unprotected updates requires explicit confirmation (`--allow-conflict --yes` -or `--force --yes` in the CLI, `allow_conflict=True` in the SDK). diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md deleted file mode 100644 index d8e2ec5..0000000 --- a/docs/troubleshooting.md +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: default -title: Troubleshooting ---- - -# Troubleshooting - -## The command asks for credentials - -Run commands from the directory containing `.env`, or export the required -environment variables. Use one cookie method or `EMAIL` and `PASSWORD`. See -[authentication and cookies](authentication.md). - -## Password login fails or requests a magic link - -Use a browser cookie file or cookie header string. Cookie authentication reuses -an already authenticated browser session and is usually more reliable when -Substack requires captcha or magic-link sign-in. - -## The wrong publication is selected - -```bash -substack publications list -substack --publication-url https://example.substack.com status -``` - -Set `PUBLICATION_URL` to make the selection persistent for the current -environment. - -## A schedule timestamp is rejected - -Include an explicit timezone offset or `Z`. For example: - -```bash -substack drafts schedule 12345 --at 2030-01-02T09:00:00Z -``` - -## Publishing or deletion requires `--yes` - -Interactive terminal sessions prompt for confirmation. JSON output and other -noninteractive sessions cannot prompt, so pass `--yes` explicitly after -checking the draft ID. - -## A local image does not upload - -Pass the authenticated `Api` instance to `Post.from_markdown(..., api=api)` or -use `Api.create_draft_from_markdown`, which does this automatically. Relative -image paths resolve from the current working directory; absolute paths are -preserved and `~` expands to the current user's home directory. HTTP(S) and -protocol-relative image URLs are not uploaded. Missing files and failed -uploads name the affected path instead of silently retaining a broken source. - -If the problem persists, open an issue using the repository's -[authentication bug form](https://github.com/ma2za/python-substack/issues/new?template=auth_bug.yml) -or [feature request form](https://github.com/ma2za/python-substack/issues/new?template=feature_request.yml). diff --git a/docs/yaml.md b/docs/yaml.md deleted file mode 100644 index b9a0b02..0000000 --- a/docs/yaml.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: default -title: YAML drafts ---- - -# YAML drafts - -The compatibility command `substack-publish-yaml` accepts Markdown-oriented -YAML: - -```yaml -title: "My Post Title" -subtitle: "My Post Subtitle" -audience: "everyone" -write_comment_permissions: "everyone" -search_engine_title: "SEO title" -search_engine_description: "SEO description" -slug: "my-post-title" -tags: - - python - - substack -markdown: | - # Introduction - - This post body is Markdown. -``` - -The Markdown can also live in a separate file: - -```yaml -title: "My Post Title" -markdown_file: "post.md" -``` - -Relative Markdown paths resolve from the YAML file's directory. - -The lower-level node form remains supported: - -```yaml -title: "My Post Title" -subtitle: "My Post Subtitle" -body: - 0: - type: "heading" - level: 1 - content: "Introduction" - 1: - type: "paragraph" - content: "This is a paragraph." - 2: - type: "captionedImage" - src: "local_image.jpg" -``` - -Create a draft: - -```bash -substack-publish-yaml draft.yaml -``` - -Publish only when explicitly requested: - -```bash -substack-publish-yaml draft.yaml --publish --no-send -``` diff --git a/examples/draft.yaml b/examples/draft.yaml index 6866afa..b283059 100644 --- a/examples/draft.yaml +++ b/examples/draft.yaml @@ -6,17 +6,6 @@ audience: "everyone" # everyone, only_paid, founding, only_free write_comment_permissions: "none" # none, only_paid, everyone -search_engine_title: - "This is a short SEO title set via the Python API wrapper." -search_engine_description: - "This is a short SEO description set via the Python API wrapper." -slug: - "this-is-a-draft-post-2" -section: - "rick" -tags: - - "python" - - "api" body: 0: type: "heading" @@ -52,10 +41,10 @@ body: content: "Set the EMAIL, PASSWORD, PUBLICATION_URL and USER_ID environment variables." 7: type: "captionedImage" - src: "examples/rickroll_4k.jpg" + src: "rickroll_4k.jpg" 8: type: "youtube2" src: "EnDg65ISswg" 9: type: "subscribeWidget" - message: "Hello Everyone!!!" + message: "Hello Everyone!!!" \ No newline at end of file diff --git a/examples/get_subscriber_count.py b/examples/get_subscriber_count.py deleted file mode 100644 index ee8a388..0000000 --- a/examples/get_subscriber_count.py +++ /dev/null @@ -1,17 +0,0 @@ -import os - -from dotenv import load_dotenv - -from substack import Api - -load_dotenv() - -if __name__ == "__main__": - api = Api( - email=os.getenv("EMAIL"), - password=os.getenv("PASSWORD"), - publication_url=os.getenv("PUBLICATION_URL"), - ) - - subscriberCount: int = api.get_publication_subscriber_count() - print(f"Subscriber count: {subscriberCount}") diff --git a/examples/publish_markdown.py b/examples/publish_markdown.py deleted file mode 100644 index 84544cc..0000000 --- a/examples/publish_markdown.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -Example: Publishing a post from Markdown content - -This example demonstrates how to use the new Markdown support -to create Substack posts from Markdown files. - -This example reads from README.md to test the Markdown parsing. -""" - -import argparse -import os -from pathlib import Path - -from dotenv import load_dotenv - -from substack import Api -from substack.post import Post - -load_dotenv() - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument( - "-m", - "--markdown", - default="README.md", - required=False, - help="Markdown file to publish (default: README.md).", - type=str, - ) - parser.add_argument( - "--publish", help="Publish the draft.", action="store_true", default=False - ) - parser.add_argument( - "--cookies", - help="Path to cookies JSON file for authentication (optional, can also be set via COOKIES_PATH or COOKIES_STRING env vars).", - type=str, - default=None, - ) - args = parser.parse_args() - - cookies_path = args.cookies or os.getenv("COOKIES_PATH") - cookies_string = os.getenv("COOKIES_STRING") - - # Initialize API - api = Api( - email=os.getenv("EMAIL") if not cookies_path and not cookies_string else None, - password=( - os.getenv("PASSWORD") if not cookies_path and not cookies_string else None - ), - cookies_path=cookies_path, - cookies_string=cookies_string, - publication_url=os.getenv("PUBLICATION_URL"), - ) - - user_id = api.get_user_id() - - # Determine the markdown file path - markdown_path = Path(args.markdown) - if not markdown_path.is_absolute(): - # If relative path, try relative to current directory first, then parent directory - if markdown_path.exists(): - pass # Use as-is - else: - # Try relative to parent directory (for README.md in project root) - markdown_path = Path(__file__).parent.parent / args.markdown - - if not markdown_path.exists(): - print(f"Error: Markdown file not found at {markdown_path}") - exit(1) - - with open(markdown_path, "r", encoding="utf-8") as f: - markdown_content = f.read() - - # Extract title from first heading (if it starts with #) - title = "Python Substack" - subtitle = "Markdown Test Post" - - lines = markdown_content.split("\n") - for line in lines: - if line.startswith("# "): - title = line[2:].strip() - break - elif line.startswith("#"): - # Skip badge lines and other non-title content - continue - - # Create a post - post = Post( - title=title, - subtitle=subtitle, - user_id=user_id, - ) - - # Parse and add Markdown content - print(f"Parsing Markdown from {markdown_path}...") - post.from_markdown(markdown_content, api=api) - - # Create draft - print("Creating draft...") - draft = api.post_draft(post.get_draft()) - - if args.publish: - print("Preparing to publish...") - api.prepublish_draft(draft.get("id")) - print("Publishing...") - api.publish_draft(draft.get("id")) - print("Post published successfully!") - else: - print(f"Draft created with ID: {draft.get('id')}") - print(f"Title: {title}") - print(f"Subtitle: {subtitle}") - print("Use --publish flag to publish the draft.") diff --git a/examples/publish_post.py b/examples/publish_post.py index fc08df9..e5bb7d1 100644 --- a/examples/publish_post.py +++ b/examples/publish_post.py @@ -22,36 +22,21 @@ parser.add_argument( "--publish", help="Publish the draft.", action="store_true", default=False ) - parser.add_argument( - "--cookies", - help="Path to cookies JSON file for authentication (optional, can also be set via COOKIES_PATH or COOKIES_STRING env vars).", - type=str, - default=None, - ) args = parser.parse_args() with open(args.post, "r") as fp: post_data = yaml.safe_load(fp) - cookies_path = args.cookies or os.getenv("COOKIES_PATH") - cookies_string = os.getenv("COOKIES_STRING") - api = Api( - email=os.getenv("EMAIL") if not cookies_path and not cookies_string else None, - password=( - os.getenv("PASSWORD") if not cookies_path and not cookies_string else None - ), - cookies_path=cookies_path, - cookies_string=cookies_string, + email=os.getenv("EMAIL"), + password=os.getenv("PASSWORD"), publication_url=os.getenv("PUBLICATION_URL"), ) - user_id = api.get_user_id() - post = Post( post_data.get("title"), post_data.get("subtitle", ""), - user_id, + os.getenv("USER_ID"), audience=post_data.get("audience", "everyone"), write_comment_permissions=post_data.get( "write_comment_permissions", "everyone" @@ -68,20 +53,6 @@ draft = api.post_draft(post.get_draft()) - # post.set_section(post_data.get("section"), api.get_sections()) - put_draft_kwargs = { - "draft_section_id": post.draft_section_id, - "search_engine_title": post_data.get("search_engine_title"), - "search_engine_description": post_data.get("search_engine_description"), - "slug": post_data.get("slug"), - } - # Remove None values so we only send fields that were explicitly provided - put_draft_kwargs = {k: v for k, v in put_draft_kwargs.items() if v is not None} - - api.put_draft(draft.get("id"), **put_draft_kwargs) - - api.add_tags_to_post(draft.get("id"), post_data.get("tags", [])) - if args.publish: api.prepublish_draft(draft.get("id")) diff --git a/poetry.lock b/poetry.lock index 9f4a91a..ac75d44 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,2658 +1,235 @@ -# This file is automatically @generated by Poetry 2.5.1 and should not be changed by hand. - -[[package]] -name = "aiofile" -version = "3.9.0" -description = "Asynchronous file operations." -optional = true -python-versions = "<4,>=3.8" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "aiofile-3.9.0-py3-none-any.whl", hash = "sha256:ce2f6c1571538cbdfa0143b04e16b208ecb0e9cb4148e528af8a640ed51cc8aa"}, - {file = "aiofile-3.9.0.tar.gz", hash = "sha256:e5ad718bb148b265b6df1b3752c4d1d83024b93da9bd599df74b9d9ffcf7919b"}, -] - -[package.dependencies] -caio = ">=0.9.0,<0.10.0" - -[[package]] -name = "annotated-types" -version = "0.7.0" -description = "Reusable constraint types to use with typing.Annotated" -optional = true -python-versions = ">=3.8" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"}, - {file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"}, -] - -[[package]] -name = "anyio" -version = "4.14.2" -description = "High-level concurrency and networking framework on top of asyncio or Trio" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "anyio-4.14.2-py3-none-any.whl", hash = "sha256:9f505dda5ac9f0c8309b5e8bd445a8c2bf7246f3ce950121e45ea15bc41d1494"}, - {file = "anyio-4.14.2.tar.gz", hash = "sha256:cfa139f3ed1a23ee8f88a145ddb5ac7605b8bbfd8592baacd7ce3d8bb4313c7f"}, -] - -[package.dependencies] -exceptiongroup = {version = ">=1.0.2", markers = "python_version < \"3.11\""} -idna = ">=2.8" -typing_extensions = {version = ">=4.5", markers = "python_version < \"3.13\""} - -[package.extras] -trio = ["trio (>=0.32.0)"] - -[[package]] -name = "attrs" -version = "26.1.0" -description = "Classes Without Boilerplate" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309"}, - {file = "attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32"}, -] - -[[package]] -name = "authlib" -version = "1.9.1" -description = "The ultimate Python library in building OAuth and OpenID Connect servers and clients." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "authlib-1.9.1-py2.py3-none-any.whl", hash = "sha256:8b9be8b1e5174dcbf5520e984f1a22dc2edae5b6e40a61d4cedbf86b97e9e69b"}, - {file = "authlib-1.9.1.tar.gz", hash = "sha256:5c7d9848f47cac340f060f76ae0bc09b59f5c8e89cc1bb032d4370a0c55b5974"}, -] - -[package.dependencies] -cryptography = ">=45.0.1" -joserfc = ">=1.6.8" - -[[package]] -name = "backports-tarfile" -version = "1.2.0" -description = "Backport of CPython tarfile module" -optional = false -python-versions = ">=3.8" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and python_version < \"3.12\"" -files = [ - {file = "backports.tarfile-1.2.0-py3-none-any.whl", hash = "sha256:77e284d754527b01fb1e6fa8a1afe577858ebe4e9dad8919e34c862cb399bc34"}, - {file = "backports_tarfile-1.2.0.tar.gz", hash = "sha256:d75e02c268746e1b8144c278978b6e98e85de6ad16f8e4b0844a154557eca991"}, -] - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["jaraco.test", "pytest (!=8.0.*)", "pytest (>=6,!=8.1.*)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)"] - -[[package]] -name = "beartype" -version = "0.23.1" -description = "Unbearably fast near-real-time pure-Python runtime-static type-checker." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "beartype-0.23.1-py3-none-any.whl", hash = "sha256:4461b4dc57e3fdd6c8a8464b22cf118002eea107c33e9fef651c69068ab3cce3"}, - {file = "beartype-0.23.1.tar.gz", hash = "sha256:8b805f246b32931c74f2b321ea0939fe5bb2ff43c12a3eff19cc4c854b832e1d"}, -] - -[package.extras] -dev = ["autoapi (>=0.9.0)", "celery", "click", "coverage (>=5.5)", "crosshair-tool", "equinox ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "fastmcp (>=4.0.0) ; python_version < \"3.16.0\"", "jax[cpu] ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "jaxtyping ; sys_platform == \"linux\"", "langchain ; python_version < \"3.15.0\" and sys_platform != \"darwin\" and platform_python_implementation != \"PyPy\"", "mypy (>=0.800) ; platform_python_implementation != \"PyPy\"", "nuitka (>=1.2.6) ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "numba ; python_version < \"3.15.0\"", "numpy ; python_version < \"3.15.0\" and sys_platform != \"darwin\" and platform_python_implementation != \"PyPy\"", "pandera (>=0.26.0) ; python_version < \"3.15.0\"", "poetry", "polars ; python_version < \"3.15.0\"", "pydata-sphinx-theme (<=0.7.2)", "pygments", "pyinstaller", "pyright (>=1.1.370)", "pytest (>=6.2.0)", "redis", "rich-click", "setuptools", "sphinx (>=4.2.0,<6.0.0)", "sphinxext-opengraph (>=0.7.5)", "sqlalchemy[asyncio]", "torch ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "tox (>=3.20.1)", "typer", "typing-extensions (>=3.10.0.0)", "xarray ; python_version < \"3.15.0\""] -doc-ghp = ["mkdocstrings-python (>=2.0.3)", "mkdocstrings-python-xref (>=2.1.1)", "zensical (>=0.0.43)"] -doc-rtd = ["autoapi (>=0.9.0)", "pydata-sphinx-theme (<=0.7.2)", "setuptools", "sphinx (>=4.2.0,<6.0.0)", "sphinxext-opengraph (>=0.7.5)"] -test = ["celery", "click", "coverage (>=5.5)", "crosshair-tool", "equinox ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "fastmcp (>=4.0.0) ; python_version < \"3.16.0\"", "jax[cpu] ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "jaxtyping ; sys_platform == \"linux\"", "langchain ; python_version < \"3.15.0\" and sys_platform != \"darwin\" and platform_python_implementation != \"PyPy\"", "mypy (>=0.800) ; platform_python_implementation != \"PyPy\"", "nuitka (>=1.2.6) ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "numba ; python_version < \"3.15.0\"", "numpy ; python_version < \"3.15.0\" and sys_platform != \"darwin\" and platform_python_implementation != \"PyPy\"", "pandera (>=0.26.0) ; python_version < \"3.15.0\"", "poetry", "polars ; python_version < \"3.15.0\"", "pygments", "pyinstaller", "pyright (>=1.1.370)", "pytest (>=6.2.0)", "redis", "rich-click", "sqlalchemy[asyncio]", "torch ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "tox (>=3.20.1)", "typer", "typing-extensions (>=3.10.0.0)", "xarray ; python_version < \"3.15.0\""] -test-tox = ["celery", "click", "crosshair-tool", "equinox ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "fastmcp (>=4.0.0) ; python_version < \"3.16.0\"", "jax[cpu] ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "jaxtyping ; sys_platform == \"linux\"", "langchain ; python_version < \"3.15.0\" and sys_platform != \"darwin\" and platform_python_implementation != \"PyPy\"", "mypy (>=0.800) ; platform_python_implementation != \"PyPy\"", "nuitka (>=1.2.6) ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "numba ; python_version < \"3.15.0\"", "numpy ; python_version < \"3.15.0\" and sys_platform != \"darwin\" and platform_python_implementation != \"PyPy\"", "pandera (>=0.26.0) ; python_version < \"3.15.0\"", "poetry", "polars ; python_version < \"3.15.0\"", "pygments", "pyinstaller", "pyright (>=1.1.370)", "pytest (>=6.2.0)", "redis", "rich-click", "sqlalchemy[asyncio]", "torch ; sys_platform == \"linux\" and python_version < \"3.15.0\"", "typer", "typing-extensions (>=3.10.0.0)", "xarray ; python_version < \"3.15.0\""] -test-tox-coverage = ["coverage (>=5.5)"] - -[[package]] -name = "cachetools" -version = "7.0.5" -description = "Extensible memoizing collections and decorators" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "cachetools-7.0.5-py3-none-any.whl", hash = "sha256:46bc8ebefbe485407621d0a4264b23c080cedd913921bad7ac3ed2f26c183114"}, - {file = "cachetools-7.0.5.tar.gz", hash = "sha256:0cd042c24377200c1dcd225f8b7b12b0ca53cc2c961b43757e774ebe190fd990"}, -] - -[[package]] -name = "caio" -version = "0.9.25" -description = "Asynchronous file IO for Linux MacOS or Windows." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "caio-0.9.25-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:ca6c8ecda611478b6016cb94d23fd3eb7124852b985bdec7ecaad9f3116b9619"}, - {file = "caio-0.9.25-cp310-cp310-manylinux2010_x86_64.manylinux2014_x86_64.manylinux_2_12_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:db9b5681e4af8176159f0d6598e73b2279bb661e718c7ac23342c550bd78c241"}, - {file = "caio-0.9.25-cp310-cp310-manylinux_2_34_aarch64.whl", hash = "sha256:bf61d7d0c4fd10ffdd98ca47f7e8db4d7408e74649ffaf4bef40b029ada3c21b"}, - {file = "caio-0.9.25-cp310-cp310-manylinux_2_34_x86_64.whl", hash = "sha256:ab52e5b643f8bbd64a0605d9412796cd3464cb8ca88593b13e95a0f0b10508ae"}, - {file = "caio-0.9.25-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d6956d9e4a27021c8bd6c9677f3a59eb1d820cc32d0343cea7961a03b1371965"}, - {file = "caio-0.9.25-cp311-cp311-manylinux2010_x86_64.manylinux2014_x86_64.manylinux_2_12_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:bf84bfa039f25ad91f4f52944452a5f6f405e8afab4d445450978cd6241d1478"}, - {file = "caio-0.9.25-cp311-cp311-manylinux_2_34_aarch64.whl", hash = "sha256:ae3d62587332bce600f861a8de6256b1014d6485cfd25d68c15caf1611dd1f7c"}, - {file = "caio-0.9.25-cp311-cp311-manylinux_2_34_x86_64.whl", hash = "sha256:fc220b8533dcf0f238a6b1a4a937f92024c71e7b10b5a2dfc1c73604a25709bc"}, - {file = "caio-0.9.25-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:fb7ff95af4c31ad3f03179149aab61097a71fd85e05f89b4786de0359dffd044"}, - {file = "caio-0.9.25-cp312-cp312-manylinux2010_x86_64.manylinux2014_x86_64.manylinux_2_12_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:97084e4e30dfa598449d874c4d8e0c8d5ea17d2f752ef5e48e150ff9d240cd64"}, - {file = "caio-0.9.25-cp312-cp312-manylinux_2_34_aarch64.whl", hash = "sha256:4fa69eba47e0f041b9d4f336e2ad40740681c43e686b18b191b6c5f4c5544bfb"}, - {file = "caio-0.9.25-cp312-cp312-manylinux_2_34_x86_64.whl", hash = "sha256:6bebf6f079f1341d19f7386db9b8b1f07e8cc15ae13bfdaff573371ba0575d69"}, - {file = "caio-0.9.25-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:d6c2a3411af97762a2b03840c3cec2f7f728921ff8adda53d7ea2315a8563451"}, - {file = "caio-0.9.25-cp313-cp313-manylinux2010_x86_64.manylinux2014_x86_64.manylinux_2_12_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:0998210a4d5cd5cb565b32ccfe4e53d67303f868a76f212e002a8554692870e6"}, - {file = "caio-0.9.25-cp313-cp313-manylinux_2_34_aarch64.whl", hash = "sha256:1a177d4777141b96f175fe2c37a3d96dec7911ed9ad5f02bac38aaa1c936611f"}, - {file = "caio-0.9.25-cp313-cp313-manylinux_2_34_x86_64.whl", hash = "sha256:9ed3cfb28c0e99fec5e208c934e5c157d0866aa9c32aa4dc5e9b6034af6286b7"}, - {file = "caio-0.9.25-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fab6078b9348e883c80a5e14b382e6ad6aabbc4429ca034e76e730cf464269db"}, - {file = "caio-0.9.25-cp314-cp314-manylinux2010_x86_64.manylinux2014_x86_64.manylinux_2_12_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:44a6b58e52d488c75cfaa5ecaa404b2b41cc965e6c417e03251e868ecd5b6d77"}, - {file = "caio-0.9.25-cp314-cp314-manylinux_2_34_aarch64.whl", hash = "sha256:628a630eb7fb22381dd8e3c8ab7f59e854b9c806639811fc3f4310c6bd711d79"}, - {file = "caio-0.9.25-cp314-cp314-manylinux_2_34_x86_64.whl", hash = "sha256:0ba16aa605ccb174665357fc729cf500679c2d94d5f1458a6f0d5ca48f2060a7"}, - {file = "caio-0.9.25-py3-none-any.whl", hash = "sha256:06c0bb02d6b929119b1cfbe1ca403c768b2013a369e2db46bfa2a5761cf82e40"}, - {file = "caio-0.9.25.tar.gz", hash = "sha256:16498e7f81d1d0f5a4c0ad3f2540e65fe25691376e0a5bd367f558067113ed10"}, -] - -[package.extras] -develop = ["aiomisc-pytest", "coveralls", "pylama[toml]", "pytest", "pytest-cov", "setuptools"] - -[[package]] -name = "certifi" -version = "2026.10.19" -description = "Python package for providing Mozilla's CA Bundle." -optional = false -python-versions = ">=3.7" -groups = ["main", "dev"] -files = [ - {file = "certifi-2026.10.19-py3-none-any.whl", hash = "sha256:42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b"}, - {file = "certifi-2026.10.19.tar.gz", hash = "sha256:035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae"}, -] - -[[package]] -name = "cffi" -version = "2.0.0" -description = "Foreign Function Interface for Python calling C code." -optional = false -python-versions = ">=3.9" -groups = ["main", "dev"] -files = [ - {file = "cffi-2.0.0-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:0cf2d91ecc3fcc0625c2c530fe004f82c110405f101548512cce44322fa8ac44"}, - {file = "cffi-2.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f73b96c41e3b2adedc34a7356e64c8eb96e03a3782b535e043a986276ce12a49"}, - {file = "cffi-2.0.0-cp310-cp310-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:53f77cbe57044e88bbd5ed26ac1d0514d2acf0591dd6bb02a3ae37f76811b80c"}, - {file = "cffi-2.0.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3e837e369566884707ddaf85fc1744b47575005c0a229de3327f8f9a20f4efeb"}, - {file = "cffi-2.0.0-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:5eda85d6d1879e692d546a078b44251cdd08dd1cfb98dfb77b670c97cee49ea0"}, - {file = "cffi-2.0.0-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:9332088d75dc3241c702d852d4671613136d90fa6881da7d770a483fd05248b4"}, - {file = "cffi-2.0.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fc7de24befaeae77ba923797c7c87834c73648a05a4bde34b3b7e5588973a453"}, - {file = "cffi-2.0.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:cf364028c016c03078a23b503f02058f1814320a56ad535686f90565636a9495"}, - {file = "cffi-2.0.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:e11e82b744887154b182fd3e7e8512418446501191994dbf9c9fc1f32cc8efd5"}, - {file = "cffi-2.0.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8ea985900c5c95ce9db1745f7933eeef5d314f0565b27625d9a10ec9881e1bfb"}, - {file = "cffi-2.0.0-cp310-cp310-win32.whl", hash = "sha256:1f72fb8906754ac8a2cc3f9f5aaa298070652a0ffae577e0ea9bd480dc3c931a"}, - {file = "cffi-2.0.0-cp310-cp310-win_amd64.whl", hash = "sha256:b18a3ed7d5b3bd8d9ef7a8cb226502c6bf8308df1525e1cc676c3680e7176739"}, - {file = "cffi-2.0.0-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:b4c854ef3adc177950a8dfc81a86f5115d2abd545751a304c5bcf2c2c7283cfe"}, - {file = "cffi-2.0.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:2de9a304e27f7596cd03d16f1b7c72219bd944e99cc52b84d0145aefb07cbd3c"}, - {file = "cffi-2.0.0-cp311-cp311-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:baf5215e0ab74c16e2dd324e8ec067ef59e41125d3eade2b863d294fd5035c92"}, - {file = "cffi-2.0.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:730cacb21e1bdff3ce90babf007d0a0917cc3e6492f336c2f0134101e0944f93"}, - {file = "cffi-2.0.0-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:6824f87845e3396029f3820c206e459ccc91760e8fa24422f8b0c3d1731cbec5"}, - {file = "cffi-2.0.0-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:9de40a7b0323d889cf8d23d1ef214f565ab154443c42737dfe52ff82cf857664"}, - {file = "cffi-2.0.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:8941aaadaf67246224cee8c3803777eed332a19d909b47e29c9842ef1e79ac26"}, - {file = "cffi-2.0.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:a05d0c237b3349096d3981b727493e22147f934b20f6f125a3eba8f994bec4a9"}, - {file = "cffi-2.0.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:94698a9c5f91f9d138526b48fe26a199609544591f859c870d477351dc7b2414"}, - {file = "cffi-2.0.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:5fed36fccc0612a53f1d4d9a816b50a36702c28a2aa880cb8a122b3466638743"}, - {file = "cffi-2.0.0-cp311-cp311-win32.whl", hash = "sha256:c649e3a33450ec82378822b3dad03cc228b8f5963c0c12fc3b1e0ab940f768a5"}, - {file = "cffi-2.0.0-cp311-cp311-win_amd64.whl", hash = "sha256:66f011380d0e49ed280c789fbd08ff0d40968ee7b665575489afa95c98196ab5"}, - {file = "cffi-2.0.0-cp311-cp311-win_arm64.whl", hash = "sha256:c6638687455baf640e37344fe26d37c404db8b80d037c3d29f58fe8d1c3b194d"}, - {file = "cffi-2.0.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:6d02d6655b0e54f54c4ef0b94eb6be0607b70853c45ce98bd278dc7de718be5d"}, - {file = "cffi-2.0.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:8eca2a813c1cb7ad4fb74d368c2ffbbb4789d377ee5bb8df98373c2cc0dee76c"}, - {file = "cffi-2.0.0-cp312-cp312-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:21d1152871b019407d8ac3985f6775c079416c282e431a4da6afe7aefd2bccbe"}, - {file = "cffi-2.0.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:b21e08af67b8a103c71a250401c78d5e0893beff75e28c53c98f4de42f774062"}, - {file = "cffi-2.0.0-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:1e3a615586f05fc4065a8b22b8152f0c1b00cdbc60596d187c2a74f9e3036e4e"}, - {file = "cffi-2.0.0-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:81afed14892743bbe14dacb9e36d9e0e504cd204e0b165062c488942b9718037"}, - {file = "cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3e17ed538242334bf70832644a32a7aae3d83b57567f9fd60a26257e992b79ba"}, - {file = "cffi-2.0.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:3925dd22fa2b7699ed2617149842d2e6adde22b262fcbfada50e3d195e4b3a94"}, - {file = "cffi-2.0.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:2c8f814d84194c9ea681642fd164267891702542f028a15fc97d4674b6206187"}, - {file = "cffi-2.0.0-cp312-cp312-win32.whl", hash = "sha256:da902562c3e9c550df360bfa53c035b2f241fed6d9aef119048073680ace4a18"}, - {file = "cffi-2.0.0-cp312-cp312-win_amd64.whl", hash = "sha256:da68248800ad6320861f129cd9c1bf96ca849a2771a59e0344e88681905916f5"}, - {file = "cffi-2.0.0-cp312-cp312-win_arm64.whl", hash = "sha256:4671d9dd5ec934cb9a73e7ee9676f9362aba54f7f34910956b84d727b0d73fb6"}, - {file = "cffi-2.0.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:00bdf7acc5f795150faa6957054fbbca2439db2f775ce831222b66f192f03beb"}, - {file = "cffi-2.0.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:45d5e886156860dc35862657e1494b9bae8dfa63bf56796f2fb56e1679fc0bca"}, - {file = "cffi-2.0.0-cp313-cp313-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:07b271772c100085dd28b74fa0cd81c8fb1a3ba18b21e03d7c27f3436a10606b"}, - {file = "cffi-2.0.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d48a880098c96020b02d5a1f7d9251308510ce8858940e6fa99ece33f610838b"}, - {file = "cffi-2.0.0-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:f93fd8e5c8c0a4aa1f424d6173f14a892044054871c771f8566e4008eaa359d2"}, - {file = "cffi-2.0.0-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:dd4f05f54a52fb558f1ba9f528228066954fee3ebe629fc1660d874d040ae5a3"}, - {file = "cffi-2.0.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:c8d3b5532fc71b7a77c09192b4a5a200ea992702734a2e9279a37f2478236f26"}, - {file = "cffi-2.0.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d9b29c1f0ae438d5ee9acb31cadee00a58c46cc9c0b2f9038c6b0b3470877a8c"}, - {file = "cffi-2.0.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6d50360be4546678fc1b79ffe7a66265e28667840010348dd69a314145807a1b"}, - {file = "cffi-2.0.0-cp313-cp313-win32.whl", hash = "sha256:74a03b9698e198d47562765773b4a8309919089150a0bb17d829ad7b44b60d27"}, - {file = "cffi-2.0.0-cp313-cp313-win_amd64.whl", hash = "sha256:19f705ada2530c1167abacb171925dd886168931e0a7b78f5bffcae5c6b5be75"}, - {file = "cffi-2.0.0-cp313-cp313-win_arm64.whl", hash = "sha256:256f80b80ca3853f90c21b23ee78cd008713787b1b1e93eae9f3d6a7134abd91"}, - {file = "cffi-2.0.0-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:fc33c5141b55ed366cfaad382df24fe7dcbc686de5be719b207bb248e3053dc5"}, - {file = "cffi-2.0.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:c654de545946e0db659b3400168c9ad31b5d29593291482c43e3564effbcee13"}, - {file = "cffi-2.0.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:24b6f81f1983e6df8db3adc38562c83f7d4a0c36162885ec7f7b77c7dcbec97b"}, - {file = "cffi-2.0.0-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:12873ca6cb9b0f0d3a0da705d6086fe911591737a59f28b7936bdfed27c0d47c"}, - {file = "cffi-2.0.0-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:d9b97165e8aed9272a6bb17c01e3cc5871a594a446ebedc996e2397a1c1ea8ef"}, - {file = "cffi-2.0.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:afb8db5439b81cf9c9d0c80404b60c3cc9c3add93e114dcae767f1477cb53775"}, - {file = "cffi-2.0.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:737fe7d37e1a1bffe70bd5754ea763a62a066dc5913ca57e957824b72a85e205"}, - {file = "cffi-2.0.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:38100abb9d1b1435bc4cc340bb4489635dc2f0da7456590877030c9b3d40b0c1"}, - {file = "cffi-2.0.0-cp314-cp314-win32.whl", hash = "sha256:087067fa8953339c723661eda6b54bc98c5625757ea62e95eb4898ad5e776e9f"}, - {file = "cffi-2.0.0-cp314-cp314-win_amd64.whl", hash = "sha256:203a48d1fb583fc7d78a4c6655692963b860a417c0528492a6bc21f1aaefab25"}, - {file = "cffi-2.0.0-cp314-cp314-win_arm64.whl", hash = "sha256:dbd5c7a25a7cb98f5ca55d258b103a2054f859a46ae11aaf23134f9cc0d356ad"}, - {file = "cffi-2.0.0-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:9a67fc9e8eb39039280526379fb3a70023d77caec1852002b4da7e8b270c4dd9"}, - {file = "cffi-2.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7a66c7204d8869299919db4d5069a82f1561581af12b11b3c9f48c584eb8743d"}, - {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:7cc09976e8b56f8cebd752f7113ad07752461f48a58cbba644139015ac24954c"}, - {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:92b68146a71df78564e4ef48af17551a5ddd142e5190cdf2c5624d0c3ff5b2e8"}, - {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:b1e74d11748e7e98e2f426ab176d4ed720a64412b6a15054378afdb71e0f37dc"}, - {file = "cffi-2.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:28a3a209b96630bca57cce802da70c266eb08c6e97e5afd61a75611ee6c64592"}, - {file = "cffi-2.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:7553fb2090d71822f02c629afe6042c299edf91ba1bf94951165613553984512"}, - {file = "cffi-2.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6c6c373cfc5c83a975506110d17457138c8c63016b563cc9ed6e056a82f13ce4"}, - {file = "cffi-2.0.0-cp314-cp314t-win32.whl", hash = "sha256:1fc9ea04857caf665289b7a75923f2c6ed559b8298a1b8c49e59f7dd95c8481e"}, - {file = "cffi-2.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:d68b6cef7827e8641e8ef16f4494edda8b36104d79773a334beaa1e3521430f6"}, - {file = "cffi-2.0.0-cp314-cp314t-win_arm64.whl", hash = "sha256:0a1527a803f0a659de1af2e1fd700213caba79377e27e4693648c2923da066f9"}, - {file = "cffi-2.0.0-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:fe562eb1a64e67dd297ccc4f5addea2501664954f2692b69a76449ec7913ecbf"}, - {file = "cffi-2.0.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:de8dad4425a6ca6e4e5e297b27b5c824ecc7581910bf9aee86cb6835e6812aa7"}, - {file = "cffi-2.0.0-cp39-cp39-manylinux1_i686.manylinux2014_i686.manylinux_2_17_i686.manylinux_2_5_i686.whl", hash = "sha256:4647afc2f90d1ddd33441e5b0e85b16b12ddec4fca55f0d9671fef036ecca27c"}, - {file = "cffi-2.0.0-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:3f4d46d8b35698056ec29bca21546e1551a205058ae1a181d871e278b0b28165"}, - {file = "cffi-2.0.0-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:e6e73b9e02893c764e7e8d5bb5ce277f1a009cd5243f8228f75f842bf937c534"}, - {file = "cffi-2.0.0-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:cb527a79772e5ef98fb1d700678fe031e353e765d1ca2d409c92263c6d43e09f"}, - {file = "cffi-2.0.0-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:61d028e90346df14fedc3d1e5441df818d095f3b87d286825dfcbd6459b7ef63"}, - {file = "cffi-2.0.0-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:0f6084a0ea23d05d20c3edcda20c3d006f9b6f3fefeac38f59262e10cef47ee2"}, - {file = "cffi-2.0.0-cp39-cp39-musllinux_1_2_i686.whl", hash = "sha256:1cd13c99ce269b3ed80b417dcd591415d3372bcac067009b6e0f59c7d4015e65"}, - {file = "cffi-2.0.0-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:89472c9762729b5ae1ad974b777416bfda4ac5642423fa93bd57a09204712322"}, - {file = "cffi-2.0.0-cp39-cp39-win32.whl", hash = "sha256:2081580ebb843f759b9f617314a24ed5738c51d2aee65d31e02f6f7a2b97707a"}, - {file = "cffi-2.0.0-cp39-cp39-win_amd64.whl", hash = "sha256:b882b3df248017dba09d6b16defe9b5c407fe32fc7c65a9c69798e6175601be9"}, - {file = "cffi-2.0.0.tar.gz", hash = "sha256:44d1b5909021139fe36001ae048dbdde8214afa20200eda0f64c068cac5d5529"}, -] -markers = {main = "extra == \"mcp\" and platform_python_implementation != \"PyPy\"", dev = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and sys_platform == \"linux\" and platform_python_implementation != \"PyPy\""} - -[package.dependencies] -pycparser = {version = "*", markers = "implementation_name != \"PyPy\""} - -[[package]] -name = "cfgv" -version = "3.5.0" -description = "Validate configuration and produce human readable error messages." -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "cfgv-3.5.0-py2.py3-none-any.whl", hash = "sha256:a8dc6b26ad22ff227d2634a65cb388215ce6cc96bbcc5cfde7641ae87e8dacc0"}, - {file = "cfgv-3.5.0.tar.gz", hash = "sha256:d5b1034354820651caa73ede66a6294d6e95c1b00acc5e9b098e917404669132"}, -] - -[[package]] -name = "charset-normalizer" -version = "3.4.6" -description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." -optional = false -python-versions = ">=3.7" -groups = ["main", "dev"] -files = [ - {file = "charset_normalizer-3.4.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:2e1d8ca8611099001949d1cdfaefc510cf0f212484fe7c565f735b68c78c3c95"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e25369dc110d58ddf29b949377a93e0716d72a24f62bad72b2b39f155949c1fd"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:259695e2ccc253feb2a016303543d691825e920917e31f894ca1a687982b1de4"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:dda86aba335c902b6149a02a55b38e96287157e609200811837678214ba2b1db"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:51fb3c322c81d20567019778cb5a4a6f2dc1c200b886bc0d636238e364848c89"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-manylinux_2_31_armv7l.whl", hash = "sha256:4482481cb0572180b6fd976a4d5c72a30263e98564da68b86ec91f0fe35e8565"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:39f5068d35621da2881271e5c3205125cc456f54e9030d3f723288c873a71bf9"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:8bea55c4eef25b0b19a0337dc4e3f9a15b00d569c77211fa8cde38684f234fb7"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-musllinux_1_2_armv7l.whl", hash = "sha256:f0cdaecd4c953bfae0b6bb64910aaaca5a424ad9c72d85cb88417bb9814f7550"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-musllinux_1_2_ppc64le.whl", hash = "sha256:150b8ce8e830eb7ccb029ec9ca36022f756986aaaa7956aad6d9ec90089338c0"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-musllinux_1_2_riscv64.whl", hash = "sha256:e68c14b04827dd76dcbd1aeea9e604e3e4b78322d8faf2f8132c7138efa340a8"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-musllinux_1_2_s390x.whl", hash = "sha256:3778fd7d7cd04ae8f54651f4a7a0bd6e39a0cf20f801720a4c21d80e9b7ad6b0"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:dad6e0f2e481fffdcf776d10ebee25e0ef89f16d691f1e5dee4b586375fdc64b"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-win32.whl", hash = "sha256:74a2e659c7ecbc73562e2a15e05039f1e22c75b7c7618b4b574a3ea9118d1557"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-win_amd64.whl", hash = "sha256:aa9cccf4a44b9b62d8ba8b4dd06c649ba683e4bf04eea606d2e94cfc2d6ff4d6"}, - {file = "charset_normalizer-3.4.6-cp310-cp310-win_arm64.whl", hash = "sha256:e985a16ff513596f217cee86c21371b8cd011c0f6f056d0920aa2d926c544058"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:82060f995ab5003a2d6e0f4ad29065b7672b6593c8c63559beefe5b443242c3e"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:60c74963d8350241a79cb8feea80e54d518f72c26db618862a8f53e5023deaf9"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f6e4333fb15c83f7d1482a76d45a0818897b3d33f00efd215528ff7c51b8e35d"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:bc72863f4d9aba2e8fd9085e63548a324ba706d2ea2c83b260da08a59b9482de"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9cc4fc6c196d6a8b76629a70ddfcd4635a6898756e2d9cac5565cf0654605d73"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-manylinux_2_31_armv7l.whl", hash = "sha256:0c173ce3a681f309f31b87125fecec7a5d1347261ea11ebbb856fa6006b23c8c"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c907cdc8109f6c619e6254212e794d6548373cc40e1ec75e6e3823d9135d29cc"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:404a1e552cf5b675a87f0651f8b79f5f1e6fd100ee88dc612f89aa16abd4486f"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_armv7l.whl", hash = "sha256:e3c701e954abf6fc03a49f7c579cc80c2c6cc52525340ca3186c41d3f33482ef"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_ppc64le.whl", hash = "sha256:7a6967aaf043bceabab5412ed6bd6bd26603dae84d5cb75bf8d9a74a4959d398"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_riscv64.whl", hash = "sha256:5feb91325bbceade6afab43eb3b508c63ee53579fe896c77137ded51c6b6958e"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_s390x.whl", hash = "sha256:f820f24b09e3e779fe84c3c456cb4108a7aa639b0d1f02c28046e11bfcd088ed"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:b35b200d6a71b9839a46b9b7fff66b6638bb52fc9658aa58796b0326595d3021"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-win32.whl", hash = "sha256:9ca4c0b502ab399ef89248a2c84c54954f77a070f28e546a85e91da627d1301e"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-win_amd64.whl", hash = "sha256:a9e68c9d88823b274cf1e72f28cb5dc89c990edf430b0bfd3e2fb0785bfeabf4"}, - {file = "charset_normalizer-3.4.6-cp311-cp311-win_arm64.whl", hash = "sha256:97d0235baafca5f2b09cf332cc275f021e694e8362c6bb9c96fc9a0eb74fc316"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:2ef7fedc7a6ecbe99969cd09632516738a97eeb8bd7258bf8a0f23114c057dab"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a4ea868bc28109052790eb2b52a9ab33f3aa7adc02f96673526ff47419490e21"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:836ab36280f21fc1a03c99cd05c6b7af70d2697e374c7af0b61ed271401a72a2"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:f1ce721c8a7dfec21fcbdfe04e8f68174183cf4e8188e0645e92aa23985c57ff"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0e28d62a8fc7a1fa411c43bd65e346f3bce9716dc51b897fbe930c5987b402d5"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-manylinux_2_31_armv7l.whl", hash = "sha256:530d548084c4a9f7a16ed4a294d459b4f229db50df689bfe92027452452943a0"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:30f445ae60aad5e1f8bdbb3108e39f6fbc09f4ea16c815c66578878325f8f15a"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:ac2393c73378fea4e52aa56285a3d64be50f1a12395afef9cce47772f60334c2"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_armv7l.whl", hash = "sha256:90ca27cd8da8118b18a52d5f547859cc1f8354a00cd1e8e5120df3e30d6279e5"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:8e5a94886bedca0f9b78fecd6afb6629142fd2605aa70a125d49f4edc6037ee6"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_riscv64.whl", hash = "sha256:695f5c2823691a25f17bc5d5ffe79fa90972cc34b002ac6c843bb8a1720e950d"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:231d4da14bcd9301310faf492051bee27df11f2bc7549bc0bb41fef11b82daa2"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:a056d1ad2633548ca18ffa2f85c202cfb48b68615129143915b8dc72a806a923"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-win32.whl", hash = "sha256:c2274ca724536f173122f36c98ce188fd24ce3dad886ec2b7af859518ce008a4"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-win_amd64.whl", hash = "sha256:c8ae56368f8cc97c7e40a7ee18e1cedaf8e780cd8bc5ed5ac8b81f238614facb"}, - {file = "charset_normalizer-3.4.6-cp312-cp312-win_arm64.whl", hash = "sha256:899d28f422116b08be5118ef350c292b36fc15ec2daeb9ea987c89281c7bb5c4"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:11afb56037cbc4b1555a34dd69151e8e069bee82e613a73bef6e714ce733585f"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:423fb7e748a08f854a08a222b983f4df1912b1daedce51a72bd24fe8f26a1843"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:d73beaac5e90173ac3deb9928a74763a6d230f494e4bfb422c217a0ad8e629bf"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:d60377dce4511655582e300dc1e5a5f24ba0cb229005a1d5c8d0cb72bb758ab8"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:530e8cebeea0d76bdcf93357aa5e41336f48c3dc709ac52da2bb167c5b8271d9"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-manylinux_2_31_armv7l.whl", hash = "sha256:a26611d9987b230566f24a0a125f17fe0de6a6aff9f25c9f564aaa2721a5fb88"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:34315ff4fc374b285ad7f4a0bf7dcbfe769e1b104230d40f49f700d4ab6bbd84"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5f8ddd609f9e1af8c7bd6e2aca279c931aefecd148a14402d4e368f3171769fd"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_armv7l.whl", hash = "sha256:80d0a5615143c0b3225e5e3ef22c8d5d51f3f72ce0ea6fb84c943546c7b25b6c"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:92734d4d8d187a354a556626c221cd1a892a4e0802ccb2af432a1d85ec012194"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_riscv64.whl", hash = "sha256:613f19aa6e082cf96e17e3ffd89383343d0d589abda756b7764cf78361fd41dc"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:2b1a63e8224e401cafe7739f77efd3f9e7f5f2026bda4aead8e59afab537784f"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6cceb5473417d28edd20c6c984ab6fee6c6267d38d906823ebfe20b03d607dc2"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-win32.whl", hash = "sha256:d7de2637729c67d67cf87614b566626057e95c303bc0a55ffe391f5205e7003d"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-win_amd64.whl", hash = "sha256:572d7c822caf521f0525ba1bce1a622a0b85cf47ffbdae6c9c19e3b5ac3c4389"}, - {file = "charset_normalizer-3.4.6-cp313-cp313-win_arm64.whl", hash = "sha256:a4474d924a47185a06411e0064b803c68be044be2d60e50e8bddcc2649957c1f"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:9cc6e6d9e571d2f863fa77700701dae73ed5f78881efc8b3f9a4398772ff53e8"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ef5960d965e67165d75b7c7ffc60a83ec5abfc5c11b764ec13ea54fbef8b4421"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b3694e3f87f8ac7ce279d4355645b3c878d24d1424581b46282f24b92f5a4ae2"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5d11595abf8dd942a77883a39d81433739b287b6aa71620f15164f8096221b30"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:7bda6eebafd42133efdca535b04ccb338ab29467b3f7bf79569883676fc628db"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-manylinux_2_31_armv7l.whl", hash = "sha256:bbc8c8650c6e51041ad1be191742b8b421d05bbd3410f43fa2a00c8db87678e8"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:22c6f0c2fbc31e76c3b8a86fba1a56eda6166e238c29cdd3d14befdb4a4e4815"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7edbed096e4a4798710ed6bc75dcaa2a21b68b6c356553ac4823c3658d53743a"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:7f9019c9cb613f084481bd6a100b12e1547cf2efe362d873c2e31e4035a6fa43"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:58c948d0d086229efc484fe2f30c2d382c86720f55cd9bc33591774348ad44e0"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:419a9d91bd238052642a51938af8ac05da5b3343becde08d5cdeab9046df9ee1"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:5273b9f0b5835ff0350c0828faea623c68bfa65b792720c453e22b25cc72930f"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:0e901eb1049fdb80f5bd11ed5ea1e498ec423102f7a9b9e4645d5b8204ff2815"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-win32.whl", hash = "sha256:b4ff1d35e8c5bd078be89349b6f3a845128e685e751b6ea1169cf2160b344c4d"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-win_amd64.whl", hash = "sha256:74119174722c4349af9708993118581686f343adc1c8c9c007d59be90d077f3f"}, - {file = "charset_normalizer-3.4.6-cp314-cp314-win_arm64.whl", hash = "sha256:e5bcc1a1ae744e0bb59641171ae53743760130600da8db48cbb6e4918e186e4e"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:ad8faf8df23f0378c6d527d8b0b15ea4a2e23c89376877c598c4870d1b2c7866"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f5ea69428fa1b49573eef0cc44a1d43bebd45ad0c611eb7d7eac760c7ae771bc"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:06a7e86163334edfc5d20fe104db92fcd666e5a5df0977cb5680a506fe26cc8e"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e1f6e2f00a6b8edb562826e4632e26d063ac10307e80f7461f7de3ad8ef3f077"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:95b52c68d64c1878818687a473a10547b3292e82b6f6fe483808fb1468e2f52f"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:7504e9b7dc05f99a9bbb4525c67a2c155073b44d720470a148b34166a69c054e"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:172985e4ff804a7ad08eebec0a1640ece87ba5041d565fff23c8f99c1f389484"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:4be9f4830ba8741527693848403e2c457c16e499100963ec711b1c6f2049b7c7"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:79090741d842f564b1b2827c0b82d846405b744d31e84f18d7a7b41c20e473ff"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:87725cfb1a4f1f8c2fc9890ae2f42094120f4b44db9360be5d99a4c6b0e03a9e"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:fcce033e4021347d80ed9c66dcf1e7b1546319834b74445f561d2e2221de5659"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:ca0276464d148c72defa8bb4390cce01b4a0e425f3b50d1435aa6d7a18107602"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:197c1a244a274bb016dd8b79204850144ef77fe81c5b797dc389327adb552407"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-win32.whl", hash = "sha256:2a24157fa36980478dd1770b585c0f30d19e18f4fb0c47c13aa568f871718579"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-win_amd64.whl", hash = "sha256:cd5e2801c89992ed8c0a3f0293ae83c159a60d9a5d685005383ef4caca77f2c4"}, - {file = "charset_normalizer-3.4.6-cp314-cp314t-win_arm64.whl", hash = "sha256:47955475ac79cc504ef2704b192364e51d0d473ad452caedd0002605f780101c"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:659a1e1b500fac8f2779dd9e1570464e012f43e580371470b45277a27baa7532"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f61aa92e4aad0be58eb6eb4e0c21acf32cf8065f4b2cae5665da756c4ceef982"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:f50498891691e0864dc3da965f340fada0771f6142a378083dc4608f4ea513e2"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:bf625105bb9eef28a56a943fec8c8a98aeb80e7d7db99bd3c388137e6eb2d237"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2bd9d128ef93637a5d7a6af25363cf5dec3fa21cf80e68055aad627f280e8afa"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-manylinux_2_31_armv7l.whl", hash = "sha256:d08ec48f0a1c48d75d0356cea971921848fb620fdeba805b28f937e90691209f"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:1ed80ff870ca6de33f4d953fda4d55654b9a2b340ff39ab32fa3adbcd718f264"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-musllinux_1_2_aarch64.whl", hash = "sha256:f98059e4fcd3e3e4e2d632b7cf81c2faae96c43c60b569e9c621468082f1d104"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-musllinux_1_2_armv7l.whl", hash = "sha256:ab30e5e3e706e3063bc6de96b118688cb10396b70bb9864a430f67df98c61ecc"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-musllinux_1_2_ppc64le.whl", hash = "sha256:d5f5d1e9def3405f60e3ca8232d56f35c98fb7bf581efcc60051ebf53cb8b611"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-musllinux_1_2_riscv64.whl", hash = "sha256:461598cd852bfa5a61b09cae2b1c02e2efcd166ee5516e243d540ac24bfa68a7"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-musllinux_1_2_s390x.whl", hash = "sha256:71be7e0e01753a89cf024abf7ecb6bca2c81738ead80d43004d9b5e3f1244e64"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:df01808ee470038c3f8dc4f48620df7225c49c2d6639e38f96e6d6ac6e6f7b0e"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-win32.whl", hash = "sha256:69dd852c2f0ad631b8b60cfbe25a28c0058a894de5abb566619c205ce0550eae"}, - {file = "charset_normalizer-3.4.6-cp38-cp38-win_amd64.whl", hash = "sha256:517ad0e93394ac532745129ceabdf2696b609ec9f87863d337140317ebce1c14"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:31215157227939b4fb3d740cd23fe27be0439afef67b785a1eb78a3ae69cba9e"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ecbbd45615a6885fe3240eb9db73b9e62518b611850fdf8ab08bd56de7ad2b17"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:c45a03a4c69820a399f1dda9e1d8fbf3562eda46e7720458180302021b08f778"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:e8aeb10fcbe92767f0fa69ad5a72deca50d0dca07fbde97848997d778a50c9fe"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:54fae94be3d75f3e573c9a1b5402dc593de19377013c9a0e4285e3d402dd3a2a"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-manylinux_2_31_armv7l.whl", hash = "sha256:2f7fdd9b6e6c529d6a2501a2d36b240109e78a8ceaef5687cfcfa2bbe671d297"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:4d1d02209e06550bdaef34af58e041ad71b88e624f5d825519da3a3308e22687"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:8bc5f0687d796c05b1e28ab0d38a50e6309906ee09375dd3aff6a9c09dd6e8f4"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-musllinux_1_2_armv7l.whl", hash = "sha256:ee4ec14bc1680d6b0afab9aea2ef27e26d2024f18b24a2d7155a52b60da7e833"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-musllinux_1_2_ppc64le.whl", hash = "sha256:d1a2ee9c1499fc8f86f4521f27a973c914b211ffa87322f4ee33bb35392da2c5"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-musllinux_1_2_riscv64.whl", hash = "sha256:48696db7f18afb80a068821504296eb0787d9ce239b91ca15059d1d3eaacf13b"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-musllinux_1_2_s390x.whl", hash = "sha256:4f41da960b196ea355357285ad1316a00099f22d0929fe168343b99b254729c9"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:802168e03fba8bbc5ce0d866d589e4b1ca751d06edee69f7f3a19c5a9fe6b597"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-win32.whl", hash = "sha256:8761ac29b6c81574724322a554605608a9960769ea83d2c73e396f3df896ad54"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-win_amd64.whl", hash = "sha256:1cf0a70018692f85172348fe06d3a4b63f94ecb055e13a00c644d368eb82e5b8"}, - {file = "charset_normalizer-3.4.6-cp39-cp39-win_arm64.whl", hash = "sha256:3516bbb8d42169de9e61b8520cbeeeb716f12f4ecfe3fd30a9919aa16c806ca8"}, - {file = "charset_normalizer-3.4.6-py3-none-any.whl", hash = "sha256:947cf925bc916d90adba35a64c82aace04fa39b46b52d4630ece166655905a69"}, - {file = "charset_normalizer-3.4.6.tar.gz", hash = "sha256:1ae6b62897110aa7c79ea2f5dd38d1abca6db663687c0b1ad9aed6f6bae3d9d6"}, -] - -[[package]] -name = "click" -version = "8.5.0" -description = "Composable command line interface toolkit" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "click-8.5.0-py3-none-any.whl", hash = "sha256:255bc9599cf7748b4b1a446ccc735421bd08a2ae529a8b88597d3de5664ee360"}, - {file = "click-8.5.0.tar.gz", hash = "sha256:ba0d2089de75ea0310e2dde03160e6ca10009947fb95a182f9b54021bb272e34"}, -] - -[[package]] -name = "colorama" -version = "0.4.6" -description = "Cross-platform colored terminal text." -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -groups = ["dev"] -markers = "sys_platform == \"win32\"" -files = [ - {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, - {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, -] - -[[package]] -name = "cryptography" -version = "50.0.0" -description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers." -optional = false -python-versions = "!=3.9.0,!=3.9.1,>=3.9" -groups = ["main", "dev"] -files = [ - {file = "cryptography-50.0.0-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:031e2d5dd4bb9caa3ca9c82e5a197fd8ae680232cee62603d1a813f3f07e3d03"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:fd9192b7b70c573d7f214eb1ae35e00d359f6f5e4b27c7e21e30de1fc6204645"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:06a32a980526a6ab9a4b9bf8f7385800791e2bb960903cb6b530e4817509a3b7"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:a1b30560f2acc95aa8b2e06e716a13dbfc97314747b80d9707e307f77b40d6b3"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:8d89f3976b10b4ce31118de72329025f70d2c6ead14a8217c5514dd2c6d5a78f"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:b42a28c1844fd9de8f3f7d540e36b66f3a9c83fceac7170ebc7a6a19edd9dcae"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:900131fafd8aead39ac7dd3a7e833be754c17a95cfd91221636949fe4eb0aa8a"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:07949c449a1abcf60d1ee6e88956d89404c7df3c8258f46589e912988e551987"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:f89831ef99dd7dd169ab06d63a831adb9e20a87aac6d380266bbda5823349169"}, - {file = "cryptography-50.0.0-cp311-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:82148ec5bddac30b51a5b3c1945075f896fa022cb93f8e4a01e9f6ee95292c5f"}, - {file = "cryptography-50.0.0-cp311-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1489e263a8048bb8b6a8bac662eb2d402ea5d2b7b4699b72f385f1e2772db105"}, - {file = "cryptography-50.0.0-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:7cec5b856506da6defb290f30c9ee687d5f5e8cb0bd3f6459dde43b0b4fa40ef"}, - {file = "cryptography-50.0.0-cp311-abi3-win_amd64.whl", hash = "sha256:bd1c592e4d5974f0d08d4888e432157adba757c66da0246918e43677fafa2d30"}, - {file = "cryptography-50.0.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:49e7d93abdbd2990caced757e5fade25302f719c3c8fb6e6fff2dde98999fc41"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:19736989797678c6af1e55cd49055cdbcb55d8f6b5583ac5335f933aba9101dc"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:80b63928fa35083b33966ce1efb70e5b9607181e49dcd1c22c8c005e319f667f"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:d58c3db7cd6eed54e6c06744db55456b65ebd7492ddeae9c1e93cfca7aa857d3"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_28_ppc64le.whl", hash = "sha256:df2a58a472f332225671c35b0a830208b86d004f82baa8530fa3782c85646533"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_28_x86_64.whl", hash = "sha256:11b74db56cdbe3cdee6e3f6982ecb70334fa10dce99ed58bf7894aaaa3b2a037"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_31_armv7l.whl", hash = "sha256:f59e38625469987d7ef6d495323c55e7db6c212eaf6112267e0d3b565a2e9c9f"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:ecfed7367f965a0328cfbdd70da860f15441f002f613185668c6e6ebf5a0ac11"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_34_ppc64le.whl", hash = "sha256:9aa87839c383bdbab6ef865787a1fb877af8dd03464c4400322726feaaadfc6d"}, - {file = "cryptography-50.0.0-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:6ba6a53445bd3cfa809ef3ef5f1589aa6ba08784a1d962bf47d0940e871dab1c"}, - {file = "cryptography-50.0.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:3f5735ffe4996d28b809371756219f5354864902a3b9e7c0b9ee87041209fc9c"}, - {file = "cryptography-50.0.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:1b4a266766514614f8aa60416e71f2fc6e575d36e7bdc90f644fadb2f4b75b95"}, - {file = "cryptography-50.0.0-cp314-cp314t-win_amd64.whl", hash = "sha256:12b9c6996425c76ea6c457ace4f3073e715b8c545add07cd1a8f3a4f90691269"}, - {file = "cryptography-50.0.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:ccdc4a71a4dabae05de219404f9f4abc38e3b58422177ff93d0da05967dafa07"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:910e1d2668e7de9648f2bcee30e180db2a6b15c30f887d7c4c93ddf96e3992e3"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:a91296cb61e8df6f86d0c19cc4068228da256bf59bf86049fbd821084565327f"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:e722f16708d854fe924790e051061f6704a472c3bac347b6fd88033ea8dd0dc5"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_28_ppc64le.whl", hash = "sha256:d764dcf130c428ef66786f866dd750f53182bc608813489915e9fc106bb0c82f"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:105110f43a471dbd0060b9c9516cb8a6a79233631a04cc2ba16f28323ac6e025"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_31_armv7l.whl", hash = "sha256:828743d939e9629bc267b8e2d08d8bb67cd4319c771a33d4b18b22dd8fb7440a"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:2a8183b489dc1f7f80f135780fadc1108f14b31b8a40411c7a5b17425f65f28b"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_34_ppc64le.whl", hash = "sha256:6e7d61120573a7f2cd94cc095f9e81f6967c61ccdf194285aa143ecec8e0b708"}, - {file = "cryptography-50.0.0-cp39-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:37fdb0d0111f1e2ff07139dfb79f1b49531f8e213c46f1163dd7642979b58c47"}, - {file = "cryptography-50.0.0-cp39-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:c87f62a3d3b9888ed0fdde100ec06aa61ca9cd44bad9057d1dff9a516b5f5bb9"}, - {file = "cryptography-50.0.0-cp39-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:65c2c3add92b45fd0709db8594536aea39c2a67af0e27ffcf049c498501140b7"}, - {file = "cryptography-50.0.0-cp39-abi3-win_amd64.whl", hash = "sha256:d24fead1d4d076e1bfb006dcec392074a3cd8d7b4fc8a595aa64073b2b7a96ba"}, - {file = "cryptography-50.0.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:5e34edd123674534acd70147f0ca331eaa2c74e6325fb2028c886aa26ba0b68c"}, - {file = "cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:8eb5e1172eb569ea8a872796576e6a67c276351728b6455d5beb01242b027c6a"}, - {file = "cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:910d11e1a385c654bf738bf3e6b8e6ed5de0f5610fcae2be9e5b398d8081d20e"}, - {file = "cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_34_aarch64.whl", hash = "sha256:62598a8a57f815db4c6259a4e97d857dab56697e7de8e8ab02352ab74da1995d"}, - {file = "cryptography-50.0.0-pp311-pypy311_pp73-manylinux_2_34_x86_64.whl", hash = "sha256:07479a1cb08219ab719147e742e76090c9c773321959bb94946fffdd397a6437"}, - {file = "cryptography-50.0.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:c99c003e088647b8a5b7c145d6f78c335f6348332b62e142d411c4b63d1460b9"}, - {file = "cryptography-50.0.0.tar.gz", hash = "sha256:eeac2acb5a20ed25e0ad6d1df9891a520b78b404266b6d11778f25d5d691a6c9"}, -] -markers = {main = "extra == \"mcp\"", dev = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and sys_platform == \"linux\""} - -[package.dependencies] -cffi = {version = ">=2.0.0", markers = "platform_python_implementation != \"PyPy\""} -typing-extensions = {version = ">=4.13.2", markers = "python_full_version < \"3.11.0\""} - -[package.extras] -ssh = ["bcrypt (>=3.1.5)"] - -[[package]] -name = "cyclopts" -version = "4.10.1" -description = "Intuitive, easy CLIs based on type hints." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "cyclopts-4.10.1-py3-none-any.whl", hash = "sha256:35f37257139380a386d9fe4475e1e7c87ca7795765ef4f31abba579fcfcb6ecd"}, - {file = "cyclopts-4.10.1.tar.gz", hash = "sha256:ad4e4bb90576412d32276b14a76f55d43353753d16217f2c3cd5bdceba7f15a0"}, -] - -[package.dependencies] -attrs = ">=23.1.0" -docstring-parser = ">=0.15,<4.0" -rich = ">=13.6.0" -rich-rst = ">=1.3.1,<2.0.0" -tomli = {version = ">=2.0.0", markers = "python_version < \"3.11\""} -typing-extensions = {version = ">=4.8.0", markers = "python_version < \"3.11\""} - -[package.extras] -debug = ["ipdb (>=0.13.9)", "line-profiler (>=3.5.1)"] -dev = ["coverage[toml] (>=5.1)", "mkdocs (>=1.4.0)", "pre-commit (>=2.16.0)", "pydantic (>=2.11.2,<3.0.0)", "pytest (>=8.2.0)", "pytest-cov (>=3.0.0)", "pytest-mock (>=3.7.0)", "pyyaml (>=6.0.1)", "syrupy (>=4.0.0)", "toml (>=0.10.2,<1.0.0)", "trio (>=0.10.0)"] -docs = ["gitpython (>=3.1.31)", "myst-parser[linkify] (>=3.0.1,<5.0.0)", "sphinx (>=7.4.7,<8.2.0)", "sphinx-autodoc-typehints (>=1.25.2,<4.0.0)", "sphinx-copybutton (>=0.5,<1.0)", "sphinx-rtd-dark-mode (>=1.3.0,<2.0.0)", "sphinx-rtd-theme (>=3.0.0,<4.0.0)"] -mkdocs = ["markdown (>=3.3)", "mkdocs (>=1.4.0)", "pymdown-extensions (>=10.0)"] -toml = ["tomli (>=2.0.0) ; python_version < \"3.11\""] -trio = ["trio (>=0.10.0)"] -yaml = ["pyyaml (>=6.0.1)"] - -[[package]] -name = "distlib" -version = "0.4.3" -description = "Distribution utilities" -optional = false -python-versions = "*" -groups = ["dev"] -files = [ - {file = "distlib-0.4.3-py2.py3-none-any.whl", hash = "sha256:4b0ce306c966eb73bc3a7b6abad017c556dadd92c44701562cd528ac7fde4d5b"}, - {file = "distlib-0.4.3.tar.gz", hash = "sha256:f152097224a0ae24be5a0f6bae1b9359af82133bce63f98a95f86cae1aede9ed"}, -] - -[[package]] -name = "dnspython" -version = "2.8.0" -description = "DNS toolkit" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "python_version < \"3.14\" and extra == \"mcp\"" -files = [ - {file = "dnspython-2.8.0-py3-none-any.whl", hash = "sha256:01d9bbc4a2d76bf0db7c1f729812ded6d912bd318d3b1cf81d30c0f845dbf3af"}, - {file = "dnspython-2.8.0.tar.gz", hash = "sha256:181d3c6996452cb1189c4046c61599b84a5a86e099562ffde77d26984ff26d0f"}, -] - -[package.extras] -dev = ["black (>=25.1.0)", "coverage (>=7.0)", "flake8 (>=7)", "hypercorn (>=0.17.0)", "mypy (>=1.17)", "pylint (>=3)", "pytest (>=8.4)", "pytest-cov (>=6.2.0)", "quart-trio (>=0.12.0)", "sphinx (>=8.2.0)", "sphinx-rtd-theme (>=3.0.0)", "twine (>=6.1.0)", "wheel (>=0.45.0)"] -dnssec = ["cryptography (>=45)"] -doh = ["h2 (>=4.2.0)", "httpcore (>=1.0.0)", "httpx (>=0.28.0)"] -doq = ["aioquic (>=1.2.0)"] -idna = ["idna (>=3.10)"] -trio = ["trio (>=0.30)"] -wmi = ["wmi (>=1.5.1) ; platform_system == \"Windows\""] - -[[package]] -name = "dnspython" -version = "2.9.1" -description = "DNS toolkit" -optional = true -python-versions = ">=3.11" -groups = ["main"] -markers = "python_version >= \"3.14\" and extra == \"mcp\"" -files = [ - {file = "dnspython-2.9.1-py3-none-any.whl", hash = "sha256:7c81caf8de1ed57b8cfc7e0ad4f528a0b8ceace473c7eb946df195dc9def751f"}, - {file = "dnspython-2.9.1.tar.gz", hash = "sha256:9a6d30e55f8dc63e6052597666112bff0586b95a2474a9deda03afbbf820d37a"}, -] - -[package.extras] -dev = ["black (>=26.5)", "coverage (>=7.15)", "hypercorn (>=0.18.0)", "pyright (>=1.1.411)", "pytest (>=9.1)", "pytest-cov (>=7.1)", "quart-trio (>=0.12.0)", "ruff (>=0.16.0)", "sphinx (>=9.1.0) ; python_full_version >= \"3.12.0\"", "sphinx-rtd-theme (>=3.1.0) ; python_full_version >= \"3.12.0\"", "trustme (>=1.2.1)", "ty (>=0.0.85)"] -dnssec = ["cryptography (>=50)"] -doh = ["h2 (>=4.4)", "httpcore2 (>=2.13)", "httpx2 (>=2.13)"] -doq = ["aioquic (>=1.3.0)"] -idna = ["idna (>=3.20)"] -trio = ["trio (>=0.34)"] -wmi = ["wmi (>=1.5.1) ; sys_platform == \"win32\""] - -[[package]] -name = "docstring-parser" -version = "0.17.0" -description = "Parse Python docstrings in reST, Google and Numpydoc format" -optional = true -python-versions = ">=3.8" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "docstring_parser-0.17.0-py3-none-any.whl", hash = "sha256:cf2569abd23dce8099b300f9b4fa8191e9582dda731fd533daf54c4551658708"}, - {file = "docstring_parser-0.17.0.tar.gz", hash = "sha256:583de4a309722b3315439bb31d64ba3eebada841f2e2cee23b99df001434c912"}, -] - -[package.extras] -dev = ["pre-commit (>=2.16.0) ; python_version >= \"3.9\"", "pydoctor (>=25.4.0)", "pytest"] -docs = ["pydoctor (>=25.4.0)"] -test = ["pytest"] - -[[package]] -name = "docutils" -version = "0.22.4" -description = "Docutils -- Python Documentation Utilities" -optional = false -python-versions = ">=3.9" -groups = ["main", "dev"] -files = [ - {file = "docutils-0.22.4-py3-none-any.whl", hash = "sha256:d0013f540772d1420576855455d050a2180186c91c15779301ac2ccb3eeb68de"}, - {file = "docutils-0.22.4.tar.gz", hash = "sha256:4db53b1fde9abecbb74d91230d32ab626d94f6badfc575d6db9194a49df29968"}, -] -markers = {main = "extra == \"mcp\""} - -[[package]] -name = "email-validator" -version = "2.3.0" -description = "A robust email address syntax and deliverability validation library." -optional = true -python-versions = ">=3.8" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "email_validator-2.3.0-py3-none-any.whl", hash = "sha256:80f13f623413e6b197ae73bb10bf4eb0908faf509ad8362c5edeb0be7fd450b4"}, - {file = "email_validator-2.3.0.tar.gz", hash = "sha256:9fc05c37f2f6cf439ff414f8fc46d917929974a82244c20eb10231ba60c54426"}, -] - -[package.dependencies] -dnspython = ">=2.0.0" -idna = ">=2.0.0" - -[[package]] -name = "exceptiongroup" -version = "1.3.1" -description = "Backport of PEP 654 (exception groups)" -optional = true -python-versions = ">=3.7" -groups = ["main", "dev"] -files = [ - {file = "exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598"}, - {file = "exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219"}, -] -markers = {main = "extra == \"mcp\"", dev = "python_version == \"3.10\""} - -[package.dependencies] -typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} - -[package.extras] -test = ["pytest (>=6)"] - -[[package]] -name = "fastmcp" -version = "4.1.6" -description = "The fast, Pythonic way to build MCP servers and clients." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "fastmcp-4.1.6-py3-none-any.whl", hash = "sha256:f54367fdca3d1a37c53164ebf864fb2461acdd92a9d9df731a244078c0332926"}, - {file = "fastmcp-4.1.6.tar.gz", hash = "sha256:5e307ae4ac3048a1b586aac6fc31e08661141bb69b8a2b473070e5becae0176c"}, -] - -[package.dependencies] -fastmcp-slim = {version = "4.1.6", extras = ["client", "server"]} - -[package.extras] -anthropic = ["fastmcp-slim[anthropic] (==4.1.6)"] -apps = ["fastmcp-slim[apps] (==4.1.6)"] -azure = ["fastmcp-slim[azure] (==4.1.6)"] -code-mode = ["fastmcp-slim[code-mode] (==4.1.6)"] -gemini = ["fastmcp-slim[gemini] (==4.1.6)"] -jev = ["fastmcp-slim[jev] (==4.1.6)"] -openai = ["fastmcp-slim[openai] (==4.1.6)"] -tasks = ["fastmcp-tasks (==4.1.6)"] - -[[package]] -name = "fastmcp-slim" -version = "4.1.6" -description = "The dependency-slim FastMCP package." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "fastmcp_slim-4.1.6-py3-none-any.whl", hash = "sha256:d25691ae70a7f2b9d8197d6261bdd0f4b9ff33064087cd35c20539b0b48bb1ca"}, - {file = "fastmcp_slim-4.1.6.tar.gz", hash = "sha256:cd181b9b780161bbfdfc16ca6e417aaa8efd75d0a9ae961fdd20fa992d3d789f"}, -] - -[package.dependencies] -authlib = {version = ">=1.6.11", optional = true, markers = "extra == \"client\" or extra == \"server\""} -beartype = {version = ">=0.23.0rc2", optional = true, markers = "python_version >= \"3.15\" and (extra == \"client\" or extra == \"server\")"} -certifi = {version = ">=2026.10.19", optional = true, markers = "extra == \"server\""} -cyclopts = {version = ">=4.0.0", optional = true, markers = "extra == \"server\""} -exceptiongroup = {version = ">=1.2.2", optional = true, markers = "extra == \"client\" or extra == \"server\""} -griffelib = {version = ">=2.0.0", optional = true, markers = "extra == \"server\""} -httpx2 = {version = ">=2.5.0", optional = true, markers = "extra == \"client\" or extra == \"server\""} -joserfc = {version = ">=1.5.0", optional = true, markers = "extra == \"server\""} -jsonref = {version = ">=1.1.0", optional = true, markers = "extra == \"server\""} -jsonschema-path = {version = ">=0.3.4", optional = true, markers = "extra == \"server\""} -mcp = {version = ">=2.3.0,<3.0.0", optional = true, markers = "extra == \"client\" or extra == \"server\""} -mcp-types = ">=2.0.0,<3.0.0" -openapi-pydantic = {version = ">=0.6.0", optional = true, markers = "extra == \"server\""} -opentelemetry-api = {version = ">=1.28.0", optional = true, markers = "extra == \"client\" or extra == \"server\""} -packaging = {version = ">=24.0", optional = true, markers = "extra == \"server\""} -platformdirs = ">=4.0.0" -py-key-value-aio = {version = ">=0.4.4,<0.5.0", extras = ["filetree", "memory"], optional = true, markers = "extra == \"client\" or extra == \"server\""} -pydantic = {version = ">=2.12.0", extras = ["email"]} -pydantic-settings = ">=2.0.0" -pyperclip = {version = ">=1.9.0", optional = true, markers = "extra == \"server\""} -python-dotenv = ">=1.1.0" -python-multipart = {version = ">=0.0.26", optional = true, markers = "extra == \"server\""} -pyyaml = {version = ">=6.0,<7.0", optional = true, markers = "extra == \"server\""} -rich = ">=13.9.4" -starlette = {version = ">=1.0.1", optional = true, markers = "extra == \"client\" or extra == \"server\""} -typing-extensions = ">=4.0.0" -uncalled-for = {version = ">=0.4.0", optional = true, markers = "extra == \"server\""} -uvicorn = {version = ">=0.35", optional = true, markers = "extra == \"server\""} -watchfiles = {version = ">=1.0.0", optional = true, markers = "extra == \"server\""} -websockets = {version = ">=15.0.1", optional = true, markers = "extra == \"server\""} - -[package.extras] -anthropic = ["anthropic (>=0.48.0,<2)", "certifi (>=2026.10.19)"] -apps = ["prefab-ui (>=0.18.0)"] -azure = ["azure-identity (>=1.16.0)", "certifi (>=2026.10.19)", "pyjwt (>=2.12.0)"] -client = ["authlib (>=1.6.11)", "beartype (>=0.23.0rc2) ; python_version >= \"3.15\"", "exceptiongroup (>=1.2.2)", "httpx2 (>=2.5.0)", "mcp (>=2.3.0,<3.0.0)", "opentelemetry-api (>=1.28.0)", "py-key-value-aio[filetree,memory] (>=0.4.4,<0.5.0)", "starlette (>=1.0.1)"] -code-mode = ["pydantic-monty (>=1.1,<2)"] -gemini = ["certifi (>=2026.10.19)", "google-genai (>=1.18.0)", "jsonref (>=1.1.0)"] -jev = ["typesafe-sdk (>=0.5.7)"] -mcp = ["exceptiongroup (>=1.2.2)", "httpx2 (>=2.5.0)", "mcp (>=2.3.0,<3.0.0)", "opentelemetry-api (>=1.28.0)", "starlette (>=1.0.1)"] -openai = ["certifi (>=2026.10.19)", "openai (>=1.102.0)"] -server = ["authlib (>=1.6.11)", "beartype (>=0.23.0rc2) ; python_version >= \"3.15\"", "certifi (>=2026.10.19)", "cyclopts (>=4.0.0)", "exceptiongroup (>=1.2.2)", "griffelib (>=2.0.0)", "httpx2 (>=2.5.0)", "joserfc (>=1.5.0)", "jsonref (>=1.1.0)", "jsonschema-path (>=0.3.4)", "mcp (>=2.3.0,<3.0.0)", "openapi-pydantic (>=0.6.0)", "opentelemetry-api (>=1.28.0)", "packaging (>=24.0)", "py-key-value-aio[filetree,memory] (>=0.4.4,<0.5.0)", "pyperclip (>=1.9.0)", "python-multipart (>=0.0.26)", "pyyaml (>=6.0,<7.0)", "starlette (>=1.0.1)", "uncalled-for (>=0.4.0)", "uvicorn (>=0.35)", "watchfiles (>=1.0.0)", "websockets (>=15.0.1)"] - -[[package]] -name = "filelock" -version = "3.32.0" -description = "A platform independent file lock." -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "filelock-3.32.0-py3-none-any.whl", hash = "sha256:d396bea984af47333ef05e50eae7eff88c84256de6112aea0ec48a233c064fe3"}, - {file = "filelock-3.32.0.tar.gz", hash = "sha256:7be2ad23a14607ccc71808e68fe30848aeace7058ace17852f68e2a68e310402"}, -] - -[[package]] -name = "griffelib" -version = "2.2.0" -description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "griffelib-2.2.0-py3-none-any.whl", hash = "sha256:d71c3bc2bbed9f958488634fe788b843a9f705d6d2838ca32cd6c25eeb64dfc4"}, - {file = "griffelib-2.2.0.tar.gz", hash = "sha256:e1bc36fe9cd21d4b6b659b456346755e4cfdc5676c0a5214083126ee12612b3c"}, -] - -[package.extras] -pypi = ["pip (>=24.0)", "platformdirs (>=4.2)", "wheel (>=0.42)"] - -[[package]] -name = "h11" -version = "0.16.0" -description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1" -optional = true -python-versions = ">=3.8" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "h11-0.16.0-py3-none-any.whl", hash = "sha256:63cf8bbe7522de3bf65932fda1d9c2772064ffb3dae62d55932da54b31cb6c86"}, - {file = "h11-0.16.0.tar.gz", hash = "sha256:4e35b956cf45792e4caa5885e69fba00bdbc6ffafbfa020300e549b208ee5ff1"}, -] - -[[package]] -name = "httpcore2" -version = "2.12.0" -description = "A minimal low-level HTTP client." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\" and sys_platform != \"emscripten\"" -files = [ - {file = "httpcore2-2.12.0-py3-none-any.whl", hash = "sha256:7e04258ce01013d7d615e5b910a3b27fac937d7a95038227e79652b4ba3b4ceb"}, - {file = "httpcore2-2.12.0.tar.gz", hash = "sha256:9293522bba0aa7c4c8e9e3f040c16575bd8868e155a77fa30c7a9085a5eae648"}, -] - -[package.dependencies] -h11 = ">=0.16" -truststore = ">=0.10" - -[package.extras] -asyncio = ["anyio (>=4.5.0,<5.0)"] -http2 = ["h2 (>=3,<5)"] -socks = ["socksio (==1.*)"] -trio = ["trio (>=0.33.0,<1.0)"] - -[[package]] -name = "httpx2" -version = "2.12.0" -description = "The next generation HTTP client." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "httpx2-2.12.0-py3-none-any.whl", hash = "sha256:cc8b6eecb8661c146b8f89a60e97456ee086e91a784ed31ac450c3a9e613dd36"}, - {file = "httpx2-2.12.0.tar.gz", hash = "sha256:7631fe9887a8a2275f4a2540e053aa670fcc50742864a9ae7c66e609fdcf12cf"}, -] - -[package.dependencies] -anyio = {version = ">=4.10", markers = "sys_platform != \"emscripten\""} -httpcore2 = {version = "2.12.0", markers = "sys_platform != \"emscripten\""} -httpx2-jsfetch = {version = "*", markers = "sys_platform == \"emscripten\" and python_version >= \"3.12\""} -idna = ">=3.18" -truststore = {version = ">=0.10", markers = "sys_platform != \"emscripten\""} -typing-extensions = {version = ">=4.5.0", markers = "python_version < \"3.13\""} - -[package.extras] -brotli = ["brotli (>=1.2.0) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=1.2.0.0) ; platform_python_implementation != \"CPython\""] -cli = ["click (>=8.4.2)", "pygments (==2.*)", "rich (>=10,<16)"] -http2 = ["h2 (>=3,<5)"] -socks = ["socksio (==1.*)"] -ws = ["wsproto (>=1.2)"] -zstd = ["backports-zstd (>=1.0.0) ; python_version <= \"3.13\""] - -[[package]] -name = "httpx2-jsfetch" -version = "1.0" -description = "httpx2 transports for Emscripten/Pyodide, backed by the JavaScript fetch API." -optional = true -python-versions = ">=3.12" -groups = ["main"] -markers = "sys_platform == \"emscripten\" and python_version >= \"3.12\" and extra == \"mcp\"" -files = [ - {file = "httpx2_jsfetch-1.0-py3-none-any.whl", hash = "sha256:cb916b707601e69a07721aabc8f3f6659be3a6893bc1ff5c6f9e02241df2da32"}, - {file = "httpx2_jsfetch-1.0.tar.gz", hash = "sha256:70a0e3eabfef7cce5ad9c629f7d01ca05e418f586646f4ddf14782e4c1454c60"}, -] - -[[package]] -name = "id" -version = "1.6.1" -description = "A tool for generating OIDC identities" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -files = [ - {file = "id-1.6.1-py3-none-any.whl", hash = "sha256:f5ec41ed2629a508f5d0988eda142e190c9c6da971100612c4de9ad9f9b237ca"}, - {file = "id-1.6.1.tar.gz", hash = "sha256:d0732d624fb46fd4e7bc4e5152f00214450953b9e772c182c1c22964def1a069"}, -] - -[package.dependencies] -urllib3 = ">=2,<3" - -[package.extras] -dev = ["build", "bump (>=1.3.2)", "id[lint,test]"] -lint = ["bandit", "interrogate", "mypy", "ruff (<0.14.15)"] -test = ["coverage[toml]", "pretend", "pytest", "pytest-cov"] - -[[package]] -name = "identify" -version = "2.6.19" -description = "File identification library for Python" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "identify-2.6.19-py2.py3-none-any.whl", hash = "sha256:20e6a87f786f768c092a721ad107fc9df0eb89347be9396cadf3f4abbd1fb78a"}, - {file = "identify-2.6.19.tar.gz", hash = "sha256:6be5020c38fcb07da56c53733538a3081ea5aa70d36a156f83044bfbf9173842"}, -] - -[package.extras] -license = ["ukkonen"] - -[[package]] -name = "idna" -version = "3.19" -description = "Internationalized Domain Names in Applications (IDNA)" -optional = false -python-versions = ">=3.9" -groups = ["main", "dev"] -files = [ - {file = "idna-3.19-py3-none-any.whl", hash = "sha256:815e7be7a7806d54abb586dc943addc79e8b2ee16915059658cbeff4b1b43bf4"}, - {file = "idna-3.19.tar.gz", hash = "sha256:5e0811a4383b21dc5838069f801c4fb62113b7447663d2530d2bd6e77b49bf15"}, -] - -[package.extras] -all = ["coverage (>=7.10.0)", "hypothesis (>=6.141.1)", "mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.16.0)", "ty (>=0.0.37)"] - -[[package]] -name = "importlib-metadata" -version = "8.7.1" -description = "Read metadata from Python packages" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and python_version < \"3.12\"" -files = [ - {file = "importlib_metadata-8.7.1-py3-none-any.whl", hash = "sha256:5a1f80bf1daa489495071efbb095d75a634cf28a8bc299581244063b53176151"}, - {file = "importlib_metadata-8.7.1.tar.gz", hash = "sha256:49fef1ae6440c182052f407c8d34a68f72efc36db9ca90dc0113398f2fdde8bb"}, -] - -[package.dependencies] -zipp = ">=3.20" - -[package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -enabler = ["pytest-enabler (>=3.4)"] -perf = ["ipython"] -test = ["flufl.flake8", "jaraco.test (>=5.4)", "packaging", "pyfakefs", "pytest (>=6,!=8.1.*)", "pytest-perf (>=0.9.2)"] -type = ["mypy (<1.19) ; platform_python_implementation == \"PyPy\"", "pytest-mypy (>=1.0.1)"] - -[[package]] -name = "iniconfig" -version = "2.3.0" -description = "brain-dead simple config-ini parsing" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"}, - {file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"}, -] - -[[package]] -name = "jaraco-classes" -version = "3.4.0" -description = "Utility functions for Python class constructs" -optional = false -python-versions = ">=3.8" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\"" -files = [ - {file = "jaraco.classes-3.4.0-py3-none-any.whl", hash = "sha256:f662826b6bed8cace05e7ff873ce0f9283b5c924470fe664fff1c2f00f581790"}, - {file = "jaraco.classes-3.4.0.tar.gz", hash = "sha256:47a024b51d0239c0dd8c8540c6c7f484be3b8fcf0b2d85c13825780d3b3f3acd"}, -] - -[package.dependencies] -more-itertools = "*" - -[package.extras] -docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy", "pytest-ruff (>=0.2.1)"] - -[[package]] -name = "jaraco-context" -version = "6.1.2" -description = "Useful decorators and context managers" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\"" -files = [ - {file = "jaraco_context-6.1.2-py3-none-any.whl", hash = "sha256:bf8150b79a2d5d91ae48629d8b427a8f7ba0e1097dd6202a9059f29a36379535"}, - {file = "jaraco_context-6.1.2.tar.gz", hash = "sha256:f1a6c9d391e661cc5b8d39861ff077a7dc24dc23833ccee564b234b81c82dfe3"}, -] - -[package.dependencies] -"backports.tarfile" = {version = "*", markers = "python_version < \"3.12\""} - -[package.extras] -check = ["pytest-checkdocs (>=2.14)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -enabler = ["pytest-enabler (>=3.4)"] -test = ["jaraco.test (>=5.6.0)", "portend", "pytest (>=6,!=8.1.*)"] -type = ["pytest-mypy (>=1.0.1) ; platform_python_implementation != \"PyPy\""] - -[[package]] -name = "jaraco-functools" -version = "4.4.0" -description = "Functools like those found in stdlib" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\"" -files = [ - {file = "jaraco_functools-4.4.0-py3-none-any.whl", hash = "sha256:9eec1e36f45c818d9bf307c8948eb03b2b56cd44087b3cdc989abca1f20b9176"}, - {file = "jaraco_functools-4.4.0.tar.gz", hash = "sha256:da21933b0417b89515562656547a77b4931f98176eb173644c0d35032a33d6bb"}, -] - -[package.dependencies] -more_itertools = "*" - -[package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -enabler = ["pytest-enabler (>=3.4)"] -test = ["jaraco.classes", "pytest (>=6,!=8.1.*)"] -type = ["mypy (<1.19) ; platform_python_implementation == \"PyPy\"", "pytest-mypy (>=1.0.1)"] - -[[package]] -name = "jeepney" -version = "0.9.0" -description = "Low-level, pure Python DBus protocol wrapper." -optional = false -python-versions = ">=3.7" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and sys_platform == \"linux\"" -files = [ - {file = "jeepney-0.9.0-py3-none-any.whl", hash = "sha256:97e5714520c16fc0a45695e5365a2e11b81ea79bba796e26f9f1d178cb182683"}, - {file = "jeepney-0.9.0.tar.gz", hash = "sha256:cf0e9e845622b81e4a28df94c40345400256ec608d0e55bb8a3feaa9163f5732"}, -] - -[package.extras] -test = ["async-timeout ; python_version < \"3.11\"", "pytest", "pytest-asyncio (>=0.17)", "pytest-trio", "testpath", "trio"] -trio = ["trio"] - -[[package]] -name = "joserfc" -version = "1.7.7" -description = "The ultimate Python library for JOSE RFCs, including JWS, JWE, JWK, JWA, JWT" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "joserfc-1.7.7-py3-none-any.whl", hash = "sha256:06979cfbab78bc802f14c0358f32969826cc26720e13cb38926ffdc86bc0cb2c"}, - {file = "joserfc-1.7.7.tar.gz", hash = "sha256:471d0fd12a5a0d1c0942de280f39efe6f597878315033270b504d4d006d25510"}, -] - -[package.dependencies] -cryptography = ">=45.0.1" - -[package.extras] -drafts = ["pycryptodome"] - -[[package]] -name = "jsonref" -version = "1.1.0" -description = "jsonref is a library for automatic dereferencing of JSON Reference objects for Python." -optional = true -python-versions = ">=3.7" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "jsonref-1.1.0-py3-none-any.whl", hash = "sha256:590dc7773df6c21cbf948b5dac07a72a251db28b0238ceecce0a2abfa8ec30a9"}, - {file = "jsonref-1.1.0.tar.gz", hash = "sha256:32fe8e1d85af0fdefbebce950af85590b22b60f9e95443176adbde4e1ecea552"}, -] - -[[package]] -name = "jsonschema" -version = "4.26.0" -description = "An implementation of JSON Schema validation for Python" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce"}, - {file = "jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326"}, -] - -[package.dependencies] -attrs = ">=22.2.0" -jsonschema-specifications = ">=2023.3.6" -referencing = ">=0.28.4" -rpds-py = ">=0.25.0" - -[package.extras] -format = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3987", "uri-template", "webcolors (>=1.11)"] -format-nongpl = ["fqdn", "idna", "isoduration", "jsonpointer (>1.13)", "rfc3339-validator", "rfc3986-validator (>0.1.0)", "rfc3987-syntax (>=1.1.0)", "uri-template", "webcolors (>=24.6.0)"] - -[[package]] -name = "jsonschema-path" -version = "0.4.5" -description = "JSONSchema Spec with object-oriented paths" -optional = true -python-versions = "<4.0.0,>=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "jsonschema_path-0.4.5-py3-none-any.whl", hash = "sha256:7d77a2c3f3ec569a40efe5c5f942c44c1af2a6f96fe0866794c9ef5b8f87fd65"}, - {file = "jsonschema_path-0.4.5.tar.gz", hash = "sha256:c6cd7d577ae290c7defd4f4029e86fdb248ca1bd41a07557795b3c95e5144918"}, -] - -[package.dependencies] -pathable = ">=0.5.0,<0.6.0" -PyYAML = ">=5.1" -referencing = "<0.38.0" - -[package.extras] -requests = ["requests (>=2.31.0,<3.0.0)"] - -[[package]] -name = "jsonschema-specifications" -version = "2025.9.1" -description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe"}, - {file = "jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d"}, -] - -[package.dependencies] -referencing = ">=0.31.0" - -[[package]] -name = "keyring" -version = "25.7.0" -description = "Store and access your passwords safely." -optional = false -python-versions = ">=3.9" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\"" -files = [ - {file = "keyring-25.7.0-py3-none-any.whl", hash = "sha256:be4a0b195f149690c166e850609a477c532ddbfbaed96a404d4e43f8d5e2689f"}, - {file = "keyring-25.7.0.tar.gz", hash = "sha256:fe01bd85eb3f8fb3dd0405defdeac9a5b4f6f0439edbb3149577f244a2e8245b"}, -] - -[package.dependencies] -importlib_metadata = {version = ">=4.11.4", markers = "python_version < \"3.12\""} -"jaraco.classes" = "*" -"jaraco.context" = "*" -"jaraco.functools" = "*" -jeepney = {version = ">=0.4.2", markers = "sys_platform == \"linux\""} -pywin32-ctypes = {version = ">=0.2.0", markers = "sys_platform == \"win32\""} -SecretStorage = {version = ">=3.2", markers = "sys_platform == \"linux\""} - -[package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] -completion = ["shtab (>=1.1.0)"] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -enabler = ["pytest-enabler (>=3.4)"] -test = ["pyfakefs", "pytest (>=6,!=8.1.*)"] -type = ["pygobject-stubs", "pytest-mypy (>=1.0.1)", "shtab", "types-pywin32"] - -[[package]] -name = "markdown-it-py" -version = "4.2.0" -description = "Python port of markdown-it. Markdown parsing, done right!" -optional = false -python-versions = ">=3.10" -groups = ["main", "dev"] -files = [ - {file = "markdown_it_py-4.2.0-py3-none-any.whl", hash = "sha256:9f7ebbcd14fe59494226453aed97c1070d83f8d24b6fc3a3bcf9a38092641c4a"}, - {file = "markdown_it_py-4.2.0.tar.gz", hash = "sha256:04a21681d6fbb623de53f6f364d352309d4094dd4194040a10fd51833e418d49"}, -] - -[package.dependencies] -mdurl = ">=0.1,<1.0" - -[package.extras] -benchmarking = ["psutil", "pytest", "pytest-benchmark"] -compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "markdown-it-pyrs", "mistletoe (>=1.0,<2.0)", "mistune (>=3.0,<4.0)", "panflute (>=2.3,<3.0)"] -linkify = ["linkify-it-py (>=1,<3)"] -plugins = ["mdit-py-plugins (>=0.5.0)"] -profiling = ["gprof2dot"] -rtd = ["ipykernel", "jupyter_sphinx", "mdit-py-plugins (>=0.5.0)", "myst-parser", "pyyaml", "sphinx", "sphinx-book-theme (>=1.0,<2.0)", "sphinx-copybutton", "sphinx-design"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions", "pytest-timeout", "requests"] - -[[package]] -name = "mcp" -version = "2.3.0" -description = "Model Context Protocol SDK" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "mcp-2.3.0-py3-none-any.whl", hash = "sha256:dd0c44c089d16453e8ae31a3877a0054d7a2314caaa81f5e0541b9b1734b2377"}, - {file = "mcp-2.3.0.tar.gz", hash = "sha256:8b147a50441cf059dc88c684e0aeed3687f0aa0f39c6cde7b90330effd2b34d8"}, -] - -[package.dependencies] -anyio = [ - {version = ">=4.9", markers = "python_version < \"3.14\""}, - {version = ">=4.10", markers = "python_version >= \"3.14\""}, -] -httpx2 = ">=2.10.0" -jsonschema = ">=4.20.0" -mcp-types = "2.3.0" -opentelemetry-api = ">=1.28.0" -pydantic = ">=2.12.0" -pyjwt = {version = ">=2.10.1", extras = ["crypto"]} -python-multipart = ">=0.0.9" -pywin32 = {version = ">=311", markers = "sys_platform == \"win32\""} -sse-starlette = ">=3.0.0" -starlette = [ - {version = ">=0.27", markers = "python_version < \"3.14\""}, - {version = ">=0.48.0", markers = "python_version >= \"3.14\""}, -] -typing-extensions = ">=4.13.0" -typing-inspection = ">=0.4.1" -uvicorn = {version = ">=0.31.1", markers = "sys_platform != \"emscripten\""} - -[package.extras] -cli = ["python-dotenv (>=1.0.0)", "typer (>=0.16.0)"] -rich = ["rich (>=13.9.4)"] - -[[package]] -name = "mcp-types" -version = "2.3.0" -description = "Model Context Protocol wire types" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "mcp_types-2.3.0-py3-none-any.whl", hash = "sha256:968efdbdaedfab06adae40d378a34395f1090c5921d4be3c9cde283aaf76d91d"}, - {file = "mcp_types-2.3.0.tar.gz", hash = "sha256:d1e46549edb35ee19a94940fcee6d1addd7e589ab7ea92dda83f5d84781fc362"}, -] - -[package.dependencies] -pydantic = ">=2.12.0" -typing-extensions = ">=4.13.0" - -[[package]] -name = "mdit-py-plugins" -version = "0.6.1" -description = "Collection of plugins for markdown-it-py" -optional = false -python-versions = ">=3.10" -groups = ["main"] -files = [ - {file = "mdit_py_plugins-0.6.1-py3-none-any.whl", hash = "sha256:214c82fb2ac524472ab6a5bcab1de80f73b50443e187f401bfd77efbc7c6481d"}, - {file = "mdit_py_plugins-0.6.1.tar.gz", hash = "sha256:a2bca0f039f39dbd35fb74ae1b5f998608c437463371f0ff7f49a19a17a114d0"}, -] - -[package.dependencies] -markdown-it-py = ">=2.0.0,<5.0.0" - -[package.extras] -code-style = ["pre-commit"] -rtd = ["myst-parser", "sphinx-book-theme"] -testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions", "pytest-timeout"] - -[[package]] -name = "mdurl" -version = "0.1.2" -description = "Markdown URL utilities" -optional = false -python-versions = ">=3.7" -groups = ["main", "dev"] -files = [ - {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, - {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, -] - -[[package]] -name = "more-itertools" -version = "10.8.0" -description = "More routines for operating on iterables, beyond itertools" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\"" -files = [ - {file = "more_itertools-10.8.0-py3-none-any.whl", hash = "sha256:52d4362373dcf7c52546bc4af9a86ee7c4579df9a8dc268be0a2f949d376cc9b"}, - {file = "more_itertools-10.8.0.tar.gz", hash = "sha256:f638ddf8a1a0d134181275fb5d58b086ead7c6a72429ad725c67503f13ba30bd"}, -] - -[[package]] -name = "nh3" -version = "0.3.7" -description = "Python binding to Ammonia HTML sanitizer Rust crate" -optional = false -python-versions = ">=3.8" -groups = ["dev"] -files = [ - {file = "nh3-0.3.7-cp314-cp314t-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:91a4dab4e94d9fc54b9f67b1adfb23e81fab7ab43f33c3b8c97be9aa38f789ba"}, - {file = "nh3-0.3.7-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eae64328e46a25785535afcb6885b6f182ecaf5ee8c88f8c075422db8aacc65b"}, - {file = "nh3-0.3.7-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4968fe8d2db97c6f047659bf46a449fd8ec377f44ebf3e0a1b96c0d3a333ae32"}, - {file = "nh3-0.3.7-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:be53a4825585f701955cb9baf49f478f56eb81e20294329fe4bc689dd5dd81fa"}, - {file = "nh3-0.3.7-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:94fd6e59553fbb9ffd8ba71bbd5a54e3126ba01799a097ae30d5341d750bc6ac"}, - {file = "nh3-0.3.7-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:18f4278ecd157d43cb35acd5aae9f35cfa79f546b4922bd86536adc0f6312102"}, - {file = "nh3-0.3.7-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:808def0c8c07843e6e50dc84f532457bfa2cfd17417b219a5d9e7c773709331a"}, - {file = "nh3-0.3.7-cp314-cp314t-win32.whl", hash = "sha256:874b7d67a067bd29a59223f6270fc30da4edd8e6d87fd219fc93bcbaa662c946"}, - {file = "nh3-0.3.7-cp314-cp314t-win_amd64.whl", hash = "sha256:614dac4a4c36ad084e78447d16fe898dedd762e354a7ab9cda2984e82f67883d"}, - {file = "nh3-0.3.7-cp314-cp314t-win_arm64.whl", hash = "sha256:157ec1eb7a62f3d9a7badb8d82d89aa810e3e24e097eedfa481a25d0c8a99877"}, - {file = "nh3-0.3.7-cp38-abi3-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:6c3aa50eb26e9228238271db9f983cbc3b006dfbfeca2d4dc34c33ddc6ac5ea5"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f266d3f1b3647449923a8e406524632220dd5d8b647078dfe45b885d33d10479"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e8fd1ab205258b29254f72db377d99e2c96aa7653ef3b015ccab0420b094b506"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:19f288c938ec6eef1f5d2c6cab47838e71fef8097e1c1233802be5a6230ba086"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de2b2aab32ea303405debefdcfc58043d3e635fa3f67b9eb140d2b0e0c0d2563"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9b7279d43323a25225df23576af6594a16693f61431170848b8b2ac21ad4f174"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:70f5ac8626e899a4bab0ef74ca2f5bd602f49c7b739e6e5026b4afc6d63dac42"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_31_riscv64.whl", hash = "sha256:5ffdfcb9a686ffb12765376bcfb6b5b55728516d3c0ee317d29982381ded3df8"}, - {file = "nh3-0.3.7-cp38-abi3-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:bc42bb1193c1e28a1e74c2cabaca178e118a7103e8832699fef8a2b3e2496493"}, - {file = "nh3-0.3.7-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:d56e76bd3cadb09b6b0cef364850811663734b348a25f5f587a2819c495367bd"}, - {file = "nh3-0.3.7-cp38-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:fd4a70efb45d5372174f718878eb7a35c12677626a63b2f103b23b833457dcac"}, - {file = "nh3-0.3.7-cp38-abi3-musllinux_1_2_i686.whl", hash = "sha256:15f5fbf090f5c88d61c820e1fc1fceecb6520cca9fe85649c06b57ef9dc9ff62"}, - {file = "nh3-0.3.7-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:6698a822132beedab80f131c08d8d0ac5a178ddeb488d02ca4b67716ecfac7af"}, - {file = "nh3-0.3.7-cp38-abi3-win32.whl", hash = "sha256:6e4280115d44c3b278eef712a86748c1a723105cd79feec46952383117ab4e59"}, - {file = "nh3-0.3.7-cp38-abi3-win_amd64.whl", hash = "sha256:618e3059caf41ccdf5dcccb3fa9df4cf6e4efe23d1382a8bbfca272a8a4f8bfc"}, - {file = "nh3-0.3.7-cp38-abi3-win_arm64.whl", hash = "sha256:f04b7d333b27f13ca439da3cf1c75c2fba34f104969f6ce4ac8e7079699c2f4a"}, - {file = "nh3-0.3.7.tar.gz", hash = "sha256:71860d01c16f4d8c72e334e0674beb2b0899dbd0bf760de18932ef4390303848"}, -] - -[[package]] -name = "nodeenv" -version = "1.10.0" -description = "Node.js virtual environment builder" -optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" -groups = ["dev"] -files = [ - {file = "nodeenv-1.10.0-py2.py3-none-any.whl", hash = "sha256:5bb13e3eed2923615535339b3c620e76779af4cb4c6a90deccc9e36b274d3827"}, - {file = "nodeenv-1.10.0.tar.gz", hash = "sha256:996c191ad80897d076bdfba80a41994c2b47c68e224c542b48feba42ba00f8bb"}, -] - -[[package]] -name = "openapi-pydantic" -version = "0.6.0" -description = "Modern, type-safe OpenAPI schemas in Python using Pydantic 1.8+ and 2.x" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "openapi_pydantic-0.6.0-py3-none-any.whl", hash = "sha256:8bd6d548a250da37db96f461bcd52b3468e8834ad7d6db14b00a6b2ebbd163a3"}, - {file = "openapi_pydantic-0.6.0.tar.gz", hash = "sha256:11f3ac6ad41521fc156381ec587246b0c0ecea523bd9565ed74d3e7fac9d91cd"}, -] - -[package.dependencies] -pydantic = ">=1.8" - -[[package]] -name = "opentelemetry-api" -version = "1.45.2" -description = "OpenTelemetry Python API" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "opentelemetry_api-1.45.2-py3-none-any.whl", hash = "sha256:2cbd737377e710ee740d261c94e93fa0f08e6d037c18f17513cc0a2d94479a34"}, - {file = "opentelemetry_api-1.45.2.tar.gz", hash = "sha256:d7b0008e21e5fd61cbe7a7f34ca3b6905a78ab677d9bc395e299359c75cda6b4"}, -] - -[package.dependencies] -typing-extensions = ">=4.5.0" - -[[package]] -name = "packaging" -version = "26.3" -description = "Core utilities for Python packages" -optional = false -python-versions = ">=3.9" -groups = ["main", "dev"] -files = [ - {file = "packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c"}, - {file = "packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79"}, -] -markers = {main = "extra == \"mcp\""} - -[[package]] -name = "pathable" -version = "0.5.0" -description = "Object-oriented paths" -optional = true -python-versions = "<4.0,>=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "pathable-0.5.0-py3-none-any.whl", hash = "sha256:646e3d09491a6351a0c82632a09c02cdf70a252e73196b36d8a15ba0a114f0a6"}, - {file = "pathable-0.5.0.tar.gz", hash = "sha256:d81938348a1cacb525e7c75166270644782c0fb9c8cecc16be033e71427e0ef1"}, -] - -[[package]] -name = "platformdirs" -version = "4.9.4" -description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`." -optional = false -python-versions = ">=3.10" -groups = ["main", "dev"] -files = [ - {file = "platformdirs-4.9.4-py3-none-any.whl", hash = "sha256:68a9a4619a666ea6439f2ff250c12a853cd1cbd5158d258bd824a7df6be2f868"}, - {file = "platformdirs-4.9.4.tar.gz", hash = "sha256:1ec356301b7dc906d83f371c8f487070e99d3ccf9e501686456394622a01a934"}, -] -markers = {main = "extra == \"mcp\""} - -[[package]] -name = "pluggy" -version = "1.6.0" -description = "plugin and hook calling mechanisms for python" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -files = [ - {file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"}, - {file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"}, -] - -[package.extras] -dev = ["pre-commit", "tox"] -testing = ["coverage", "pytest", "pytest-benchmark"] - -[[package]] -name = "pre-commit" -version = "4.6.2" -description = "A framework for managing and maintaining multi-language pre-commit hooks." -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "pre_commit-4.6.2-py2.py3-none-any.whl", hash = "sha256:e2dde9a75d3bce11bd3831c26d134df00a2803c1d818be6a0383c3dcda25dc4e"}, - {file = "pre_commit-4.6.2.tar.gz", hash = "sha256:8f5d7bfb021ecdbcd9d49d89847082dd24172ccde534390081a679ad046e2441"}, -] - -[package.dependencies] -cfgv = ">=2.0.0" -identify = ">=1.0.0" -nodeenv = ">=0.11.1" -pyyaml = ">=5.1" -virtualenv = ">=20.10.0" - -[[package]] -name = "py-key-value-aio" -version = "0.4.4" -description = "Async Key-Value Store - A pluggable interface for KV Stores" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "py_key_value_aio-0.4.4-py3-none-any.whl", hash = "sha256:18e17564ecae61b987f909fc2cd41ee2012c84b4b1dcb8c055cf8b4bc1bf3f5d"}, - {file = "py_key_value_aio-0.4.4.tar.gz", hash = "sha256:e3012e6243ed7cc09bb05457bd4d03b1ba5c2b1ca8700096b3927db79ffbbe55"}, -] - -[package.dependencies] -aiofile = {version = ">=3.5.0", optional = true, markers = "extra == \"filetree\""} -anyio = {version = ">=4.4.0", optional = true, markers = "extra == \"filetree\""} -beartype = ">=0.20.0" -cachetools = {version = ">=5.0.0", optional = true, markers = "extra == \"memory\""} -typing-extensions = ">=4.15.0" - -[package.extras] -aerospike = ["aerospike (>=16.0.0)"] -disk = ["diskcache (>=5.0.0)", "pathvalidate (>=3.3.1)"] -docs = ["mkdocs (>=1.6.0)", "mkdocs-material (>=9.5.0)", "mkdocstrings-python (>=1.10.0)", "mkdocstrings[python] (>=0.30.0)"] -duckdb = ["duckdb (>=1.1.1)", "pytz (>=2025.2)"] -dynamodb = ["aioboto3 (>=13.3.0)", "types-aiobotocore-dynamodb (>=2.16.0)"] -elasticsearch = ["aiohttp (>=3.12)", "elasticsearch (>=8.0.0)"] -filetree = ["aiofile (>=3.5.0)", "anyio (>=4.4.0)"] -firestore = ["google-auth (>=2.24.0)", "google-cloud-firestore (>=2.13.0)"] -keyring = ["keyring (>=25.6.0)"] -keyring-linux = ["dbus-python (>=1.4.0)", "keyring (>=25.6.0)"] -memcached = ["aiomcache (>=0.8.0)"] -memory = ["cachetools (>=5.0.0)"] -mongodb = ["pymongo (>=4.0.0)"] -opensearch = ["opensearch-py[async] (>=2.0.0)"] -postgresql = ["asyncpg (>=0.30.0)"] -pydantic = ["pydantic (>=2.11.9)"] -redis = ["redis (>=4.3.0)"] -rocksdb = ["rocksdict (>=0.3.2) ; python_full_version < \"3.12.0\"", "rocksdict (>=0.3.24) ; python_full_version >= \"3.12.0\""] -s3 = ["aioboto3 (>=13.3.0)", "types-aiobotocore-s3 (>=2.16.0)"] -valkey = ["valkey-glide (>=2.1.0)"] -vault = ["hvac (>=2.3.0)", "types-hvac (>=2.3.0)"] -wrappers-encryption = ["cryptography (>=45.0.0)"] - -[[package]] -name = "pycparser" -version = "3.0" -description = "C parser in Python" -optional = false -python-versions = ">=3.10" -groups = ["main", "dev"] -files = [ - {file = "pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992"}, - {file = "pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29"}, -] -markers = {main = "extra == \"mcp\" and platform_python_implementation != \"PyPy\" and implementation_name != \"PyPy\"", dev = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and sys_platform == \"linux\" and platform_python_implementation != \"PyPy\" and implementation_name != \"PyPy\""} - -[[package]] -name = "pydantic" -version = "2.12.5" -description = "Data validation using Python type hints" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "pydantic-2.12.5-py3-none-any.whl", hash = "sha256:e561593fccf61e8a20fc46dfc2dfe075b8be7d0188df33f221ad1f0139180f9d"}, - {file = "pydantic-2.12.5.tar.gz", hash = "sha256:4d351024c75c0f085a9febbb665ce8c0c6ec5d30e903bdb6394b7ede26aebb49"}, -] - -[package.dependencies] -annotated-types = ">=0.6.0" -email-validator = {version = ">=2.0.0", optional = true, markers = "extra == \"email\""} -pydantic-core = "2.41.5" -typing-extensions = ">=4.14.1" -typing-inspection = ">=0.4.2" - -[package.extras] -email = ["email-validator (>=2.0.0)"] -timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""] - -[[package]] -name = "pydantic-core" -version = "2.41.5" -description = "Core functionality for Pydantic validation and serialization" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "pydantic_core-2.41.5-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:77b63866ca88d804225eaa4af3e664c5faf3568cea95360d21f4725ab6e07146"}, - {file = "pydantic_core-2.41.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:dfa8a0c812ac681395907e71e1274819dec685fec28273a28905df579ef137e2"}, - {file = "pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5921a4d3ca3aee735d9fd163808f5e8dd6c6972101e4adbda9a4667908849b97"}, - {file = "pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e25c479382d26a2a41b7ebea1043564a937db462816ea07afa8a44c0866d52f9"}, - {file = "pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f547144f2966e1e16ae626d8ce72b4cfa0caedc7fa28052001c94fb2fcaa1c52"}, - {file = "pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f52298fbd394f9ed112d56f3d11aabd0d5bd27beb3084cc3d8ad069483b8941"}, - {file = "pydantic_core-2.41.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:100baa204bb412b74fe285fb0f3a385256dad1d1879f0a5cb1499ed2e83d132a"}, - {file = "pydantic_core-2.41.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:05a2c8852530ad2812cb7914dc61a1125dc4e06252ee98e5638a12da6cc6fb6c"}, - {file = "pydantic_core-2.41.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:29452c56df2ed968d18d7e21f4ab0ac55e71dc59524872f6fc57dcf4a3249ed2"}, - {file = "pydantic_core-2.41.5-cp310-cp310-musllinux_1_1_armv7l.whl", hash = "sha256:d5160812ea7a8a2ffbe233d8da666880cad0cbaf5d4de74ae15c313213d62556"}, - {file = "pydantic_core-2.41.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:df3959765b553b9440adfd3c795617c352154e497a4eaf3752555cfb5da8fc49"}, - {file = "pydantic_core-2.41.5-cp310-cp310-win32.whl", hash = "sha256:1f8d33a7f4d5a7889e60dc39856d76d09333d8a6ed0f5f1190635cbec70ec4ba"}, - {file = "pydantic_core-2.41.5-cp310-cp310-win_amd64.whl", hash = "sha256:62de39db01b8d593e45871af2af9e497295db8d73b085f6bfd0b18c83c70a8f9"}, - {file = "pydantic_core-2.41.5-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a3a52f6156e73e7ccb0f8cced536adccb7042be67cb45f9562e12b319c119da6"}, - {file = "pydantic_core-2.41.5-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:7f3bf998340c6d4b0c9a2f02d6a400e51f123b59565d74dc60d252ce888c260b"}, - {file = "pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:378bec5c66998815d224c9ca994f1e14c0c21cb95d2f52b6021cc0b2a58f2a5a"}, - {file = "pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:e7b576130c69225432866fe2f4a469a85a54ade141d96fd396dffcf607b558f8"}, - {file = "pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:6cb58b9c66f7e4179a2d5e0f849c48eff5c1fca560994d6eb6543abf955a149e"}, - {file = "pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:88942d3a3dff3afc8288c21e565e476fc278902ae4d6d134f1eeda118cc830b1"}, - {file = "pydantic_core-2.41.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f31d95a179f8d64d90f6831d71fa93290893a33148d890ba15de25642c5d075b"}, - {file = "pydantic_core-2.41.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c1df3d34aced70add6f867a8cf413e299177e0c22660cc767218373d0779487b"}, - {file = "pydantic_core-2.41.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:4009935984bd36bd2c774e13f9a09563ce8de4abaa7226f5108262fa3e637284"}, - {file = "pydantic_core-2.41.5-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:34a64bc3441dc1213096a20fe27e8e128bd3ff89921706e83c0b1ac971276594"}, - {file = "pydantic_core-2.41.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:c9e19dd6e28fdcaa5a1de679aec4141f691023916427ef9bae8584f9c2fb3b0e"}, - {file = "pydantic_core-2.41.5-cp311-cp311-win32.whl", hash = "sha256:2c010c6ded393148374c0f6f0bf89d206bf3217f201faa0635dcd56bd1520f6b"}, - {file = "pydantic_core-2.41.5-cp311-cp311-win_amd64.whl", hash = "sha256:76ee27c6e9c7f16f47db7a94157112a2f3a00e958bc626e2f4ee8bec5c328fbe"}, - {file = "pydantic_core-2.41.5-cp311-cp311-win_arm64.whl", hash = "sha256:4bc36bbc0b7584de96561184ad7f012478987882ebf9f9c389b23f432ea3d90f"}, - {file = "pydantic_core-2.41.5-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:f41a7489d32336dbf2199c8c0a215390a751c5b014c2c1c5366e817202e9cdf7"}, - {file = "pydantic_core-2.41.5-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:070259a8818988b9a84a449a2a7337c7f430a22acc0859c6b110aa7212a6d9c0"}, - {file = "pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e96cea19e34778f8d59fe40775a7a574d95816eb150850a85a7a4c8f4b94ac69"}, - {file = "pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ed2e99c456e3fadd05c991f8f437ef902e00eedf34320ba2b0842bd1c3ca3a75"}, - {file = "pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:65840751b72fbfd82c3c640cff9284545342a4f1eb1586ad0636955b261b0b05"}, - {file = "pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e536c98a7626a98feb2d3eaf75944ef6f3dbee447e1f841eae16f2f0a72d8ddc"}, - {file = "pydantic_core-2.41.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eceb81a8d74f9267ef4081e246ffd6d129da5d87e37a77c9bde550cb04870c1c"}, - {file = "pydantic_core-2.41.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d38548150c39b74aeeb0ce8ee1d8e82696f4a4e16ddc6de7b1d8823f7de4b9b5"}, - {file = "pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:c23e27686783f60290e36827f9c626e63154b82b116d7fe9adba1fda36da706c"}, - {file = "pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:482c982f814460eabe1d3bb0adfdc583387bd4691ef00b90575ca0d2b6fe2294"}, - {file = "pydantic_core-2.41.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:bfea2a5f0b4d8d43adf9d7b8bf019fb46fdd10a2e5cde477fbcb9d1fa08c68e1"}, - {file = "pydantic_core-2.41.5-cp312-cp312-win32.whl", hash = "sha256:b74557b16e390ec12dca509bce9264c3bbd128f8a2c376eaa68003d7f327276d"}, - {file = "pydantic_core-2.41.5-cp312-cp312-win_amd64.whl", hash = "sha256:1962293292865bca8e54702b08a4f26da73adc83dd1fcf26fbc875b35d81c815"}, - {file = "pydantic_core-2.41.5-cp312-cp312-win_arm64.whl", hash = "sha256:1746d4a3d9a794cacae06a5eaaccb4b8643a131d45fbc9af23e353dc0a5ba5c3"}, - {file = "pydantic_core-2.41.5-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:941103c9be18ac8daf7b7adca8228f8ed6bb7a1849020f643b3a14d15b1924d9"}, - {file = "pydantic_core-2.41.5-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:112e305c3314f40c93998e567879e887a3160bb8689ef3d2c04b6cc62c33ac34"}, - {file = "pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0cbaad15cb0c90aa221d43c00e77bb33c93e8d36e0bf74760cd00e732d10a6a0"}, - {file = "pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:03ca43e12fab6023fc79d28ca6b39b05f794ad08ec2feccc59a339b02f2b3d33"}, - {file = "pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:dc799088c08fa04e43144b164feb0c13f9a0bc40503f8df3e9fde58a3c0c101e"}, - {file = "pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:97aeba56665b4c3235a0e52b2c2f5ae9cd071b8a8310ad27bddb3f7fb30e9aa2"}, - {file = "pydantic_core-2.41.5-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:406bf18d345822d6c21366031003612b9c77b3e29ffdb0f612367352aab7d586"}, - {file = "pydantic_core-2.41.5-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:b93590ae81f7010dbe380cdeab6f515902ebcbefe0b9327cc4804d74e93ae69d"}, - {file = "pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:01a3d0ab748ee531f4ea6c3e48ad9dac84ddba4b0d82291f87248f2f9de8d740"}, - {file = "pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:6561e94ba9dacc9c61bce40e2d6bdc3bfaa0259d3ff36ace3b1e6901936d2e3e"}, - {file = "pydantic_core-2.41.5-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:915c3d10f81bec3a74fbd4faebe8391013ba61e5a1a8d48c4455b923bdda7858"}, - {file = "pydantic_core-2.41.5-cp313-cp313-win32.whl", hash = "sha256:650ae77860b45cfa6e2cdafc42618ceafab3a2d9a3811fcfbd3bbf8ac3c40d36"}, - {file = "pydantic_core-2.41.5-cp313-cp313-win_amd64.whl", hash = "sha256:79ec52ec461e99e13791ec6508c722742ad745571f234ea6255bed38c6480f11"}, - {file = "pydantic_core-2.41.5-cp313-cp313-win_arm64.whl", hash = "sha256:3f84d5c1b4ab906093bdc1ff10484838aca54ef08de4afa9de0f5f14d69639cd"}, - {file = "pydantic_core-2.41.5-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:3f37a19d7ebcdd20b96485056ba9e8b304e27d9904d233d7b1015db320e51f0a"}, - {file = "pydantic_core-2.41.5-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:1d1d9764366c73f996edd17abb6d9d7649a7eb690006ab6adbda117717099b14"}, - {file = "pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:25e1c2af0fce638d5f1988b686f3b3ea8cd7de5f244ca147c777769e798a9cd1"}, - {file = "pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:506d766a8727beef16b7adaeb8ee6217c64fc813646b424d0804d67c16eddb66"}, - {file = "pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:4819fa52133c9aa3c387b3328f25c1facc356491e6135b459f1de698ff64d869"}, - {file = "pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2b761d210c9ea91feda40d25b4efe82a1707da2ef62901466a42492c028553a2"}, - {file = "pydantic_core-2.41.5-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:22f0fb8c1c583a3b6f24df2470833b40207e907b90c928cc8d3594b76f874375"}, - {file = "pydantic_core-2.41.5-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:2782c870e99878c634505236d81e5443092fba820f0373997ff75f90f68cd553"}, - {file = "pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:0177272f88ab8312479336e1d777f6b124537d47f2123f89cb37e0accea97f90"}, - {file = "pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_armv7l.whl", hash = "sha256:63510af5e38f8955b8ee5687740d6ebf7c2a0886d15a6d65c32814613681bc07"}, - {file = "pydantic_core-2.41.5-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:e56ba91f47764cc14f1daacd723e3e82d1a89d783f0f5afe9c364b8bb491ccdb"}, - {file = "pydantic_core-2.41.5-cp314-cp314-win32.whl", hash = "sha256:aec5cf2fd867b4ff45b9959f8b20ea3993fc93e63c7363fe6851424c8a7e7c23"}, - {file = "pydantic_core-2.41.5-cp314-cp314-win_amd64.whl", hash = "sha256:8e7c86f27c585ef37c35e56a96363ab8de4e549a95512445b85c96d3e2f7c1bf"}, - {file = "pydantic_core-2.41.5-cp314-cp314-win_arm64.whl", hash = "sha256:e672ba74fbc2dc8eea59fb6d4aed6845e6905fc2a8afe93175d94a83ba2a01a0"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:8566def80554c3faa0e65ac30ab0932b9e3a5cd7f8323764303d468e5c37595a"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:b80aa5095cd3109962a298ce14110ae16b8c1aece8b72f9dafe81cf597ad80b3"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3006c3dd9ba34b0c094c544c6006cc79e87d8612999f1a5d43b769b89181f23c"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:72f6c8b11857a856bcfa48c86f5368439f74453563f951e473514579d44aa612"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5cb1b2f9742240e4bb26b652a5aeb840aa4b417c7748b6f8387927bc6e45e40d"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:bd3d54f38609ff308209bd43acea66061494157703364ae40c951f83ba99a1a9"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2ff4321e56e879ee8d2a879501c8e469414d948f4aba74a2d4593184eb326660"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d0d2568a8c11bf8225044aa94409e21da0cb09dcdafe9ecd10250b2baad531a9"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:a39455728aabd58ceabb03c90e12f71fd30fa69615760a075b9fec596456ccc3"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_armv7l.whl", hash = "sha256:239edca560d05757817c13dc17c50766136d21f7cd0fac50295499ae24f90fdf"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:2a5e06546e19f24c6a96a129142a75cee553cc018ffee48a460059b1185f4470"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-win32.whl", hash = "sha256:b4ececa40ac28afa90871c2cc2b9ffd2ff0bf749380fbdf57d165fd23da353aa"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-win_amd64.whl", hash = "sha256:80aa89cad80b32a912a65332f64a4450ed00966111b6615ca6816153d3585a8c"}, - {file = "pydantic_core-2.41.5-cp314-cp314t-win_arm64.whl", hash = "sha256:35b44f37a3199f771c3eaa53051bc8a70cd7b54f333531c59e29fd4db5d15008"}, - {file = "pydantic_core-2.41.5-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:8bfeaf8735be79f225f3fefab7f941c712aaca36f1128c9d7e2352ee1aa87bdf"}, - {file = "pydantic_core-2.41.5-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:346285d28e4c8017da95144c7f3acd42740d637ff41946af5ce6e5e420502dd5"}, - {file = "pydantic_core-2.41.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a75dafbf87d6276ddc5b2bf6fae5254e3d0876b626eb24969a574fff9149ee5d"}, - {file = "pydantic_core-2.41.5-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:7b93a4d08587e2b7e7882de461e82b6ed76d9026ce91ca7915e740ecc7855f60"}, - {file = "pydantic_core-2.41.5-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e8465ab91a4bd96d36dde3263f06caa6a8a6019e4113f24dc753d79a8b3a3f82"}, - {file = "pydantic_core-2.41.5-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:299e0a22e7ae2b85c1a57f104538b2656e8ab1873511fd718a1c1c6f149b77b5"}, - {file = "pydantic_core-2.41.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:707625ef0983fcfb461acfaf14de2067c5942c6bb0f3b4c99158bed6fedd3cf3"}, - {file = "pydantic_core-2.41.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:f41eb9797986d6ebac5e8edff36d5cef9de40def462311b3eb3eeded1431e425"}, - {file = "pydantic_core-2.41.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0384e2e1021894b1ff5a786dbf94771e2986ebe2869533874d7e43bc79c6f504"}, - {file = "pydantic_core-2.41.5-cp39-cp39-musllinux_1_1_armv7l.whl", hash = "sha256:f0cd744688278965817fd0839c4a4116add48d23890d468bc436f78beb28abf5"}, - {file = "pydantic_core-2.41.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:753e230374206729bf0a807954bcc6c150d3743928a73faffee51ac6557a03c3"}, - {file = "pydantic_core-2.41.5-cp39-cp39-win32.whl", hash = "sha256:873e0d5b4fb9b89ef7c2d2a963ea7d02879d9da0da8d9d4933dee8ee86a8b460"}, - {file = "pydantic_core-2.41.5-cp39-cp39-win_amd64.whl", hash = "sha256:e4f4a984405e91527a0d62649ee21138f8e3d0ef103be488c1dc11a80d7f184b"}, - {file = "pydantic_core-2.41.5-graalpy311-graalpy242_311_native-macosx_10_12_x86_64.whl", hash = "sha256:b96d5f26b05d03cc60f11a7761a5ded1741da411e7fe0909e27a5e6a0cb7b034"}, - {file = "pydantic_core-2.41.5-graalpy311-graalpy242_311_native-macosx_11_0_arm64.whl", hash = "sha256:634e8609e89ceecea15e2d61bc9ac3718caaaa71963717bf3c8f38bfde64242c"}, - {file = "pydantic_core-2.41.5-graalpy311-graalpy242_311_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:93e8740d7503eb008aa2df04d3b9735f845d43ae845e6dcd2be0b55a2da43cd2"}, - {file = "pydantic_core-2.41.5-graalpy311-graalpy242_311_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f15489ba13d61f670dcc96772e733aad1a6f9c429cc27574c6cdaed82d0146ad"}, - {file = "pydantic_core-2.41.5-graalpy312-graalpy250_312_native-macosx_10_12_x86_64.whl", hash = "sha256:7da7087d756b19037bc2c06edc6c170eeef3c3bafcb8f532ff17d64dc427adfd"}, - {file = "pydantic_core-2.41.5-graalpy312-graalpy250_312_native-macosx_11_0_arm64.whl", hash = "sha256:aabf5777b5c8ca26f7824cb4a120a740c9588ed58df9b2d196ce92fba42ff8dc"}, - {file = "pydantic_core-2.41.5-graalpy312-graalpy250_312_native-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c007fe8a43d43b3969e8469004e9845944f1a80e6acd47c150856bb87f230c56"}, - {file = "pydantic_core-2.41.5-graalpy312-graalpy250_312_native-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:76d0819de158cd855d1cbb8fcafdf6f5cf1eb8e470abe056d5d161106e38062b"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:b5819cd790dbf0c5eb9f82c73c16b39a65dd6dd4d1439dcdea7816ec9adddab8"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:5a4e67afbc95fa5c34cf27d9089bca7fcab4e51e57278d710320a70b956d1b9a"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ece5c59f0ce7d001e017643d8d24da587ea1f74f6993467d85ae8a5ef9d4f42b"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:16f80f7abe3351f8ea6858914ddc8c77e02578544a0ebc15b4c2e1a0e813b0b2"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:33cb885e759a705b426baada1fe68cbb0a2e68e34c5d0d0289a364cf01709093"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:c8d8b4eb992936023be7dee581270af5c6e0697a8559895f527f5b7105ecd36a"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:242a206cd0318f95cd21bdacff3fcc3aab23e79bba5cac3db5a841c9ef9c6963"}, - {file = "pydantic_core-2.41.5-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d3a978c4f57a597908b7e697229d996d77a6d3c94901e9edee593adada95ce1a"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:b2379fa7ed44ddecb5bfe4e48577d752db9fc10be00a6b7446e9663ba143de26"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:266fb4cbf5e3cbd0b53669a6d1b039c45e3ce651fd5442eff4d07c2cc8d66808"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58133647260ea01e4d0500089a8c4f07bd7aa6ce109682b1426394988d8aaacc"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:287dad91cfb551c363dc62899a80e9e14da1f0e2b6ebde82c806612ca2a13ef1"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-musllinux_1_1_aarch64.whl", hash = "sha256:03b77d184b9eb40240ae9fd676ca364ce1085f203e1b1256f8ab9984dca80a84"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-musllinux_1_1_armv7l.whl", hash = "sha256:a668ce24de96165bb239160b3d854943128f4334822900534f2fe947930e5770"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-musllinux_1_1_x86_64.whl", hash = "sha256:f14f8f046c14563f8eb3f45f499cc658ab8d10072961e07225e507adb700e93f"}, - {file = "pydantic_core-2.41.5-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:56121965f7a4dc965bff783d70b907ddf3d57f6eba29b6d2e5dabfaf07799c51"}, - {file = "pydantic_core-2.41.5.tar.gz", hash = "sha256:08daa51ea16ad373ffd5e7606252cc32f07bc72b28284b6bc9c6df804816476e"}, -] - -[package.dependencies] -typing-extensions = ">=4.14.1" - -[[package]] -name = "pydantic-settings" -version = "2.14.2" -description = "Settings management using Pydantic" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "pydantic_settings-2.14.2-py3-none-any.whl", hash = "sha256:a20c97b37910b6550d5ea50fbcc2d4187defe58cd57070b73863d069419c9440"}, - {file = "pydantic_settings-2.14.2.tar.gz", hash = "sha256:c19dd64b19097f1de80184f0cc7b0272a13ae6e170cbf240a3e27e381ed14a5f"}, -] - -[package.dependencies] -pydantic = ">=2.7.0" -python-dotenv = ">=0.21.0" -typing-inspection = ">=0.4.0" - -[package.extras] -aws-secrets-manager = ["boto3 (>=1.35.0)", "types-boto3[secretsmanager]"] -azure-key-vault = ["azure-identity (>=1.16.0)", "azure-keyvault-secrets (>=4.8.0)"] -gcp-secret-manager = ["google-cloud-secret-manager (>=2.23.1)"] -toml = ["tomli (>=2.0.1)"] -yaml = ["pyyaml (>=6.0.1)"] - -[[package]] -name = "pygments" -version = "2.20.0" -description = "Pygments is a syntax highlighting package written in Python." -optional = false -python-versions = ">=3.9" -groups = ["main", "dev"] -files = [ - {file = "pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176"}, - {file = "pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f"}, -] -markers = {main = "extra == \"mcp\""} - -[package.extras] -windows-terminal = ["colorama (>=0.4.6)"] - -[[package]] -name = "pyjwt" -version = "2.15.0" -description = "JSON Web Token implementation in Python" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "pyjwt-2.15.0-py3-none-any.whl", hash = "sha256:7a3742debf6b879e912dbb9819ceec1594be812452b78c5f2e2dfc56564954f8"}, - {file = "pyjwt-2.15.0.tar.gz", hash = "sha256:b11c5f9791d7bf51c2b39a81ed669f6b2dbbd669df2942f6c60167e9e3d1abe4"}, -] - -[package.dependencies] -cryptography = {version = ">=3.4.0", optional = true, markers = "extra == \"crypto\""} -typing_extensions = {version = ">=4.0", markers = "python_version < \"3.11\""} - -[package.extras] -crypto = ["cryptography (>=3.4.0)"] - -[[package]] -name = "pyperclip" -version = "1.11.0" -description = "A cross-platform clipboard module for Python. (Only handles plain text for now.)" -optional = true -python-versions = "*" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "pyperclip-1.11.0-py3-none-any.whl", hash = "sha256:299403e9ff44581cb9ba2ffeed69c7aa96a008622ad0c46cb575ca75b5b84273"}, - {file = "pyperclip-1.11.0.tar.gz", hash = "sha256:244035963e4428530d9e3a6101a1ef97209c6825edab1567beac148ccc1db1b6"}, -] - -[[package]] -name = "pytest" -version = "9.1.1" -description = "pytest: simple powerful testing with Python" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "pytest-9.1.1-py3-none-any.whl", hash = "sha256:37a86b45efb9a47a61a36449063e8e18d0cab3161329fc099eb21783169c4f0c"}, - {file = "pytest-9.1.1.tar.gz", hash = "sha256:1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313"}, -] - -[package.dependencies] -colorama = {version = ">=0.4", markers = "sys_platform == \"win32\""} -exceptiongroup = {version = ">=1", markers = "python_version < \"3.11\""} -iniconfig = ">=1.0.1" -packaging = ">=22" -pluggy = ">=1.5,<2" -pygments = ">=2.7.2" -tomli = {version = ">=1", markers = "python_version < \"3.11\""} - -[package.extras] -dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "requests", "setuptools", "xmlschema"] - -[[package]] -name = "python-discovery" -version = "1.6.1" -description = "Python interpreter discovery" -optional = false -python-versions = ">=3.8" -groups = ["dev"] -files = [ - {file = "python_discovery-1.6.1-py3-none-any.whl", hash = "sha256:d43fcdef879fe795352bd13ccf8d185ba5a9f86f36cfcd00529f596e737442b3"}, - {file = "python_discovery-1.6.1.tar.gz", hash = "sha256:cf87d3627dfb4412437fdd5b13eae402607722998d21567993aedbc59b23c15e"}, -] - -[package.dependencies] -filelock = ">=3.15.4" - -[[package]] -name = "python-dotenv" -version = "1.2.4" -description = "Read key-value pairs from a .env file and set them as environment variables" -optional = false -python-versions = ">=3.10" -groups = ["main"] -files = [ - {file = "python_dotenv-1.2.4-py3-none-any.whl", hash = "sha256:42269a8a5b3fd54ffa6f3d84b18abed50064717576b4ecf03dc4a55d8aa04fdc"}, - {file = "python_dotenv-1.2.4.tar.gz", hash = "sha256:f0d53e69935a851c0dcc78f3ab7aaccd8cabef0b92382b576b824212902873c0"}, -] - -[package.extras] -cli = ["click (>=5.0)"] - -[[package]] -name = "python-multipart" -version = "0.0.31" -description = "A streaming multipart parser for Python" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "python_multipart-0.0.31-py3-none-any.whl", hash = "sha256:8408153d68a9773291fc1da39a8b85a50044bddbabd2dd72e9229776b7b15e28"}, - {file = "python_multipart-0.0.31.tar.gz", hash = "sha256:fc631183bb13e56db3158a4909908dfb2e23565286744e798241e63750e5d680"}, -] - -[[package]] -name = "pywin32" -version = "311" -description = "Python for Window Extensions" -optional = true -python-versions = "*" -groups = ["main"] -markers = "extra == \"mcp\" and sys_platform == \"win32\"" -files = [ - {file = "pywin32-311-cp310-cp310-win32.whl", hash = "sha256:d03ff496d2a0cd4a5893504789d4a15399133fe82517455e78bad62efbb7f0a3"}, - {file = "pywin32-311-cp310-cp310-win_amd64.whl", hash = "sha256:797c2772017851984b97180b0bebe4b620bb86328e8a884bb626156295a63b3b"}, - {file = "pywin32-311-cp310-cp310-win_arm64.whl", hash = "sha256:0502d1facf1fed4839a9a51ccbcc63d952cf318f78ffc00a7e78528ac27d7a2b"}, - {file = "pywin32-311-cp311-cp311-win32.whl", hash = "sha256:184eb5e436dea364dcd3d2316d577d625c0351bf237c4e9a5fabbcfa5a58b151"}, - {file = "pywin32-311-cp311-cp311-win_amd64.whl", hash = "sha256:3ce80b34b22b17ccbd937a6e78e7225d80c52f5ab9940fe0506a1a16f3dab503"}, - {file = "pywin32-311-cp311-cp311-win_arm64.whl", hash = "sha256:a733f1388e1a842abb67ffa8e7aad0e70ac519e09b0f6a784e65a136ec7cefd2"}, - {file = "pywin32-311-cp312-cp312-win32.whl", hash = "sha256:750ec6e621af2b948540032557b10a2d43b0cee2ae9758c54154d711cc852d31"}, - {file = "pywin32-311-cp312-cp312-win_amd64.whl", hash = "sha256:b8c095edad5c211ff31c05223658e71bf7116daa0ecf3ad85f3201ea3190d067"}, - {file = "pywin32-311-cp312-cp312-win_arm64.whl", hash = "sha256:e286f46a9a39c4a18b319c28f59b61de793654af2f395c102b4f819e584b5852"}, - {file = "pywin32-311-cp313-cp313-win32.whl", hash = "sha256:f95ba5a847cba10dd8c4d8fefa9f2a6cf283b8b88ed6178fa8a6c1ab16054d0d"}, - {file = "pywin32-311-cp313-cp313-win_amd64.whl", hash = "sha256:718a38f7e5b058e76aee1c56ddd06908116d35147e133427e59a3983f703a20d"}, - {file = "pywin32-311-cp313-cp313-win_arm64.whl", hash = "sha256:7b4075d959648406202d92a2310cb990fea19b535c7f4a78d3f5e10b926eeb8a"}, - {file = "pywin32-311-cp314-cp314-win32.whl", hash = "sha256:b7a2c10b93f8986666d0c803ee19b5990885872a7de910fc460f9b0c2fbf92ee"}, - {file = "pywin32-311-cp314-cp314-win_amd64.whl", hash = "sha256:3aca44c046bd2ed8c90de9cb8427f581c479e594e99b5c0bb19b29c10fd6cb87"}, - {file = "pywin32-311-cp314-cp314-win_arm64.whl", hash = "sha256:a508e2d9025764a8270f93111a970e1d0fbfc33f4153b388bb649b7eec4f9b42"}, - {file = "pywin32-311-cp38-cp38-win32.whl", hash = "sha256:6c6f2969607b5023b0d9ce2541f8d2cbb01c4f46bc87456017cf63b73f1e2d8c"}, - {file = "pywin32-311-cp38-cp38-win_amd64.whl", hash = "sha256:c8015b09fb9a5e188f83b7b04de91ddca4658cee2ae6f3bc483f0b21a77ef6cd"}, - {file = "pywin32-311-cp39-cp39-win32.whl", hash = "sha256:aba8f82d551a942cb20d4a83413ccbac30790b50efb89a75e4f586ac0bb8056b"}, - {file = "pywin32-311-cp39-cp39-win_amd64.whl", hash = "sha256:e0c4cfb0621281fe40387df582097fd796e80430597cb9944f0ae70447bacd91"}, - {file = "pywin32-311-cp39-cp39-win_arm64.whl", hash = "sha256:62ea666235135fee79bb154e695f3ff67370afefd71bd7fea7512fc70ef31e3d"}, -] - -[[package]] -name = "pywin32-ctypes" -version = "0.2.3" -description = "A (partial) reimplementation of pywin32 using ctypes/cffi" -optional = false -python-versions = ">=3.6" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and sys_platform == \"win32\"" -files = [ - {file = "pywin32-ctypes-0.2.3.tar.gz", hash = "sha256:d162dc04946d704503b2edc4d55f3dba5c1d539ead017afa00142c38b9885755"}, - {file = "pywin32_ctypes-0.2.3-py3-none-any.whl", hash = "sha256:8a1513379d709975552d202d942d9837758905c8d01eb82b8bcc30918929e7b8"}, -] - -[[package]] -name = "pyyaml" -version = "6.0.3" -description = "YAML parser and emitter for Python" -optional = false -python-versions = ">=3.8" -groups = ["main", "dev"] -files = [ - {file = "PyYAML-6.0.3-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f"}, - {file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4"}, - {file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:efd7b85f94a6f21e4932043973a7ba2613b059c4a000551892ac9f1d11f5baf3"}, - {file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:22ba7cfcad58ef3ecddc7ed1db3409af68d023b7f940da23c6c2a1890976eda6"}, - {file = "PyYAML-6.0.3-cp38-cp38-musllinux_1_2_x86_64.whl", hash = "sha256:6344df0d5755a2c9a276d4473ae6b90647e216ab4757f8426893b5dd2ac3f369"}, - {file = "PyYAML-6.0.3-cp38-cp38-win32.whl", hash = "sha256:3ff07ec89bae51176c0549bc4c63aa6202991da2d9a6129d7aef7f1407d3f295"}, - {file = "PyYAML-6.0.3-cp38-cp38-win_amd64.whl", hash = "sha256:5cf4e27da7e3fbed4d6c3d8e797387aaad68102272f8f9752883bc32d61cb87b"}, - {file = "pyyaml-6.0.3-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:214ed4befebe12df36bcc8bc2b64b396ca31be9304b8f59e25c11cf94a4c033b"}, - {file = "pyyaml-6.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:02ea2dfa234451bbb8772601d7b8e426c2bfa197136796224e50e35a78777956"}, - {file = "pyyaml-6.0.3-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:b30236e45cf30d2b8e7b3e85881719e98507abed1011bf463a8fa23e9c3e98a8"}, - {file = "pyyaml-6.0.3-cp310-cp310-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:66291b10affd76d76f54fad28e22e51719ef9ba22b29e1d7d03d6777a9174198"}, - {file = "pyyaml-6.0.3-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9c7708761fccb9397fe64bbc0395abcae8c4bf7b0eac081e12b809bf47700d0b"}, - {file = "pyyaml-6.0.3-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:418cf3f2111bc80e0933b2cd8cd04f286338bb88bdc7bc8e6dd775ebde60b5e0"}, - {file = "pyyaml-6.0.3-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:5e0b74767e5f8c593e8c9b5912019159ed0533c70051e9cce3e8b6aa699fcd69"}, - {file = "pyyaml-6.0.3-cp310-cp310-win32.whl", hash = "sha256:28c8d926f98f432f88adc23edf2e6d4921ac26fb084b028c733d01868d19007e"}, - {file = "pyyaml-6.0.3-cp310-cp310-win_amd64.whl", hash = "sha256:bdb2c67c6c1390b63c6ff89f210c8fd09d9a1217a465701eac7316313c915e4c"}, - {file = "pyyaml-6.0.3-cp311-cp311-macosx_10_13_x86_64.whl", hash = "sha256:44edc647873928551a01e7a563d7452ccdebee747728c1080d881d68af7b997e"}, - {file = "pyyaml-6.0.3-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:652cb6edd41e718550aad172851962662ff2681490a8a711af6a4d288dd96824"}, - {file = "pyyaml-6.0.3-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:10892704fc220243f5305762e276552a0395f7beb4dbf9b14ec8fd43b57f126c"}, - {file = "pyyaml-6.0.3-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:850774a7879607d3a6f50d36d04f00ee69e7fc816450e5f7e58d7f17f1ae5c00"}, - {file = "pyyaml-6.0.3-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b8bb0864c5a28024fac8a632c443c87c5aa6f215c0b126c449ae1a150412f31d"}, - {file = "pyyaml-6.0.3-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1d37d57ad971609cf3c53ba6a7e365e40660e3be0e5175fa9f2365a379d6095a"}, - {file = "pyyaml-6.0.3-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:37503bfbfc9d2c40b344d06b2199cf0e96e97957ab1c1b546fd4f87e53e5d3e4"}, - {file = "pyyaml-6.0.3-cp311-cp311-win32.whl", hash = "sha256:8098f252adfa6c80ab48096053f512f2321f0b998f98150cea9bd23d83e1467b"}, - {file = "pyyaml-6.0.3-cp311-cp311-win_amd64.whl", hash = "sha256:9f3bfb4965eb874431221a3ff3fdcddc7e74e3b07799e0e84ca4a0f867d449bf"}, - {file = "pyyaml-6.0.3-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:7f047e29dcae44602496db43be01ad42fc6f1cc0d8cd6c83d342306c32270196"}, - {file = "pyyaml-6.0.3-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:fc09d0aa354569bc501d4e787133afc08552722d3ab34836a80547331bb5d4a0"}, - {file = "pyyaml-6.0.3-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9149cad251584d5fb4981be1ecde53a1ca46c891a79788c0df828d2f166bda28"}, - {file = "pyyaml-6.0.3-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5fdec68f91a0c6739b380c83b951e2c72ac0197ace422360e6d5a959d8d97b2c"}, - {file = "pyyaml-6.0.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:ba1cc08a7ccde2d2ec775841541641e4548226580ab850948cbfda66a1befcdc"}, - {file = "pyyaml-6.0.3-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8dc52c23056b9ddd46818a57b78404882310fb473d63f17b07d5c40421e47f8e"}, - {file = "pyyaml-6.0.3-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:41715c910c881bc081f1e8872880d3c650acf13dfa8214bad49ed4cede7c34ea"}, - {file = "pyyaml-6.0.3-cp312-cp312-win32.whl", hash = "sha256:96b533f0e99f6579b3d4d4995707cf36df9100d67e0c8303a0c55b27b5f99bc5"}, - {file = "pyyaml-6.0.3-cp312-cp312-win_amd64.whl", hash = "sha256:5fcd34e47f6e0b794d17de1b4ff496c00986e1c83f7ab2fb8fcfe9616ff7477b"}, - {file = "pyyaml-6.0.3-cp312-cp312-win_arm64.whl", hash = "sha256:64386e5e707d03a7e172c0701abfb7e10f0fb753ee1d773128192742712a98fd"}, - {file = "pyyaml-6.0.3-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:8da9669d359f02c0b91ccc01cac4a67f16afec0dac22c2ad09f46bee0697eba8"}, - {file = "pyyaml-6.0.3-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:2283a07e2c21a2aa78d9c4442724ec1eb15f5e42a723b99cb3d822d48f5f7ad1"}, - {file = "pyyaml-6.0.3-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ee2922902c45ae8ccada2c5b501ab86c36525b883eff4255313a253a3160861c"}, - {file = "pyyaml-6.0.3-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a33284e20b78bd4a18c8c2282d549d10bc8408a2a7ff57653c0cf0b9be0afce5"}, - {file = "pyyaml-6.0.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0f29edc409a6392443abf94b9cf89ce99889a1dd5376d94316ae5145dfedd5d6"}, - {file = "pyyaml-6.0.3-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:f7057c9a337546edc7973c0d3ba84ddcdf0daa14533c2065749c9075001090e6"}, - {file = "pyyaml-6.0.3-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:eda16858a3cab07b80edaf74336ece1f986ba330fdb8ee0d6c0d68fe82bc96be"}, - {file = "pyyaml-6.0.3-cp313-cp313-win32.whl", hash = "sha256:d0eae10f8159e8fdad514efdc92d74fd8d682c933a6dd088030f3834bc8e6b26"}, - {file = "pyyaml-6.0.3-cp313-cp313-win_amd64.whl", hash = "sha256:79005a0d97d5ddabfeeea4cf676af11e647e41d81c9a7722a193022accdb6b7c"}, - {file = "pyyaml-6.0.3-cp313-cp313-win_arm64.whl", hash = "sha256:5498cd1645aa724a7c71c8f378eb29ebe23da2fc0d7a08071d89469bf1d2defb"}, - {file = "pyyaml-6.0.3-cp314-cp314-macosx_10_13_x86_64.whl", hash = "sha256:8d1fab6bb153a416f9aeb4b8763bc0f22a5586065f86f7664fc23339fc1c1fac"}, - {file = "pyyaml-6.0.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:34d5fcd24b8445fadc33f9cf348c1047101756fd760b4dacb5c3e99755703310"}, - {file = "pyyaml-6.0.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:501a031947e3a9025ed4405a168e6ef5ae3126c59f90ce0cd6f2bfc477be31b7"}, - {file = "pyyaml-6.0.3-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:b3bc83488de33889877a0f2543ade9f70c67d66d9ebb4ac959502e12de895788"}, - {file = "pyyaml-6.0.3-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c458b6d084f9b935061bc36216e8a69a7e293a2f1e68bf956dcd9e6cbcd143f5"}, - {file = "pyyaml-6.0.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7c6610def4f163542a622a73fb39f534f8c101d690126992300bf3207eab9764"}, - {file = "pyyaml-6.0.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5190d403f121660ce8d1d2c1bb2ef1bd05b5f68533fc5c2ea899bd15f4399b35"}, - {file = "pyyaml-6.0.3-cp314-cp314-win_amd64.whl", hash = "sha256:4a2e8cebe2ff6ab7d1050ecd59c25d4c8bd7e6f400f5f82b96557ac0abafd0ac"}, - {file = "pyyaml-6.0.3-cp314-cp314-win_arm64.whl", hash = "sha256:93dda82c9c22deb0a405ea4dc5f2d0cda384168e466364dec6255b293923b2f3"}, - {file = "pyyaml-6.0.3-cp314-cp314t-macosx_10_13_x86_64.whl", hash = "sha256:02893d100e99e03eda1c8fd5c441d8c60103fd175728e23e431db1b589cf5ab3"}, - {file = "pyyaml-6.0.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c1ff362665ae507275af2853520967820d9124984e0f7466736aea23d8611fba"}, - {file = "pyyaml-6.0.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:6adc77889b628398debc7b65c073bcb99c4a0237b248cacaf3fe8a557563ef6c"}, - {file = "pyyaml-6.0.3-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:a80cb027f6b349846a3bf6d73b5e95e782175e52f22108cfa17876aaeff93702"}, - {file = "pyyaml-6.0.3-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:00c4bdeba853cc34e7dd471f16b4114f4162dc03e6b7afcc2128711f0eca823c"}, - {file = "pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:66e1674c3ef6f541c35191caae2d429b967b99e02040f5ba928632d9a7f0f065"}, - {file = "pyyaml-6.0.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:16249ee61e95f858e83976573de0f5b2893b3677ba71c9dd36b9cf8be9ac6d65"}, - {file = "pyyaml-6.0.3-cp314-cp314t-win_amd64.whl", hash = "sha256:4ad1906908f2f5ae4e5a8ddfce73c320c2a1429ec52eafd27138b7f1cbe341c9"}, - {file = "pyyaml-6.0.3-cp314-cp314t-win_arm64.whl", hash = "sha256:ebc55a14a21cb14062aa4162f906cd962b28e2e9ea38f9b4391244cd8de4ae0b"}, - {file = "pyyaml-6.0.3-cp39-cp39-macosx_10_13_x86_64.whl", hash = "sha256:b865addae83924361678b652338317d1bd7e79b1f4596f96b96c77a5a34b34da"}, - {file = "pyyaml-6.0.3-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c3355370a2c156cffb25e876646f149d5d68f5e0a3ce86a5084dd0b64a994917"}, - {file = "pyyaml-6.0.3-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:3c5677e12444c15717b902a5798264fa7909e41153cdf9ef7ad571b704a63dd9"}, - {file = "pyyaml-6.0.3-cp39-cp39-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:5ed875a24292240029e4483f9d4a4b8a1ae08843b9c54f43fcc11e404532a8a5"}, - {file = "pyyaml-6.0.3-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0150219816b6a1fa26fb4699fb7daa9caf09eb1999f3b70fb6e786805e80375a"}, - {file = "pyyaml-6.0.3-cp39-cp39-musllinux_1_2_aarch64.whl", hash = "sha256:fa160448684b4e94d80416c0fa4aac48967a969efe22931448d853ada8baf926"}, - {file = "pyyaml-6.0.3-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:27c0abcb4a5dac13684a37f76e701e054692a9b2d3064b70f5e4eb54810553d7"}, - {file = "pyyaml-6.0.3-cp39-cp39-win32.whl", hash = "sha256:1ebe39cb5fc479422b83de611d14e2c0d3bb2a18bbcb01f229ab3cfbd8fee7a0"}, - {file = "pyyaml-6.0.3-cp39-cp39-win_amd64.whl", hash = "sha256:2e71d11abed7344e42a8849600193d15b6def118602c4c176f748e4583246007"}, - {file = "pyyaml-6.0.3.tar.gz", hash = "sha256:d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f"}, -] - -[[package]] -name = "readme-renderer" -version = "46.0" -description = "readme_renderer is a library for rendering readme descriptions for Warehouse" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "readme_renderer-46.0-py3-none-any.whl", hash = "sha256:d0dae1f74bb273b534770cb4cccb6bb78735540afdb03c2146f4e19dcd412560"}, - {file = "readme_renderer-46.0.tar.gz", hash = "sha256:af3e964914f6310a33ff67b72a4bdd940bed8d7c3bdecd2d14f40edf284bfe90"}, -] - -[package.dependencies] -docutils = ">=0.21.2" -nh3 = ">=0.2.14" -Pygments = ">=2.5.1" - -[package.extras] -md = ["comrak (>=0.0.13)"] - -[[package]] -name = "referencing" -version = "0.37.0" -description = "JSON Referencing + Python" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231"}, - {file = "referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8"}, -] - -[package.dependencies] -attrs = ">=22.2.0" -rpds-py = ">=0.7.0" -typing-extensions = {version = ">=4.4.0", markers = "python_version < \"3.13\""} - -[[package]] -name = "requests" -version = "2.34.2" -description = "Python HTTP for Humans." -optional = false -python-versions = ">=3.10" -groups = ["main", "dev"] -files = [ - {file = "requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0"}, - {file = "requests-2.34.2.tar.gz", hash = "sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed"}, -] - -[package.dependencies] -certifi = ">=2023.5.7" -charset_normalizer = ">=2,<4" -idna = ">=2.5,<4" -urllib3 = ">=1.26,<3" - -[package.extras] -socks = ["PySocks (>=1.5.6,!=1.5.7)"] -use-chardet-on-py3 = ["chardet (>=3.0.2,<8)"] - -[[package]] -name = "requests-toolbelt" -version = "1.0.0" -description = "A utility belt for advanced users of python-requests" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -groups = ["dev"] -files = [ - {file = "requests-toolbelt-1.0.0.tar.gz", hash = "sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6"}, - {file = "requests_toolbelt-1.0.0-py2.py3-none-any.whl", hash = "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06"}, -] - -[package.dependencies] -requests = ">=2.0.1,<3.0.0" - -[[package]] -name = "rfc3986" -version = "2.0.0" -description = "Validating URI References per RFC 3986" -optional = false -python-versions = ">=3.7" -groups = ["dev"] -files = [ - {file = "rfc3986-2.0.0-py2.py3-none-any.whl", hash = "sha256:50b1502b60e289cb37883f3dfd34532b8873c7de9f49bb546641ce9cbd256ebd"}, - {file = "rfc3986-2.0.0.tar.gz", hash = "sha256:97aacf9dbd4bfd829baad6e6309fa6573aaf1be3f6fa735c8ab05e46cecb261c"}, -] - -[package.extras] -idna2008 = ["idna"] - -[[package]] -name = "rich" -version = "14.3.3" -description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" -optional = false -python-versions = ">=3.8.0" -groups = ["main", "dev"] -files = [ - {file = "rich-14.3.3-py3-none-any.whl", hash = "sha256:793431c1f8619afa7d3b52b2cdec859562b950ea0d4b6b505397612db8d5362d"}, - {file = "rich-14.3.3.tar.gz", hash = "sha256:b8daa0b9e4eef54dd8cf7c86c03713f53241884e814f4e2f5fb342fe520f639b"}, -] -markers = {main = "extra == \"mcp\""} - -[package.dependencies] -markdown-it-py = ">=2.2.0" -pygments = ">=2.13.0,<3.0.0" - -[package.extras] -jupyter = ["ipywidgets (>=7.5.1,<9)"] - -[[package]] -name = "rich-rst" -version = "1.3.2" -description = "A beautiful reStructuredText renderer for rich" -optional = true -python-versions = "*" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "rich_rst-1.3.2-py3-none-any.whl", hash = "sha256:a99b4907cbe118cf9d18b0b44de272efa61f15117c61e39ebdc431baf5df722a"}, - {file = "rich_rst-1.3.2.tar.gz", hash = "sha256:a1196fdddf1e364b02ec68a05e8ff8f6914fee10fbca2e6b6735f166bb0da8d4"}, -] - -[package.dependencies] -docutils = "*" -rich = ">=12.0.0" - -[package.extras] -docs = ["sphinx"] - -[[package]] -name = "rpds-py" -version = "0.30.0" -description = "Python bindings to Rust's persistent data structures (rpds)" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "rpds_py-0.30.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:679ae98e00c0e8d68a7fda324e16b90fd5260945b45d3b824c892cec9eea3288"}, - {file = "rpds_py-0.30.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4cc2206b76b4f576934f0ed374b10d7ca5f457858b157ca52064bdfc26b9fc00"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:389a2d49eded1896c3d48b0136ead37c48e221b391c052fba3f4055c367f60a6"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:32c8528634e1bf7121f3de08fa85b138f4e0dc47657866630611b03967f041d7"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f207f69853edd6f6700b86efb84999651baf3789e78a466431df1331608e5324"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:67b02ec25ba7a9e8fa74c63b6ca44cf5707f2fbfadae3ee8e7494297d56aa9df"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0c0e95f6819a19965ff420f65578bacb0b00f251fefe2c8b23347c37174271f3"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_31_riscv64.whl", hash = "sha256:a452763cc5198f2f98898eb98f7569649fe5da666c2dc6b5ddb10fde5a574221"}, - {file = "rpds_py-0.30.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:e0b65193a413ccc930671c55153a03ee57cecb49e6227204b04fae512eb657a7"}, - {file = "rpds_py-0.30.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:858738e9c32147f78b3ac24dc0edb6610000e56dc0f700fd5f651d0a0f0eb9ff"}, - {file = "rpds_py-0.30.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:da279aa314f00acbb803da1e76fa18666778e8a8f83484fba94526da5de2cba7"}, - {file = "rpds_py-0.30.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:7c64d38fb49b6cdeda16ab49e35fe0da2e1e9b34bc38bd78386530f218b37139"}, - {file = "rpds_py-0.30.0-cp310-cp310-win32.whl", hash = "sha256:6de2a32a1665b93233cde140ff8b3467bdb9e2af2b91079f0333a0974d12d464"}, - {file = "rpds_py-0.30.0-cp310-cp310-win_amd64.whl", hash = "sha256:1726859cd0de969f88dc8673bdd954185b9104e05806be64bcd87badbe313169"}, - {file = "rpds_py-0.30.0-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:a2bffea6a4ca9f01b3f8e548302470306689684e61602aa3d141e34da06cf425"}, - {file = "rpds_py-0.30.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:dc4f992dfe1e2bc3ebc7444f6c7051b4bc13cd8e33e43511e8ffd13bf407010d"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:422c3cb9856d80b09d30d2eb255d0754b23e090034e1deb4083f8004bd0761e4"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:07ae8a593e1c3c6b82ca3292efbe73c30b61332fd612e05abee07c79359f292f"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:12f90dd7557b6bd57f40abe7747e81e0c0b119bef015ea7726e69fe550e394a4"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:99b47d6ad9a6da00bec6aabe5a6279ecd3c06a329d4aa4771034a21e335c3a97"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:33f559f3104504506a44bb666b93a33f5d33133765b0c216a5bf2f1e1503af89"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_31_riscv64.whl", hash = "sha256:946fe926af6e44f3697abbc305ea168c2c31d3e3ef1058cf68f379bf0335a78d"}, - {file = "rpds_py-0.30.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:495aeca4b93d465efde585977365187149e75383ad2684f81519f504f5c13038"}, - {file = "rpds_py-0.30.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d9a0ca5da0386dee0655b4ccdf46119df60e0f10da268d04fe7cc87886872ba7"}, - {file = "rpds_py-0.30.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:8d6d1cc13664ec13c1b84241204ff3b12f9bb82464b8ad6e7a5d3486975c2eed"}, - {file = "rpds_py-0.30.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:3896fa1be39912cf0757753826bc8bdc8ca331a28a7c4ae46b7a21280b06bb85"}, - {file = "rpds_py-0.30.0-cp311-cp311-win32.whl", hash = "sha256:55f66022632205940f1827effeff17c4fa7ae1953d2b74a8581baaefb7d16f8c"}, - {file = "rpds_py-0.30.0-cp311-cp311-win_amd64.whl", hash = "sha256:a51033ff701fca756439d641c0ad09a41d9242fa69121c7d8769604a0a629825"}, - {file = "rpds_py-0.30.0-cp311-cp311-win_arm64.whl", hash = "sha256:47b0ef6231c58f506ef0b74d44e330405caa8428e770fec25329ed2cb971a229"}, - {file = "rpds_py-0.30.0-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a161f20d9a43006833cd7068375a94d035714d73a172b681d8881820600abfad"}, - {file = "rpds_py-0.30.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6abc8880d9d036ecaafe709079969f56e876fcf107f7a8e9920ba6d5a3878d05"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca28829ae5f5d569bb62a79512c842a03a12576375d5ece7d2cadf8abe96ec28"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a1010ed9524c73b94d15919ca4d41d8780980e1765babf85f9a2f90d247153dd"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8d1736cfb49381ba528cd5baa46f82fdc65c06e843dab24dd70b63d09121b3f"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d948b135c4693daff7bc2dcfc4ec57237a29bd37e60c2fabf5aff2bbacf3e2f1"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47f236970bccb2233267d89173d3ad2703cd36a0e2a6e92d0560d333871a3d23"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_31_riscv64.whl", hash = "sha256:2e6ecb5a5bcacf59c3f912155044479af1d0b6681280048b338b28e364aca1f6"}, - {file = "rpds_py-0.30.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a8fa71a2e078c527c3e9dc9fc5a98c9db40bcc8a92b4e8858e36d329f8684b51"}, - {file = "rpds_py-0.30.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:73c67f2db7bc334e518d097c6d1e6fed021bbc9b7d678d6cc433478365d1d5f5"}, - {file = "rpds_py-0.30.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:5ba103fb455be00f3b1c2076c9d4264bfcb037c976167a6047ed82f23153f02e"}, - {file = "rpds_py-0.30.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7cee9c752c0364588353e627da8a7e808a66873672bcb5f52890c33fd965b394"}, - {file = "rpds_py-0.30.0-cp312-cp312-win32.whl", hash = "sha256:1ab5b83dbcf55acc8b08fc62b796ef672c457b17dbd7820a11d6c52c06839bdf"}, - {file = "rpds_py-0.30.0-cp312-cp312-win_amd64.whl", hash = "sha256:a090322ca841abd453d43456ac34db46e8b05fd9b3b4ac0c78bcde8b089f959b"}, - {file = "rpds_py-0.30.0-cp312-cp312-win_arm64.whl", hash = "sha256:669b1805bd639dd2989b281be2cfd951c6121b65e729d9b843e9639ef1fd555e"}, - {file = "rpds_py-0.30.0-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:f83424d738204d9770830d35290ff3273fbb02b41f919870479fab14b9d303b2"}, - {file = "rpds_py-0.30.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e7536cd91353c5273434b4e003cbda89034d67e7710eab8761fd918ec6c69cf8"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2771c6c15973347f50fece41fc447c054b7ac2ae0502388ce3b6738cd366e3d4"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:0a59119fc6e3f460315fe9d08149f8102aa322299deaa5cab5b40092345c2136"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:76fec018282b4ead0364022e3c54b60bf368b9d926877957a8624b58419169b7"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:692bef75a5525db97318e8cd061542b5a79812d711ea03dbc1f6f8dbb0c5f0d2"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9027da1ce107104c50c81383cae773ef5c24d296dd11c99e2629dbd7967a20c6"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_31_riscv64.whl", hash = "sha256:9cf69cdda1f5968a30a359aba2f7f9aa648a9ce4b580d6826437f2b291cfc86e"}, - {file = "rpds_py-0.30.0-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:a4796a717bf12b9da9d3ad002519a86063dcac8988b030e405704ef7d74d2d9d"}, - {file = "rpds_py-0.30.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:5d4c2aa7c50ad4728a094ebd5eb46c452e9cb7edbfdb18f9e1221f597a73e1e7"}, - {file = "rpds_py-0.30.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ba81a9203d07805435eb06f536d95a266c21e5b2dfbf6517748ca40c98d19e31"}, - {file = "rpds_py-0.30.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:945dccface01af02675628334f7cf49c2af4c1c904748efc5cf7bbdf0b579f95"}, - {file = "rpds_py-0.30.0-cp313-cp313-win32.whl", hash = "sha256:b40fb160a2db369a194cb27943582b38f79fc4887291417685f3ad693c5a1d5d"}, - {file = "rpds_py-0.30.0-cp313-cp313-win_amd64.whl", hash = "sha256:806f36b1b605e2d6a72716f321f20036b9489d29c51c91f4dd29a3e3afb73b15"}, - {file = "rpds_py-0.30.0-cp313-cp313-win_arm64.whl", hash = "sha256:d96c2086587c7c30d44f31f42eae4eac89b60dabbac18c7669be3700f13c3ce1"}, - {file = "rpds_py-0.30.0-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:eb0b93f2e5c2189ee831ee43f156ed34e2a89a78a66b98cadad955972548be5a"}, - {file = "rpds_py-0.30.0-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:922e10f31f303c7c920da8981051ff6d8c1a56207dbdf330d9047f6d30b70e5e"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cdc62c8286ba9bf7f47befdcea13ea0e26bf294bda99758fd90535cbaf408000"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:47f9a91efc418b54fb8190a6b4aa7813a23fb79c51f4bb84e418f5476c38b8db"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1f3587eb9b17f3789ad50824084fa6f81921bbf9a795826570bda82cb3ed91f2"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:39c02563fc592411c2c61d26b6c5fe1e51eaa44a75aa2c8735ca88b0d9599daa"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51a1234d8febafdfd33a42d97da7a43f5dcb120c1060e352a3fbc0c6d36e2083"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_31_riscv64.whl", hash = "sha256:eb2c4071ab598733724c08221091e8d80e89064cd472819285a9ab0f24bcedb9"}, - {file = "rpds_py-0.30.0-cp313-cp313t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:6bdfdb946967d816e6adf9a3d8201bfad269c67efe6cefd7093ef959683c8de0"}, - {file = "rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:c77afbd5f5250bf27bf516c7c4a016813eb2d3e116139aed0096940c5982da94"}, - {file = "rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_i686.whl", hash = "sha256:61046904275472a76c8c90c9ccee9013d70a6d0f73eecefd38c1ae7c39045a08"}, - {file = "rpds_py-0.30.0-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:4c5f36a861bc4b7da6516dbdf302c55313afa09b81931e8280361a4f6c9a2d27"}, - {file = "rpds_py-0.30.0-cp313-cp313t-win32.whl", hash = "sha256:3d4a69de7a3e50ffc214ae16d79d8fbb0922972da0356dcf4d0fdca2878559c6"}, - {file = "rpds_py-0.30.0-cp313-cp313t-win_amd64.whl", hash = "sha256:f14fc5df50a716f7ece6a80b6c78bb35ea2ca47c499e422aa4463455dd96d56d"}, - {file = "rpds_py-0.30.0-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:68f19c879420aa08f61203801423f6cd5ac5f0ac4ac82a2368a9fcd6a9a075e0"}, - {file = "rpds_py-0.30.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:ec7c4490c672c1a0389d319b3a9cfcd098dcdc4783991553c332a15acf7249be"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f251c812357a3fed308d684a5079ddfb9d933860fc6de89f2b7ab00da481e65f"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:ac98b175585ecf4c0348fd7b29c3864bda53b805c773cbf7bfdaffc8070c976f"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3e62880792319dbeb7eb866547f2e35973289e7d5696c6e295476448f5b63c87"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4e7fc54e0900ab35d041b0601431b0a0eb495f0851a0639b6ef90f7741b39a18"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47e77dc9822d3ad616c3d5759ea5631a75e5809d5a28707744ef79d7a1bcfcad"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:b4dc1a6ff022ff85ecafef7979a2c6eb423430e05f1165d6688234e62ba99a07"}, - {file = "rpds_py-0.30.0-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4559c972db3a360808309e06a74628b95eaccbf961c335c8fe0d590cf587456f"}, - {file = "rpds_py-0.30.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:0ed177ed9bded28f8deb6ab40c183cd1192aa0de40c12f38be4d59cd33cb5c65"}, - {file = "rpds_py-0.30.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:ad1fa8db769b76ea911cb4e10f049d80bf518c104f15b3edb2371cc65375c46f"}, - {file = "rpds_py-0.30.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:46e83c697b1f1c72b50e5ee5adb4353eef7406fb3f2043d64c33f20ad1c2fc53"}, - {file = "rpds_py-0.30.0-cp314-cp314-win32.whl", hash = "sha256:ee454b2a007d57363c2dfd5b6ca4a5d7e2c518938f8ed3b706e37e5d470801ed"}, - {file = "rpds_py-0.30.0-cp314-cp314-win_amd64.whl", hash = "sha256:95f0802447ac2d10bcc69f6dc28fe95fdf17940367b21d34e34c737870758950"}, - {file = "rpds_py-0.30.0-cp314-cp314-win_arm64.whl", hash = "sha256:613aa4771c99f03346e54c3f038e4cc574ac09a3ddfb0e8878487335e96dead6"}, - {file = "rpds_py-0.30.0-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:7e6ecfcb62edfd632e56983964e6884851786443739dbfe3582947e87274f7cb"}, - {file = "rpds_py-0.30.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:a1d0bc22a7cdc173fedebb73ef81e07faef93692b8c1ad3733b67e31e1b6e1b8"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0d08f00679177226c4cb8c5265012eea897c8ca3b93f429e546600c971bcbae7"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5965af57d5848192c13534f90f9dd16464f3c37aaf166cc1da1cae1fd5a34898"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9a4e86e34e9ab6b667c27f3211ca48f73dba7cd3d90f8d5b11be56e5dbc3fb4e"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e5d3e6b26f2c785d65cc25ef1e5267ccbe1b069c5c21b8cc724efee290554419"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:626a7433c34566535b6e56a1b39a7b17ba961e97ce3b80ec62e6f1312c025551"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:acd7eb3f4471577b9b5a41baf02a978e8bdeb08b4b355273994f8b87032000a8"}, - {file = "rpds_py-0.30.0-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:fe5fa731a1fa8a0a56b0977413f8cacac1768dad38d16b3a296712709476fbd5"}, - {file = "rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:74a3243a411126362712ee1524dfc90c650a503502f135d54d1b352bd01f2404"}, - {file = "rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3e8eeb0544f2eb0d2581774be4c3410356eba189529a6b3e36bbbf9696175856"}, - {file = "rpds_py-0.30.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:dbd936cde57abfee19ab3213cf9c26be06d60750e60a8e4dd85d1ab12c8b1f40"}, - {file = "rpds_py-0.30.0-cp314-cp314t-win32.whl", hash = "sha256:dc824125c72246d924f7f796b4f63c1e9dc810c7d9e2355864b3c3a73d59ade0"}, - {file = "rpds_py-0.30.0-cp314-cp314t-win_amd64.whl", hash = "sha256:27f4b0e92de5bfbc6f86e43959e6edd1425c33b5e69aab0984a72047f2bcf1e3"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:c2262bdba0ad4fc6fb5545660673925c2d2a5d9e2e0fb603aad545427be0fc58"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:ee6af14263f25eedc3bb918a3c04245106a42dfd4f5c2285ea6f997b1fc3f89a"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3adbb8179ce342d235c31ab8ec511e66c73faa27a47e076ccc92421add53e2bb"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:250fa00e9543ac9b97ac258bd37367ff5256666122c2d0f2bc97577c60a1818c"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9854cf4f488b3d57b9aaeb105f06d78e5529d3145b1e4a41750167e8c213c6d3"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:993914b8e560023bc0a8bf742c5f303551992dcb85e247b1e5c7f4a7d145bda5"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:58edca431fb9b29950807e301826586e5bbf24163677732429770a697ffe6738"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_31_riscv64.whl", hash = "sha256:dea5b552272a944763b34394d04577cf0f9bd013207bc32323b5a89a53cf9c2f"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:ba3af48635eb83d03f6c9735dfb21785303e73d22ad03d489e88adae6eab8877"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_aarch64.whl", hash = "sha256:dff13836529b921e22f15cb099751209a60009731a68519630a24d61f0b1b30a"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:1b151685b23929ab7beec71080a8889d4d6d9fa9a983d213f07121205d48e2c4"}, - {file = "rpds_py-0.30.0-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:ac37f9f516c51e5753f27dfdef11a88330f04de2d564be3991384b2f3535d02e"}, - {file = "rpds_py-0.30.0.tar.gz", hash = "sha256:dd8ff7cf90014af0c0f787eea34794ebf6415242ee1d6fa91eaba725cc441e84"}, -] - -[[package]] -name = "secretstorage" -version = "3.5.0" -description = "Python bindings to FreeDesktop.org Secret Service API" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and sys_platform == \"linux\"" -files = [ - {file = "secretstorage-3.5.0-py3-none-any.whl", hash = "sha256:0ce65888c0725fcb2c5bc0fdb8e5438eece02c523557ea40ce0703c266248137"}, - {file = "secretstorage-3.5.0.tar.gz", hash = "sha256:f04b8e4689cbce351744d5537bf6b1329c6fc68f91fa666f60a380edddcd11be"}, -] - -[package.dependencies] -cryptography = ">=2.0" -jeepney = ">=0.6" - -[[package]] -name = "sse-starlette" -version = "3.3.3" -description = "SSE plugin for Starlette" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "sse_starlette-3.3.3-py3-none-any.whl", hash = "sha256:c5abb5082a1cc1c6294d89c5290c46b5f67808cfdb612b7ec27e8ba061c22e8d"}, - {file = "sse_starlette-3.3.3.tar.gz", hash = "sha256:72a95d7575fd5129bd0ae15275ac6432bb35ac542fdebb82889c24bb9f3f4049"}, -] - -[package.dependencies] -anyio = ">=4.7.0" -starlette = ">=0.49.1" - -[package.extras] -daphne = ["daphne (>=4.2.0)"] -examples = ["aiosqlite (>=0.21.0)", "fastapi (>=0.115.12)", "sqlalchemy[asyncio] (>=2.0.41)", "uvicorn (>=0.34.0)"] -granian = ["granian (>=2.3.1)"] -uvicorn = ["uvicorn (>=0.34.0)"] - -[[package]] -name = "starlette" -version = "1.3.1" -description = "The little ASGI library that shines." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "starlette-1.3.1-py3-none-any.whl", hash = "sha256:c7372aae11c3c3f26a42df7bd626cec2f47d03483d261d369516a615a53714c6"}, - {file = "starlette-1.3.1.tar.gz", hash = "sha256:05d0213193f2fbaae60e2ecb593b4add4262ad4e46536b54abe36f11a71724e0"}, -] - -[package.dependencies] -anyio = ">=3.6.2,<5" -typing-extensions = {version = ">=4.10.0", markers = "python_version < \"3.13\""} - -[package.extras] -full = ["httpx (>=0.27.0,<0.29.0)", "httpx2 (>=2.0.0)", "itsdangerous", "jinja2", "python-multipart (>=0.0.18)", "pyyaml"] - -[[package]] -name = "tomli" -version = "2.4.0" -description = "A lil' TOML parser" -optional = false -python-versions = ">=3.8" -groups = ["main", "dev"] -files = [ - {file = "tomli-2.4.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:b5ef256a3fd497d4973c11bf142e9ed78b150d36f5773f1ca6088c230ffc5867"}, - {file = "tomli-2.4.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:5572e41282d5268eb09a697c89a7bee84fae66511f87533a6f88bd2f7b652da9"}, - {file = "tomli-2.4.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:551e321c6ba03b55676970b47cb1b73f14a0a4dce6a3e1a9458fd6d921d72e95"}, - {file = "tomli-2.4.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5e3f639a7a8f10069d0e15408c0b96a2a828cfdec6fca05296ebcdcc28ca7c76"}, - {file = "tomli-2.4.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:1b168f2731796b045128c45982d3a4874057626da0e2ef1fdd722848b741361d"}, - {file = "tomli-2.4.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:133e93646ec4300d651839d382d63edff11d8978be23da4cc106f5a18b7d0576"}, - {file = "tomli-2.4.0-cp311-cp311-win32.whl", hash = "sha256:b6c78bdf37764092d369722d9946cb65b8767bfa4110f902a1b2542d8d173c8a"}, - {file = "tomli-2.4.0-cp311-cp311-win_amd64.whl", hash = "sha256:d3d1654e11d724760cdb37a3d7691f0be9db5fbdaef59c9f532aabf87006dbaa"}, - {file = "tomli-2.4.0-cp311-cp311-win_arm64.whl", hash = "sha256:cae9c19ed12d4e8f3ebf46d1a75090e4c0dc16271c5bce1c833ac168f08fb614"}, - {file = "tomli-2.4.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:920b1de295e72887bafa3ad9f7a792f811847d57ea6b1215154030cf131f16b1"}, - {file = "tomli-2.4.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7d6d9a4aee98fac3eab4952ad1d73aee87359452d1c086b5ceb43ed02ddb16b8"}, - {file = "tomli-2.4.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:36b9d05b51e65b254ea6c2585b59d2c4cb91c8a3d91d0ed0f17591a29aaea54a"}, - {file = "tomli-2.4.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1c8a885b370751837c029ef9bc014f27d80840e48bac415f3412e6593bbc18c1"}, - {file = "tomli-2.4.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8768715ffc41f0008abe25d808c20c3d990f42b6e2e58305d5da280ae7d1fa3b"}, - {file = "tomli-2.4.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:7b438885858efd5be02a9a133caf5812b8776ee0c969fea02c45e8e3f296ba51"}, - {file = "tomli-2.4.0-cp312-cp312-win32.whl", hash = "sha256:0408e3de5ec77cc7f81960c362543cbbd91ef883e3138e81b729fc3eea5b9729"}, - {file = "tomli-2.4.0-cp312-cp312-win_amd64.whl", hash = "sha256:685306e2cc7da35be4ee914fd34ab801a6acacb061b6a7abca922aaf9ad368da"}, - {file = "tomli-2.4.0-cp312-cp312-win_arm64.whl", hash = "sha256:5aa48d7c2356055feef06a43611fc401a07337d5b006be13a30f6c58f869e3c3"}, - {file = "tomli-2.4.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:84d081fbc252d1b6a982e1870660e7330fb8f90f676f6e78b052ad4e64714bf0"}, - {file = "tomli-2.4.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:9a08144fa4cba33db5255f9b74f0b89888622109bd2776148f2597447f92a94e"}, - {file = "tomli-2.4.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c73add4bb52a206fd0c0723432db123c0c75c280cbd67174dd9d2db228ebb1b4"}, - {file = "tomli-2.4.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1fb2945cbe303b1419e2706e711b7113da57b7db31ee378d08712d678a34e51e"}, - {file = "tomli-2.4.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:bbb1b10aa643d973366dc2cb1ad94f99c1726a02343d43cbc011edbfac579e7c"}, - {file = "tomli-2.4.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4cbcb367d44a1f0c2be408758b43e1ffb5308abe0ea222897d6bfc8e8281ef2f"}, - {file = "tomli-2.4.0-cp313-cp313-win32.whl", hash = "sha256:7d49c66a7d5e56ac959cb6fc583aff0651094ec071ba9ad43df785abc2320d86"}, - {file = "tomli-2.4.0-cp313-cp313-win_amd64.whl", hash = "sha256:3cf226acb51d8f1c394c1b310e0e0e61fecdd7adcb78d01e294ac297dd2e7f87"}, - {file = "tomli-2.4.0-cp313-cp313-win_arm64.whl", hash = "sha256:d20b797a5c1ad80c516e41bc1fb0443ddb5006e9aaa7bda2d71978346aeb9132"}, - {file = "tomli-2.4.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:26ab906a1eb794cd4e103691daa23d95c6919cc2fa9160000ac02370cc9dd3f6"}, - {file = "tomli-2.4.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:20cedb4ee43278bc4f2fee6cb50daec836959aadaf948db5172e776dd3d993fc"}, - {file = "tomli-2.4.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:39b0b5d1b6dd03684b3fb276407ebed7090bbec989fa55838c98560c01113b66"}, - {file = "tomli-2.4.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a26d7ff68dfdb9f87a016ecfd1e1c2bacbe3108f4e0f8bcd2228ef9a766c787d"}, - {file = "tomli-2.4.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:20ffd184fb1df76a66e34bd1b36b4a4641bd2b82954befa32fe8163e79f1a702"}, - {file = "tomli-2.4.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:75c2f8bbddf170e8effc98f5e9084a8751f8174ea6ccf4fca5398436e0320bc8"}, - {file = "tomli-2.4.0-cp314-cp314-win32.whl", hash = "sha256:31d556d079d72db7c584c0627ff3a24c5d3fb4f730221d3444f3efb1b2514776"}, - {file = "tomli-2.4.0-cp314-cp314-win_amd64.whl", hash = "sha256:43e685b9b2341681907759cf3a04e14d7104b3580f808cfde1dfdb60ada85475"}, - {file = "tomli-2.4.0-cp314-cp314-win_arm64.whl", hash = "sha256:3d895d56bd3f82ddd6faaff993c275efc2ff38e52322ea264122d72729dca2b2"}, - {file = "tomli-2.4.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:5b5807f3999fb66776dbce568cc9a828544244a8eb84b84b9bafc080c99597b9"}, - {file = "tomli-2.4.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:c084ad935abe686bd9c898e62a02a19abfc9760b5a79bc29644463eaf2840cb0"}, - {file = "tomli-2.4.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0f2e3955efea4d1cfbcb87bc321e00dc08d2bcb737fd1d5e398af111d86db5df"}, - {file = "tomli-2.4.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0e0fe8a0b8312acf3a88077a0802565cb09ee34107813bba1c7cd591fa6cfc8d"}, - {file = "tomli-2.4.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:413540dce94673591859c4c6f794dfeaa845e98bf35d72ed59636f869ef9f86f"}, - {file = "tomli-2.4.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0dc56fef0e2c1c470aeac5b6ca8cc7b640bb93e92d9803ddaf9ea03e198f5b0b"}, - {file = "tomli-2.4.0-cp314-cp314t-win32.whl", hash = "sha256:d878f2a6707cc9d53a1be1414bbb419e629c3d6e67f69230217bb663e76b5087"}, - {file = "tomli-2.4.0-cp314-cp314t-win_amd64.whl", hash = "sha256:2add28aacc7425117ff6364fe9e06a183bb0251b03f986df0e78e974047571fd"}, - {file = "tomli-2.4.0-cp314-cp314t-win_arm64.whl", hash = "sha256:2b1e3b80e1d5e52e40e9b924ec43d81570f0e7d09d11081b797bc4692765a3d4"}, - {file = "tomli-2.4.0-py3-none-any.whl", hash = "sha256:1f776e7d669ebceb01dee46484485f43a4048746235e683bcdffacdf1fb4785a"}, - {file = "tomli-2.4.0.tar.gz", hash = "sha256:aa89c3f6c277dd275d8e243ad24f3b5e701491a860d5121f2cdd399fbb31fc9c"}, -] -markers = {main = "extra == \"mcp\" and python_version == \"3.10\"", dev = "python_version == \"3.10\""} - -[[package]] -name = "truststore" -version = "0.10.4" -description = "Verify certificates using native system trust stores" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\" and sys_platform != \"emscripten\"" -files = [ - {file = "truststore-0.10.4-py3-none-any.whl", hash = "sha256:adaeaecf1cbb5f4de3b1959b42d41f6fab57b2b1666adb59e89cb0b53361d981"}, - {file = "truststore-0.10.4.tar.gz", hash = "sha256:9d91bd436463ad5e4ee4aba766628dd6cd7010cf3e2461756b3303710eebc301"}, -] - -[[package]] -name = "twine" -version = "7.0.0" -description = "Collection of utilities for publishing packages on PyPI" -optional = false -python-versions = ">=3.10" -groups = ["dev"] -files = [ - {file = "twine-7.0.0-py3-none-any.whl", hash = "sha256:b854164df26db268af05f49aa5c0344b10e27a494343ff05b1e0bad3b135f5a7"}, - {file = "twine-7.0.0.tar.gz", hash = "sha256:85cdb29c518efef867360ae4acd4b0dfd61c8654a22fca08e6f8539f05022177"}, -] - -[package.dependencies] -id = "*" -keyring = {version = ">=21.2.0", markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\""} -packaging = ">=26.1" -readme-renderer = ">=35.0" -requests = ">=2.20" -requests-toolbelt = ">=0.8.0,!=0.9.0" -rfc3986 = ">=1.4.0" -rich = ">=14.3.3" -urllib3 = ">=1.26.0" - -[package.extras] -keyring = ["keyring (>=21.2.0)"] - -[[package]] -name = "typing-extensions" -version = "4.16.0" -description = "Backported and Experimental Type Hints for Python 3.9+" -optional = true -python-versions = ">=3.9" -groups = ["main", "dev"] -files = [ - {file = "typing_extensions-4.16.0-py3-none-any.whl", hash = "sha256:481caa481374e813c1b176ada14e97f1f67a4539ce9cfeb3f350d78d6370c2e8"}, - {file = "typing_extensions-4.16.0.tar.gz", hash = "sha256:dc983d19a509c94dba722ee6abd33940f7c05a89e243c47e907eb4db6f1a43e5"}, -] -markers = {main = "extra == \"mcp\"", dev = "python_version == \"3.10\""} - -[[package]] -name = "typing-inspection" -version = "0.4.2" -description = "Runtime typing introspection tools" -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7"}, - {file = "typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464"}, -] - -[package.dependencies] -typing-extensions = ">=4.12.0" - -[[package]] -name = "uncalled-for" -version = "0.4.0" -description = "Async dependency injection for Python functions" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "uncalled_for-0.4.0-py3-none-any.whl", hash = "sha256:16c4bb3337532e4bd5569adc192285976f3ad5305402256d34c67a12b5c968bd"}, - {file = "uncalled_for-0.4.0.tar.gz", hash = "sha256:335b95bd2422332ec210d518f314a16e4c640921c39fc8bf2ad095bd3538f4af"}, -] - -[[package]] -name = "urllib3" -version = "2.8.0" -description = "HTTP library with thread-safe connection pooling, file post, and more." -optional = false -python-versions = ">=3.10" -groups = ["main", "dev"] -files = [ - {file = "urllib3-2.8.0-py3-none-any.whl", hash = "sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3"}, - {file = "urllib3-2.8.0.tar.gz", hash = "sha256:63bf2ead4c879426ebf22ef2a781eeb4aa3b4ae798a0435506f8687fd5bb9b63"}, -] - -[package.extras] -brotli = ["brotli (>=1.2.0) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=1.2.0.0) ; platform_python_implementation != \"CPython\""] -h2 = ["h2 (>=4,<5)"] -socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] -zstd = ["backports-zstd (>=1.0.0) ; python_version < \"3.14\""] - -[[package]] -name = "uvicorn" -version = "0.42.0" -description = "The lightning-fast ASGI server." -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "uvicorn-0.42.0-py3-none-any.whl", hash = "sha256:96c30f5c7abe6f74ae8900a70e92b85ad6613b745d4879eb9b16ccad15645359"}, - {file = "uvicorn-0.42.0.tar.gz", hash = "sha256:9b1f190ce15a2dd22e7758651d9b6d12df09a13d51ba5bf4fc33c383a48e1775"}, -] - -[package.dependencies] -click = ">=7.0" -h11 = ">=0.8" -typing-extensions = {version = ">=4.0", markers = "python_version < \"3.11\""} - -[package.extras] -standard = ["colorama (>=0.4) ; sys_platform == \"win32\"", "httptools (>=0.6.3)", "python-dotenv (>=0.13)", "pyyaml (>=5.1)", "uvloop (>=0.15.1) ; sys_platform != \"win32\" and sys_platform != \"cygwin\" and platform_python_implementation != \"PyPy\"", "watchfiles (>=0.20)", "websockets (>=10.4)"] - -[[package]] -name = "virtualenv" -version = "21.14.13" -description = "Virtual Python Environment builder" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -files = [ - {file = "virtualenv-21.14.13-py3-none-any.whl", hash = "sha256:5fbb04138a4861580b78ba9110d529a26bc48fcc93c8ec36bc0202eeed96a788"}, - {file = "virtualenv-21.14.13.tar.gz", hash = "sha256:de5307ba4b9a0001d9c8ea02832d38f63ca432880f416c1bface61c4323fd905"}, -] - -[package.dependencies] -distlib = ">=0.4.3,<1" -filelock = {version = ">=3.24.2,<5", markers = "python_version >= \"3.10\""} -packaging = ">=26.3" -platformdirs = ">=4.4,<5" -python-discovery = ">=1.6.1" -typing-extensions = {version = ">=4.16", markers = "python_version < \"3.11\""} - -[[package]] -name = "watchfiles" -version = "1.1.1" -description = "Simple, modern and high performance file watching and code reload in python." -optional = true -python-versions = ">=3.9" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "watchfiles-1.1.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:eef58232d32daf2ac67f42dea51a2c80f0d03379075d44a587051e63cc2e368c"}, - {file = "watchfiles-1.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:03fa0f5237118a0c5e496185cafa92878568b652a2e9a9382a5151b1a0380a43"}, - {file = "watchfiles-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8ca65483439f9c791897f7db49202301deb6e15fe9f8fe2fed555bf986d10c31"}, - {file = "watchfiles-1.1.1-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f0ab1c1af0cb38e3f598244c17919fb1a84d1629cc08355b0074b6d7f53138ac"}, - {file = "watchfiles-1.1.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3bc570d6c01c206c46deb6e935a260be44f186a2f05179f52f7fcd2be086a94d"}, - {file = "watchfiles-1.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e84087b432b6ac94778de547e08611266f1f8ffad28c0ee4c82e028b0fc5966d"}, - {file = "watchfiles-1.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:620bae625f4cb18427b1bb1a2d9426dc0dd5a5ba74c7c2cdb9de405f7b129863"}, - {file = "watchfiles-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:544364b2b51a9b0c7000a4b4b02f90e9423d97fbbf7e06689236443ebcad81ab"}, - {file = "watchfiles-1.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:bbe1ef33d45bc71cf21364df962af171f96ecaeca06bd9e3d0b583efb12aec82"}, - {file = "watchfiles-1.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:1a0bb430adb19ef49389e1ad368450193a90038b5b752f4ac089ec6942c4dff4"}, - {file = "watchfiles-1.1.1-cp310-cp310-win32.whl", hash = "sha256:3f6d37644155fb5beca5378feb8c1708d5783145f2a0f1c4d5a061a210254844"}, - {file = "watchfiles-1.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:a36d8efe0f290835fd0f33da35042a1bb5dc0e83cbc092dcf69bce442579e88e"}, - {file = "watchfiles-1.1.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:f57b396167a2565a4e8b5e56a5a1c537571733992b226f4f1197d79e94cf0ae5"}, - {file = "watchfiles-1.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:421e29339983e1bebc281fab40d812742268ad057db4aee8c4d2bce0af43b741"}, - {file = "watchfiles-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6e43d39a741e972bab5d8100b5cdacf69db64e34eb19b6e9af162bccf63c5cc6"}, - {file = "watchfiles-1.1.1-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f537afb3276d12814082a2e9b242bdcf416c2e8fd9f799a737990a1dbe906e5b"}, - {file = "watchfiles-1.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b2cd9e04277e756a2e2d2543d65d1e2166d6fd4c9b183f8808634fda23f17b14"}, - {file = "watchfiles-1.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:5f3f58818dc0b07f7d9aa7fe9eb1037aecb9700e63e1f6acfed13e9fef648f5d"}, - {file = "watchfiles-1.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9bb9f66367023ae783551042d31b1d7fd422e8289eedd91f26754a66f44d5cff"}, - {file = "watchfiles-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aebfd0861a83e6c3d1110b78ad54704486555246e542be3e2bb94195eabb2606"}, - {file = "watchfiles-1.1.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:5fac835b4ab3c6487b5dbad78c4b3724e26bcc468e886f8ba8cc4306f68f6701"}, - {file = "watchfiles-1.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:399600947b170270e80134ac854e21b3ccdefa11a9529a3decc1327088180f10"}, - {file = "watchfiles-1.1.1-cp311-cp311-win32.whl", hash = "sha256:de6da501c883f58ad50db3a32ad397b09ad29865b5f26f64c24d3e3281685849"}, - {file = "watchfiles-1.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:35c53bd62a0b885bf653ebf6b700d1bf05debb78ad9292cf2a942b23513dc4c4"}, - {file = "watchfiles-1.1.1-cp311-cp311-win_arm64.whl", hash = "sha256:57ca5281a8b5e27593cb7d82c2ac927ad88a96ed406aa446f6344e4328208e9e"}, - {file = "watchfiles-1.1.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:8c89f9f2f740a6b7dcc753140dd5e1ab9215966f7a3530d0c0705c83b401bd7d"}, - {file = "watchfiles-1.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:bd404be08018c37350f0d6e34676bd1e2889990117a2b90070b3007f172d0610"}, - {file = "watchfiles-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8526e8f916bb5b9a0a777c8317c23ce65de259422bba5b31325a6fa6029d33af"}, - {file = "watchfiles-1.1.1-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2edc3553362b1c38d9f06242416a5d8e9fe235c204a4072e988ce2e5bb1f69f6"}, - {file = "watchfiles-1.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:30f7da3fb3f2844259cba4720c3fc7138eb0f7b659c38f3bfa65084c7fc7abce"}, - {file = "watchfiles-1.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f8979280bdafff686ba5e4d8f97840f929a87ed9cdf133cbbd42f7766774d2aa"}, - {file = "watchfiles-1.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:dcc5c24523771db3a294c77d94771abcfcb82a0e0ee8efd910c37c59ec1b31bb"}, - {file = "watchfiles-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1db5d7ae38ff20153d542460752ff397fcf5c96090c1230803713cf3147a6803"}, - {file = "watchfiles-1.1.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:28475ddbde92df1874b6c5c8aaeb24ad5be47a11f87cde5a28ef3835932e3e94"}, - {file = "watchfiles-1.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:36193ed342f5b9842edd3532729a2ad55c4160ffcfa3700e0d54be496b70dd43"}, - {file = "watchfiles-1.1.1-cp312-cp312-win32.whl", hash = "sha256:859e43a1951717cc8de7f4c77674a6d389b106361585951d9e69572823f311d9"}, - {file = "watchfiles-1.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:91d4c9a823a8c987cce8fa2690923b069966dabb196dd8d137ea2cede885fde9"}, - {file = "watchfiles-1.1.1-cp312-cp312-win_arm64.whl", hash = "sha256:a625815d4a2bdca61953dbba5a39d60164451ef34c88d751f6c368c3ea73d404"}, - {file = "watchfiles-1.1.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:130e4876309e8686a5e37dba7d5e9bc77e6ed908266996ca26572437a5271e18"}, - {file = "watchfiles-1.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:5f3bde70f157f84ece3765b42b4a52c6ac1a50334903c6eaf765362f6ccca88a"}, - {file = "watchfiles-1.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:14e0b1fe858430fc0251737ef3824c54027bedb8c37c38114488b8e131cf8219"}, - {file = "watchfiles-1.1.1-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f27db948078f3823a6bb3b465180db8ebecf26dd5dae6f6180bd87383b6b4428"}, - {file = "watchfiles-1.1.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:059098c3a429f62fc98e8ec62b982230ef2c8df68c79e826e37b895bc359a9c0"}, - {file = "watchfiles-1.1.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:bfb5862016acc9b869bb57284e6cb35fdf8e22fe59f7548858e2f971d045f150"}, - {file = "watchfiles-1.1.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:319b27255aacd9923b8a276bb14d21a5f7ff82564c744235fc5eae58d95422ae"}, - {file = "watchfiles-1.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c755367e51db90e75b19454b680903631d41f9e3607fbd941d296a020c2d752d"}, - {file = "watchfiles-1.1.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:c22c776292a23bfc7237a98f791b9ad3144b02116ff10d820829ce62dff46d0b"}, - {file = "watchfiles-1.1.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:3a476189be23c3686bc2f4321dd501cb329c0a0469e77b7b534ee10129ae6374"}, - {file = "watchfiles-1.1.1-cp313-cp313-win32.whl", hash = "sha256:bf0a91bfb5574a2f7fc223cf95eeea79abfefa404bf1ea5e339c0c1560ae99a0"}, - {file = "watchfiles-1.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:52e06553899e11e8074503c8e716d574adeeb7e68913115c4b3653c53f9bae42"}, - {file = "watchfiles-1.1.1-cp313-cp313-win_arm64.whl", hash = "sha256:ac3cc5759570cd02662b15fbcd9d917f7ecd47efe0d6b40474eafd246f91ea18"}, - {file = "watchfiles-1.1.1-cp313-cp313t-macosx_10_12_x86_64.whl", hash = "sha256:563b116874a9a7ce6f96f87cd0b94f7faf92d08d0021e837796f0a14318ef8da"}, - {file = "watchfiles-1.1.1-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:3ad9fe1dae4ab4212d8c91e80b832425e24f421703b5a42ef2e4a1e215aff051"}, - {file = "watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce70f96a46b894b36eba678f153f052967a0d06d5b5a19b336ab0dbbd029f73e"}, - {file = "watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cb467c999c2eff23a6417e58d75e5828716f42ed8289fe6b77a7e5a91036ca70"}, - {file = "watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:836398932192dae4146c8f6f737d74baeac8b70ce14831a239bdb1ca882fc261"}, - {file = "watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:743185e7372b7bc7c389e1badcc606931a827112fbbd37f14c537320fca08620"}, - {file = "watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:afaeff7696e0ad9f02cbb8f56365ff4686ab205fcf9c4c5b6fdfaaa16549dd04"}, - {file = "watchfiles-1.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3f7eb7da0eb23aa2ba036d4f616d46906013a68caf61b7fdbe42fc8b25132e77"}, - {file = "watchfiles-1.1.1-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:831a62658609f0e5c64178211c942ace999517f5770fe9436be4c2faeba0c0ef"}, - {file = "watchfiles-1.1.1-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:f9a2ae5c91cecc9edd47e041a930490c31c3afb1f5e6d71de3dc671bfaca02bf"}, - {file = "watchfiles-1.1.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:d1715143123baeeaeadec0528bb7441103979a1d5f6fd0e1f915383fea7ea6d5"}, - {file = "watchfiles-1.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:39574d6370c4579d7f5d0ad940ce5b20db0e4117444e39b6d8f99db5676c52fd"}, - {file = "watchfiles-1.1.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7365b92c2e69ee952902e8f70f3ba6360d0d596d9299d55d7d386df84b6941fb"}, - {file = "watchfiles-1.1.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:bfff9740c69c0e4ed32416f013f3c45e2ae42ccedd1167ef2d805c000b6c71a5"}, - {file = "watchfiles-1.1.1-cp314-cp314-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b27cf2eb1dda37b2089e3907d8ea92922b673c0c427886d4edc6b94d8dfe5db3"}, - {file = "watchfiles-1.1.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:526e86aced14a65a5b0ec50827c745597c782ff46b571dbfe46192ab9e0b3c33"}, - {file = "watchfiles-1.1.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:04e78dd0b6352db95507fd8cb46f39d185cf8c74e4cf1e4fbad1d3df96faf510"}, - {file = "watchfiles-1.1.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5c85794a4cfa094714fb9c08d4a218375b2b95b8ed1666e8677c349906246c05"}, - {file = "watchfiles-1.1.1-cp314-cp314-musllinux_1_1_aarch64.whl", hash = "sha256:74d5012b7630714b66be7b7b7a78855ef7ad58e8650c73afc4c076a1f480a8d6"}, - {file = "watchfiles-1.1.1-cp314-cp314-musllinux_1_1_x86_64.whl", hash = "sha256:8fbe85cb3201c7d380d3d0b90e63d520f15d6afe217165d7f98c9c649654db81"}, - {file = "watchfiles-1.1.1-cp314-cp314-win32.whl", hash = "sha256:3fa0b59c92278b5a7800d3ee7733da9d096d4aabcfabb9a928918bd276ef9b9b"}, - {file = "watchfiles-1.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:c2047d0b6cea13b3316bdbafbfa0c4228ae593d995030fda39089d36e64fc03a"}, - {file = "watchfiles-1.1.1-cp314-cp314-win_arm64.whl", hash = "sha256:842178b126593addc05acf6fce960d28bc5fae7afbaa2c6c1b3a7b9460e5be02"}, - {file = "watchfiles-1.1.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:88863fbbc1a7312972f1c511f202eb30866370ebb8493aef2812b9ff28156a21"}, - {file = "watchfiles-1.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:55c7475190662e202c08c6c0f4d9e345a29367438cf8e8037f3155e10a88d5a5"}, - {file = "watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3f53fa183d53a1d7a8852277c92b967ae99c2d4dcee2bfacff8868e6e30b15f7"}, - {file = "watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:6aae418a8b323732fa89721d86f39ec8f092fc2af67f4217a2b07fd3e93c6101"}, - {file = "watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f096076119da54a6080e8920cbdaac3dbee667eb91dcc5e5b78840b87415bd44"}, - {file = "watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:00485f441d183717038ed2e887a7c868154f216877653121068107b227a2f64c"}, - {file = "watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a55f3e9e493158d7bfdb60a1165035f1cf7d320914e7b7ea83fe22c6023b58fc"}, - {file = "watchfiles-1.1.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8c91ed27800188c2ae96d16e3149f199d62f86c7af5f5f4d2c61a3ed8cd3666c"}, - {file = "watchfiles-1.1.1-cp314-cp314t-musllinux_1_1_aarch64.whl", hash = "sha256:311ff15a0bae3714ffb603e6ba6dbfba4065ab60865d15a6ec544133bdb21099"}, - {file = "watchfiles-1.1.1-cp314-cp314t-musllinux_1_1_x86_64.whl", hash = "sha256:a916a2932da8f8ab582f242c065f5c81bed3462849ca79ee357dd9551b0e9b01"}, - {file = "watchfiles-1.1.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:c882d69f6903ef6092bedfb7be973d9319940d56b8427ab9187d1ecd73438a70"}, - {file = "watchfiles-1.1.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:d6ff426a7cb54f310d51bfe83fe9f2bbe40d540c741dc974ebc30e6aa238f52e"}, - {file = "watchfiles-1.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:79ff6c6eadf2e3fc0d7786331362e6ef1e51125892c75f1004bd6b52155fb956"}, - {file = "watchfiles-1.1.1-cp39-cp39-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c1f5210f1b8fc91ead1283c6fd89f70e76fb07283ec738056cf34d51e9c1d62c"}, - {file = "watchfiles-1.1.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:b9c4702f29ca48e023ffd9b7ff6b822acdf47cb1ff44cb490a3f1d5ec8987e9c"}, - {file = "watchfiles-1.1.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:acb08650863767cbc58bca4813b92df4d6c648459dcaa3d4155681962b2aa2d3"}, - {file = "watchfiles-1.1.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:08af70fd77eee58549cd69c25055dc344f918d992ff626068242259f98d598a2"}, - {file = "watchfiles-1.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c3631058c37e4a0ec440bf583bc53cdbd13e5661bb6f465bc1d88ee9a0a4d02"}, - {file = "watchfiles-1.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:cf57a27fb986c6243d2ee78392c503826056ffe0287e8794503b10fb51b881be"}, - {file = "watchfiles-1.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d7e7067c98040d646982daa1f37a33d3544138ea155536c2e0e63e07ff8a7e0f"}, - {file = "watchfiles-1.1.1-cp39-cp39-win32.whl", hash = "sha256:6c9c9262f454d1c4d8aaa7050121eb4f3aea197360553699520767daebf2180b"}, - {file = "watchfiles-1.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:74472234c8370669850e1c312490f6026d132ca2d396abfad8830b4f1c096957"}, - {file = "watchfiles-1.1.1-pp310-pypy310_pp73-macosx_10_12_x86_64.whl", hash = "sha256:17ef139237dfced9da49fb7f2232c86ca9421f666d78c264c7ffca6601d154c3"}, - {file = "watchfiles-1.1.1-pp310-pypy310_pp73-macosx_11_0_arm64.whl", hash = "sha256:672b8adf25b1a0d35c96b5888b7b18699d27d4194bac8beeae75be4b7a3fc9b2"}, - {file = "watchfiles-1.1.1-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:77a13aea58bc2b90173bc69f2a90de8e282648939a00a602e1dc4ee23e26b66d"}, - {file = "watchfiles-1.1.1-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0b495de0bb386df6a12b18335a0285dda90260f51bdb505503c02bcd1ce27a8b"}, - {file = "watchfiles-1.1.1-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:db476ab59b6765134de1d4fe96a1a9c96ddf091683599be0f26147ea1b2e4b88"}, - {file = "watchfiles-1.1.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:89eef07eee5e9d1fda06e38822ad167a044153457e6fd997f8a858ab7564a336"}, - {file = "watchfiles-1.1.1-pp311-pypy311_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ce19e06cbda693e9e7686358af9cd6f5d61312ab8b00488bc36f5aabbaf77e24"}, - {file = "watchfiles-1.1.1-pp311-pypy311_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3e6f39af2eab0118338902798b5aa6664f46ff66bc0280de76fca67a7f262a49"}, - {file = "watchfiles-1.1.1-pp39-pypy39_pp73-macosx_10_12_x86_64.whl", hash = "sha256:cdab464fee731e0884c35ae3588514a9bcf718d0e2c82169c1c4a85cc19c3c7f"}, - {file = "watchfiles-1.1.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:3dbd8cbadd46984f802f6d479b7e3afa86c42d13e8f0f322d669d79722c8ec34"}, - {file = "watchfiles-1.1.1-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5524298e3827105b61951a29c3512deb9578586abf3a7c5da4a8069df247cccc"}, - {file = "watchfiles-1.1.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4b943d3668d61cfa528eb949577479d3b077fd25fb83c641235437bc0b5bc60e"}, - {file = "watchfiles-1.1.1.tar.gz", hash = "sha256:a173cb5c16c4f40ab19cecf48a534c409f7ea983ab8fed0741304a1c0a31b3f2"}, -] - -[package.dependencies] -anyio = ">=3.0.0" - -[[package]] -name = "websockets" -version = "16.0" -description = "An implementation of the WebSocket Protocol (RFC 6455 & 7692)" -optional = true -python-versions = ">=3.10" -groups = ["main"] -markers = "extra == \"mcp\"" -files = [ - {file = "websockets-16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:04cdd5d2d1dacbad0a7bf36ccbcd3ccd5a30ee188f2560b7a62a30d14107b31a"}, - {file = "websockets-16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:8ff32bb86522a9e5e31439a58addbb0166f0204d64066fb955265c4e214160f0"}, - {file = "websockets-16.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:583b7c42688636f930688d712885cf1531326ee05effd982028212ccc13e5957"}, - {file = "websockets-16.0-cp310-cp310-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:7d837379b647c0c4c2355c2499723f82f1635fd2c26510e1f587d89bc2199e72"}, - {file = "websockets-16.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:df57afc692e517a85e65b72e165356ed1df12386ecb879ad5693be08fac65dde"}, - {file = "websockets-16.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:2b9f1e0d69bc60a4a87349d50c09a037a2607918746f07de04df9e43252c77a3"}, - {file = "websockets-16.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:335c23addf3d5e6a8633f9f8eda77efad001671e80b95c491dd0924587ece0b3"}, - {file = "websockets-16.0-cp310-cp310-win32.whl", hash = "sha256:37b31c1623c6605e4c00d466c9d633f9b812ea430c11c8a278774a1fde1acfa9"}, - {file = "websockets-16.0-cp310-cp310-win_amd64.whl", hash = "sha256:8e1dab317b6e77424356e11e99a432b7cb2f3ec8c5ab4dabbcee6add48f72b35"}, - {file = "websockets-16.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:31a52addea25187bde0797a97d6fc3d2f92b6f72a9370792d65a6e84615ac8a8"}, - {file = "websockets-16.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:417b28978cdccab24f46400586d128366313e8a96312e4b9362a4af504f3bbad"}, - {file = "websockets-16.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:af80d74d4edfa3cb9ed973a0a5ba2b2a549371f8a741e0800cb07becdd20f23d"}, - {file = "websockets-16.0-cp311-cp311-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:08d7af67b64d29823fed316505a89b86705f2b7981c07848fb5e3ea3020c1abe"}, - {file = "websockets-16.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7be95cfb0a4dae143eaed2bcba8ac23f4892d8971311f1b06f3c6b78952ee70b"}, - {file = "websockets-16.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:d6297ce39ce5c2e6feb13c1a996a2ded3b6832155fcfc920265c76f24c7cceb5"}, - {file = "websockets-16.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:1c1b30e4f497b0b354057f3467f56244c603a79c0d1dafce1d16c283c25f6e64"}, - {file = "websockets-16.0-cp311-cp311-win32.whl", hash = "sha256:5f451484aeb5cafee1ccf789b1b66f535409d038c56966d6101740c1614b86c6"}, - {file = "websockets-16.0-cp311-cp311-win_amd64.whl", hash = "sha256:8d7f0659570eefb578dacde98e24fb60af35350193e4f56e11190787bee77dac"}, - {file = "websockets-16.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:71c989cbf3254fbd5e84d3bff31e4da39c43f884e64f2551d14bb3c186230f00"}, - {file = "websockets-16.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:8b6e209ffee39ff1b6d0fa7bfef6de950c60dfb91b8fcead17da4ee539121a79"}, - {file = "websockets-16.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:86890e837d61574c92a97496d590968b23c2ef0aeb8a9bc9421d174cd378ae39"}, - {file = "websockets-16.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:9b5aca38b67492ef518a8ab76851862488a478602229112c4b0d58d63a7a4d5c"}, - {file = "websockets-16.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e0334872c0a37b606418ac52f6ab9cfd17317ac26365f7f65e203e2d0d0d359f"}, - {file = "websockets-16.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a0b31e0b424cc6b5a04b8838bbaec1688834b2383256688cf47eb97412531da1"}, - {file = "websockets-16.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:485c49116d0af10ac698623c513c1cc01c9446c058a4e61e3bf6c19dff7335a2"}, - {file = "websockets-16.0-cp312-cp312-win32.whl", hash = "sha256:eaded469f5e5b7294e2bdca0ab06becb6756ea86894a47806456089298813c89"}, - {file = "websockets-16.0-cp312-cp312-win_amd64.whl", hash = "sha256:5569417dc80977fc8c2d43a86f78e0a5a22fee17565d78621b6bb264a115d4ea"}, - {file = "websockets-16.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:878b336ac47938b474c8f982ac2f7266a540adc3fa4ad74ae96fea9823a02cc9"}, - {file = "websockets-16.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:52a0fec0e6c8d9a784c2c78276a48a2bdf099e4ccc2a4cad53b27718dbfd0230"}, - {file = "websockets-16.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:e6578ed5b6981005df1860a56e3617f14a6c307e6a71b4fff8c48fdc50f3ed2c"}, - {file = "websockets-16.0-cp313-cp313-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:95724e638f0f9c350bb1c2b0a7ad0e83d9cc0c9259f3ea94e40d7b02a2179ae5"}, - {file = "websockets-16.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c0204dc62a89dc9d50d682412c10b3542d748260d743500a85c13cd1ee4bde82"}, - {file = "websockets-16.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:52ac480f44d32970d66763115edea932f1c5b1312de36df06d6b219f6741eed8"}, - {file = "websockets-16.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:6e5a82b677f8f6f59e8dfc34ec06ca6b5b48bc4fcda346acd093694cc2c24d8f"}, - {file = "websockets-16.0-cp313-cp313-win32.whl", hash = "sha256:abf050a199613f64c886ea10f38b47770a65154dc37181bfaff70c160f45315a"}, - {file = "websockets-16.0-cp313-cp313-win_amd64.whl", hash = "sha256:3425ac5cf448801335d6fdc7ae1eb22072055417a96cc6b31b3861f455fbc156"}, - {file = "websockets-16.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:8cc451a50f2aee53042ac52d2d053d08bf89bcb31ae799cb4487587661c038a0"}, - {file = "websockets-16.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:daa3b6ff70a9241cf6c7fc9e949d41232d9d7d26fd3522b1ad2b4d62487e9904"}, - {file = "websockets-16.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:fd3cb4adb94a2a6e2b7c0d8d05cb94e6f1c81a0cf9dc2694fb65c7e8d94c42e4"}, - {file = "websockets-16.0-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:781caf5e8eee67f663126490c2f96f40906594cb86b408a703630f95550a8c3e"}, - {file = "websockets-16.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:caab51a72c51973ca21fa8a18bd8165e1a0183f1ac7066a182ff27107b71e1a4"}, - {file = "websockets-16.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:19c4dc84098e523fd63711e563077d39e90ec6702aff4b5d9e344a60cb3c0cb1"}, - {file = "websockets-16.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a5e18a238a2b2249c9a9235466b90e96ae4795672598a58772dd806edc7ac6d3"}, - {file = "websockets-16.0-cp314-cp314-win32.whl", hash = "sha256:a069d734c4a043182729edd3e9f247c3b2a4035415a9172fd0f1b71658a320a8"}, - {file = "websockets-16.0-cp314-cp314-win_amd64.whl", hash = "sha256:c0ee0e63f23914732c6d7e0cce24915c48f3f1512ec1d079ed01fc629dab269d"}, - {file = "websockets-16.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:a35539cacc3febb22b8f4d4a99cc79b104226a756aa7400adc722e83b0d03244"}, - {file = "websockets-16.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:b784ca5de850f4ce93ec85d3269d24d4c82f22b7212023c974c401d4980ebc5e"}, - {file = "websockets-16.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:569d01a4e7fba956c5ae4fc988f0d4e187900f5497ce46339c996dbf24f17641"}, - {file = "websockets-16.0-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:50f23cdd8343b984957e4077839841146f67a3d31ab0d00e6b824e74c5b2f6e8"}, - {file = "websockets-16.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:152284a83a00c59b759697b7f9e9cddf4e3c7861dd0d964b472b70f78f89e80e"}, - {file = "websockets-16.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:bc59589ab64b0022385f429b94697348a6a234e8ce22544e3681b2e9331b5944"}, - {file = "websockets-16.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:32da954ffa2814258030e5a57bc73a3635463238e797c7375dc8091327434206"}, - {file = "websockets-16.0-cp314-cp314t-win32.whl", hash = "sha256:5a4b4cc550cb665dd8a47f868c8d04c8230f857363ad3c9caf7a0c3bf8c61ca6"}, - {file = "websockets-16.0-cp314-cp314t-win_amd64.whl", hash = "sha256:b14dc141ed6d2dde437cddb216004bcac6a1df0935d79656387bd41632ba0bbd"}, - {file = "websockets-16.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:349f83cd6c9a415428ee1005cadb5c2c56f4389bc06a9af16103c3bc3dcc8b7d"}, - {file = "websockets-16.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:4a1aba3340a8dca8db6eb5a7986157f52eb9e436b74813764241981ca4888f03"}, - {file = "websockets-16.0-pp311-pypy311_pp73-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:f4a32d1bd841d4bcbffdcb3d2ce50c09c3909fbead375ab28d0181af89fd04da"}, - {file = "websockets-16.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:0298d07ee155e2e9fda5be8a9042200dd2e3bb0b8a38482156576f863a9d457c"}, - {file = "websockets-16.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:a653aea902e0324b52f1613332ddf50b00c06fdaf7e92624fbf8c77c78fa5767"}, - {file = "websockets-16.0-py3-none-any.whl", hash = "sha256:1637db62fad1dc833276dded54215f2c7fa46912301a24bd94d45d46a011ceec"}, - {file = "websockets-16.0.tar.gz", hash = "sha256:5f6261a5e56e8d5c42a4497b364ea24d94d9563e8fbd44e78ac40879c60179b5"}, -] - -[[package]] -name = "zipp" -version = "3.23.0" -description = "Backport of pathlib-compatible object wrapper for zip files" -optional = false -python-versions = ">=3.9" -groups = ["dev"] -markers = "platform_machine != \"ppc64le\" and platform_machine != \"s390x\" and python_version < \"3.12\"" -files = [ - {file = "zipp-3.23.0-py3-none-any.whl", hash = "sha256:071652d6115ed432f5ce1d34c336c0adfd6a884660d1e9712a256d3d3bd4b14e"}, - {file = "zipp-3.23.0.tar.gz", hash = "sha256:a07157588a12518c9d4034df3fbbee09c814741a33ff63c05fa29d26a2404166"}, -] - -[package.extras] -check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] -cover = ["pytest-cov"] -doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] -enabler = ["pytest-enabler (>=2.2)"] -test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more_itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] -type = ["pytest-mypy"] - -[extras] -mcp = ["fastmcp"] - -[metadata] -lock-version = "2.1" -python-versions = ">=3.10,<4.0" -content-hash = "5137c7a7ec80bf19d718edb4132147296993b6f95005787c3f4d9c5f60612b8e" +# This file is automatically @generated by Poetry and should not be changed by hand. + +[[package]] +name = "certifi" +version = "2023.7.22" +description = "Python package for providing Mozilla's CA Bundle." +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "certifi-2023.7.22-py3-none-any.whl", hash = "sha256:92d6037539857d8206b8f6ae472e8b77db8058fec5937a1ef3f54304089edbb9"}, + {file = "certifi-2023.7.22.tar.gz", hash = "sha256:539cc1d13202e33ca466e88b2807e29f4c13049d6d87031a3c110744495cb082"}, +] + +[[package]] +name = "charset-normalizer" +version = "3.3.0" +description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet." +category = "main" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "charset-normalizer-3.3.0.tar.gz", hash = "sha256:63563193aec44bce707e0c5ca64ff69fa72ed7cf34ce6e11d5127555756fd2f6"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:effe5406c9bd748a871dbcaf3ac69167c38d72db8c9baf3ff954c344f31c4cbe"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:4162918ef3098851fcd8a628bf9b6a98d10c380725df9e04caf5ca6dd48c847a"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0570d21da019941634a531444364f2482e8db0b3425fcd5ac0c36565a64142c8"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5707a746c6083a3a74b46b3a631d78d129edab06195a92a8ece755aac25a3f3d"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:278c296c6f96fa686d74eb449ea1697f3c03dc28b75f873b65b5201806346a69"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a4b71f4d1765639372a3b32d2638197f5cd5221b19531f9245fcc9ee62d38f56"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5969baeaea61c97efa706b9b107dcba02784b1601c74ac84f2a532ea079403e"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a3f93dab657839dfa61025056606600a11d0b696d79386f974e459a3fbc568ec"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:db756e48f9c5c607b5e33dd36b1d5872d0422e960145b08ab0ec7fd420e9d649"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:232ac332403e37e4a03d209a3f92ed9071f7d3dbda70e2a5e9cff1c4ba9f0678"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_ppc64le.whl", hash = "sha256:e5c1502d4ace69a179305abb3f0bb6141cbe4714bc9b31d427329a95acfc8bdd"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_s390x.whl", hash = "sha256:2502dd2a736c879c0f0d3e2161e74d9907231e25d35794584b1ca5284e43f596"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:23e8565ab7ff33218530bc817922fae827420f143479b753104ab801145b1d5b"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-win32.whl", hash = "sha256:1872d01ac8c618a8da634e232f24793883d6e456a66593135aeafe3784b0848d"}, + {file = "charset_normalizer-3.3.0-cp310-cp310-win_amd64.whl", hash = "sha256:557b21a44ceac6c6b9773bc65aa1b4cc3e248a5ad2f5b914b91579a32e22204d"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:d7eff0f27edc5afa9e405f7165f85a6d782d308f3b6b9d96016c010597958e63"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6a685067d05e46641d5d1623d7c7fdf15a357546cbb2f71b0ebde91b175ffc3e"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:0d3d5b7db9ed8a2b11a774db2bbea7ba1884430a205dbd54a32d61d7c2a190fa"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2935ffc78db9645cb2086c2f8f4cfd23d9b73cc0dc80334bc30aac6f03f68f8c"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9fe359b2e3a7729010060fbca442ca225280c16e923b37db0e955ac2a2b72a05"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:380c4bde80bce25c6e4f77b19386f5ec9db230df9f2f2ac1e5ad7af2caa70459"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f0d1e3732768fecb052d90d62b220af62ead5748ac51ef61e7b32c266cac9293"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1b2919306936ac6efb3aed1fbf81039f7087ddadb3160882a57ee2ff74fd2382"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:f8888e31e3a85943743f8fc15e71536bda1c81d5aa36d014a3c0c44481d7db6e"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:82eb849f085624f6a607538ee7b83a6d8126df6d2f7d3b319cb837b289123078"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_ppc64le.whl", hash = "sha256:7b8b8bf1189b3ba9b8de5c8db4d541b406611a71a955bbbd7385bbc45fcb786c"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_s390x.whl", hash = "sha256:5adf257bd58c1b8632046bbe43ee38c04e1038e9d37de9c57a94d6bd6ce5da34"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:c350354efb159b8767a6244c166f66e67506e06c8924ed74669b2c70bc8735b1"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-win32.whl", hash = "sha256:02af06682e3590ab952599fbadac535ede5d60d78848e555aa58d0c0abbde786"}, + {file = "charset_normalizer-3.3.0-cp311-cp311-win_amd64.whl", hash = "sha256:86d1f65ac145e2c9ed71d8ffb1905e9bba3a91ae29ba55b4c46ae6fc31d7c0d4"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:3b447982ad46348c02cb90d230b75ac34e9886273df3a93eec0539308a6296d7"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:abf0d9f45ea5fb95051c8bfe43cb40cda383772f7e5023a83cc481ca2604d74e"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:b09719a17a2301178fac4470d54b1680b18a5048b481cb8890e1ef820cb80455"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b3d9b48ee6e3967b7901c052b670c7dda6deb812c309439adaffdec55c6d7b78"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:edfe077ab09442d4ef3c52cb1f9dab89bff02f4524afc0acf2d46be17dc479f5"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3debd1150027933210c2fc321527c2299118aa929c2f5a0a80ab6953e3bd1908"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:86f63face3a527284f7bb8a9d4f78988e3c06823f7bea2bd6f0e0e9298ca0403"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:24817cb02cbef7cd499f7c9a2735286b4782bd47a5b3516a0e84c50eab44b98e"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:c71f16da1ed8949774ef79f4a0260d28b83b3a50c6576f8f4f0288d109777989"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:9cf3126b85822c4e53aa28c7ec9869b924d6fcfb76e77a45c44b83d91afd74f9"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_ppc64le.whl", hash = "sha256:b3b2316b25644b23b54a6f6401074cebcecd1244c0b8e80111c9a3f1c8e83d65"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_s390x.whl", hash = "sha256:03680bb39035fbcffe828eae9c3f8afc0428c91d38e7d61aa992ef7a59fb120e"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4cc152c5dd831641e995764f9f0b6589519f6f5123258ccaca8c6d34572fefa8"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-win32.whl", hash = "sha256:b8f3307af845803fb0b060ab76cf6dd3a13adc15b6b451f54281d25911eb92df"}, + {file = "charset_normalizer-3.3.0-cp312-cp312-win_amd64.whl", hash = "sha256:8eaf82f0eccd1505cf39a45a6bd0a8cf1c70dcfc30dba338207a969d91b965c0"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:dc45229747b67ffc441b3de2f3ae5e62877a282ea828a5bdb67883c4ee4a8810"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2f4a0033ce9a76e391542c182f0d48d084855b5fcba5010f707c8e8c34663d77"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ada214c6fa40f8d800e575de6b91a40d0548139e5dc457d2ebb61470abf50186"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b1121de0e9d6e6ca08289583d7491e7fcb18a439305b34a30b20d8215922d43c"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1063da2c85b95f2d1a430f1c33b55c9c17ffaf5e612e10aeaad641c55a9e2b9d"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:70f1d09c0d7748b73290b29219e854b3207aea922f839437870d8cc2168e31cc"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:250c9eb0f4600361dd80d46112213dff2286231d92d3e52af1e5a6083d10cad9"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:750b446b2ffce1739e8578576092179160f6d26bd5e23eb1789c4d64d5af7dc7"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_ppc64le.whl", hash = "sha256:fc52b79d83a3fe3a360902d3f5d79073a993597d48114c29485e9431092905d8"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_s390x.whl", hash = "sha256:588245972aca710b5b68802c8cad9edaa98589b1b42ad2b53accd6910dad3545"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:e39c7eb31e3f5b1f88caff88bcff1b7f8334975b46f6ac6e9fc725d829bc35d4"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-win32.whl", hash = "sha256:abecce40dfebbfa6abf8e324e1860092eeca6f7375c8c4e655a8afb61af58f2c"}, + {file = "charset_normalizer-3.3.0-cp37-cp37m-win_amd64.whl", hash = "sha256:24a91a981f185721542a0b7c92e9054b7ab4fea0508a795846bc5b0abf8118d4"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:67b8cc9574bb518ec76dc8e705d4c39ae78bb96237cb533edac149352c1f39fe"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:ac71b2977fb90c35d41c9453116e283fac47bb9096ad917b8819ca8b943abecd"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:3ae38d325b512f63f8da31f826e6cb6c367336f95e418137286ba362925c877e"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:542da1178c1c6af8873e143910e2269add130a299c9106eef2594e15dae5e482"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:30a85aed0b864ac88309b7d94be09f6046c834ef60762a8833b660139cfbad13"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aae32c93e0f64469f74ccc730a7cb21c7610af3a775157e50bbd38f816536b38"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:15b26ddf78d57f1d143bdf32e820fd8935d36abe8a25eb9ec0b5a71c82eb3895"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f5d10bae5d78e4551b7be7a9b29643a95aded9d0f602aa2ba584f0388e7a557"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:249c6470a2b60935bafd1d1d13cd613f8cd8388d53461c67397ee6a0f5dce741"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:c5a74c359b2d47d26cdbbc7845e9662d6b08a1e915eb015d044729e92e7050b7"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_ppc64le.whl", hash = "sha256:b5bcf60a228acae568e9911f410f9d9e0d43197d030ae5799e20dca8df588287"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_s390x.whl", hash = "sha256:187d18082694a29005ba2944c882344b6748d5be69e3a89bf3cc9d878e548d5a"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:81bf654678e575403736b85ba3a7867e31c2c30a69bc57fe88e3ace52fb17b89"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-win32.whl", hash = "sha256:85a32721ddde63c9df9ebb0d2045b9691d9750cb139c161c80e500d210f5e26e"}, + {file = "charset_normalizer-3.3.0-cp38-cp38-win_amd64.whl", hash = "sha256:468d2a840567b13a590e67dd276c570f8de00ed767ecc611994c301d0f8c014f"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:e0fc42822278451bc13a2e8626cf2218ba570f27856b536e00cfa53099724828"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:09c77f964f351a7369cc343911e0df63e762e42bac24cd7d18525961c81754f4"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:12ebea541c44fdc88ccb794a13fe861cc5e35d64ed689513a5c03d05b53b7c82"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:805dfea4ca10411a5296bcc75638017215a93ffb584c9e344731eef0dcfb026a"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:96c2b49eb6a72c0e4991d62406e365d87067ca14c1a729a870d22354e6f68115"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:aaf7b34c5bc56b38c931a54f7952f1ff0ae77a2e82496583b247f7c969eb1479"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:619d1c96099be5823db34fe89e2582b336b5b074a7f47f819d6b3a57ff7bdb86"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a0ac5e7015a5920cfce654c06618ec40c33e12801711da6b4258af59a8eff00a"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:93aa7eef6ee71c629b51ef873991d6911b906d7312c6e8e99790c0f33c576f89"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:7966951325782121e67c81299a031f4c115615e68046f79b85856b86ebffc4cd"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_ppc64le.whl", hash = "sha256:02673e456dc5ab13659f85196c534dc596d4ef260e4d86e856c3b2773ce09843"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_s390x.whl", hash = "sha256:c2af80fb58f0f24b3f3adcb9148e6203fa67dd3f61c4af146ecad033024dde43"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:153e7b6e724761741e0974fc4dcd406d35ba70b92bfe3fedcb497226c93b9da7"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-win32.whl", hash = "sha256:d47ecf253780c90ee181d4d871cd655a789da937454045b17b5798da9393901a"}, + {file = "charset_normalizer-3.3.0-cp39-cp39-win_amd64.whl", hash = "sha256:d97d85fa63f315a8bdaba2af9a6a686e0eceab77b3089af45133252618e70884"}, + {file = "charset_normalizer-3.3.0-py3-none-any.whl", hash = "sha256:e46cd37076971c1040fc8c41273a8b3e2c624ce4f2be3f5dfcb7a430c1d3acc2"}, +] + +[[package]] +name = "idna" +version = "3.4" +description = "Internationalized Domain Names in Applications (IDNA)" +category = "main" +optional = false +python-versions = ">=3.5" +files = [ + {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, + {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, +] + +[[package]] +name = "python-dotenv" +version = "0.21.1" +description = "Read key-value pairs from a .env file and set them as environment variables" +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "python-dotenv-0.21.1.tar.gz", hash = "sha256:1c93de8f636cde3ce377292818d0e440b6e45a82f215c3744979151fa8151c49"}, + {file = "python_dotenv-0.21.1-py3-none-any.whl", hash = "sha256:41e12e0318bebc859fcc4d97d4db8d20ad21721a6aa5047dd59f090391cb549a"}, +] + +[package.extras] +cli = ["click (>=5.0)"] + +[[package]] +name = "pyyaml" +version = "6.0.1" +description = "YAML parser and emitter for Python" +category = "main" +optional = false +python-versions = ">=3.6" +files = [ + {file = "PyYAML-6.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a"}, + {file = "PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f"}, + {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, + {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, + {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, + {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, + {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, + {file = "PyYAML-6.0.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab"}, + {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, + {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, + {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, + {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, + {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, + {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, + {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd"}, + {file = "PyYAML-6.0.1-cp36-cp36m-win32.whl", hash = "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585"}, + {file = "PyYAML-6.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa"}, + {file = "PyYAML-6.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3"}, + {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27"}, + {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3"}, + {file = "PyYAML-6.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c"}, + {file = "PyYAML-6.0.1-cp37-cp37m-win32.whl", hash = "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba"}, + {file = "PyYAML-6.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867"}, + {file = "PyYAML-6.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595"}, + {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, + {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, + {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, + {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, + {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, + {file = "PyYAML-6.0.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859"}, + {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, + {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, + {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, + {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, + {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, +] + +[[package]] +name = "requests" +version = "2.31.0" +description = "Python HTTP for Humans." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "requests-2.31.0-py3-none-any.whl", hash = "sha256:58cd2187c01e70e6e26505bca751777aa9f2ee0b7f4300988b709f44e013003f"}, + {file = "requests-2.31.0.tar.gz", hash = "sha256:942c5a758f98d790eaed1a29cb6eefc7ffb0d1cf7af05c3d2791656dbd6ad1e1"}, +] + +[package.dependencies] +certifi = ">=2017.4.17" +charset-normalizer = ">=2,<4" +idna = ">=2.5,<4" +urllib3 = ">=1.21.1,<3" + +[package.extras] +socks = ["PySocks (>=1.5.6,!=1.5.7)"] +use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] + +[[package]] +name = "urllib3" +version = "2.0.6" +description = "HTTP library with thread-safe connection pooling, file post, and more." +category = "main" +optional = false +python-versions = ">=3.7" +files = [ + {file = "urllib3-2.0.6-py3-none-any.whl", hash = "sha256:7a7c7003b000adf9e7ca2a377c9688bbc54ed41b985789ed576570342a375cd2"}, + {file = "urllib3-2.0.6.tar.gz", hash = "sha256:b19e1a85d206b56d7df1d5e683df4a7725252a964e3993648dd0fb5a1c157564"}, +] + +[package.extras] +brotli = ["brotli (>=1.0.9)", "brotlicffi (>=0.8.0)"] +secure = ["certifi", "cryptography (>=1.9)", "idna (>=2.0.0)", "pyopenssl (>=17.1.0)", "urllib3-secure-extra"] +socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"] +zstd = ["zstandard (>=0.18.0)"] + +[metadata] +lock-version = "2.0" +python-versions = "^3.7" +content-hash = "35de245f8f35fd39d3f31a8a83c4097762df0a30fb5cefd8d84464e5ba058680" diff --git a/pyproject.toml b/pyproject.toml index 6c8c1ca..2782b4f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,69 +1,31 @@ -[project] -name = "python-substack" -version = "0.10.0" -description = "Write and safely manage Substack drafts from Markdown with Python, CLI, and MCP." -authors = [ - { name = "Paolo Mazza", email = "mazzapaolo2019@gmail.com" } -] -license = "MIT" -readme = "README.md" -requires-python = ">=3.10,<4.0" -keywords = ["substack", "substack-api", "cli", "newsletter", "publishing", "automation", "mcp"] -classifiers = [ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Topic :: Communications :: Email", - "Topic :: Internet :: WWW/HTTP", - "Topic :: Software Development :: Libraries :: Python Modules" -] -dependencies = [ - "requests>=2.32.0,<3.0.0", - "python-dotenv>=1.2.4,<2.0.0", - "PyYAML>=6.0,<7.0", - "markdown-it-py>=3,<5", - "mdit-py-plugins>=0.5,<0.7" -] - -[project.optional-dependencies] -mcp = [ - "fastmcp>=4.1.6,<5.0.0" -] - -[project.urls] -"Documentation" = "https://ma2za.github.io/python-substack/" -"Changelog" = "https://github.com/ma2za/python-substack/blob/main/CHANGELOG.md" -"Issues" = "https://github.com/ma2za/python-substack/issues" -"Homepage" = "https://github.com/ma2za/python-substack" -"Repository" = "https://github.com/ma2za/python-substack" - -[project.scripts] -substack = "substack.cli:main" -substack-auth-check = "substack.cli:auth_check" -substack-publish-markdown = "substack.cli:publish_markdown" -substack-publish-yaml = "substack.cli:publish_yaml" -substack-mcp = "substack_mcp.mcp_server:main" - -[tool.poetry] -packages = [ - { include = "substack" }, - { include = "substack_mcp" } -] - -[tool.poetry.group.dev.dependencies] -pytest = "^9.1.1" -pre-commit = "^4.6.1" -twine = "^7.0.0" - -[tool.pytest.ini_options] -markers = [ - "live: opt-in tests that call the live Substack service", -] - -[build-system] -requires = ["poetry-core>=2.0.0"] -build-backend = "poetry.core.masonry.api" +[tool.poetry] +name = "python-substack" +version = "0.1.11" +description = "A Python wrapper around the Substack API." +authors = ["Paolo Mazza "] +license = "MIT" +packages = [ + { include = "substack" } +] + +readme = "README.md" + +repository = "https://github.com/ma2za/python-substack" +homepage = "https://github.com/ma2za/python-substack" + +keywords = ["substack"] + +[tool.poetry.dependencies] +python = "^3.7" + +requests = "^2.31.0" +python-dotenv = "^0.21.0" +PyYAML = "^6.0" + + +[tool.poetry.dev-dependencies] + + +[build-system] +requires = ["poetry-core>=1.0.0"] +build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/scripts/codex-cloud-setup.sh b/scripts/codex-cloud-setup.sh deleted file mode 100644 index 6fb9590..0000000 --- a/scripts/codex-cloud-setup.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -euo pipefail - -cd "$(dirname "${BASH_SOURCE[0]}")/.." -python3 -c 'import sys; assert (3, 10) <= sys.version_info < (4, 0), "Python 3.10 or newer is required"' -python3 -m venv .tools/poetry -.tools/poetry/bin/python -m pip install poetry==2.3.2 -export POETRY_VIRTUALENVS_IN_PROJECT=true -.tools/poetry/bin/python -m poetry install --with dev --all-extras -.tools/poetry/bin/python -m poetry run pre-commit install diff --git a/substack/__init__.py b/substack/__init__.py index e9faa53..0d8268f 100644 --- a/substack/__init__.py +++ b/substack/__init__.py @@ -1,13 +1,11 @@ -"""A library that provides a Python interface to the Substack API.""" - -__author__ = "Paolo Mazza" -__email__ = "mazzapaolo2019@gmail.com" -__license__ = "MIT License" -__version__ = "0.10.0" -__url__ = "https://github.com/ma2za/python-substack" -__download_url__ = "https://pypi.python.org/pypi/python-substack" -__description__ = ( - "Write and safely manage Substack drafts from Markdown with Python, CLI, and MCP." -) - -from .api import Api +"""A library that provides a Python interface to the Substack API.""" + +__author__ = "Paolo Mazza" +__email__ = "mazzapaolo2019@gmail.com" +__license__ = "MIT License" +__version__ = "1.0" +__url__ = "https://github.com/ma2za/python-substack" +__download_url__ = "https://pypi.python.org/pypi/python-substack" +__description__ = "A Python wrapper around the Substack API" + +from .api import Api diff --git a/substack/api.py b/substack/api.py index 467347c..27b9bac 100644 --- a/substack/api.py +++ b/substack/api.py @@ -1,1128 +1,347 @@ -""" - -API Wrapper - -""" - -import base64 -import json -import logging -import os -from datetime import datetime -from urllib.parse import unquote, urljoin - -import requests -from requests.adapters import HTTPAdapter, Retry - -from substack.exceptions import SubstackAPIException, SubstackRequestException - -logger = logging.getLogger(__name__) - -__all__ = ["Api"] - - -def _image_attrs(document): - images = [] - if isinstance(document, dict): - if document.get("type") == "image2" and isinstance(document.get("attrs"), dict): - images.append(document["attrs"]) - for value in document.values(): - images.extend(_image_attrs(value)) - elif isinstance(document, list): - for value in document: - images.extend(_image_attrs(value)) - return images - - -class Api: - """ - - A python interface into the Substack API - - """ - - def __init__( - self, - email=None, - password=None, - cookies_path=None, - base_url=None, - publication_url=None, - debug=False, - cookies_string=None, - timeout=None, - ): - """ - - To create an instance of the substack.Api class: - >>> import substack - >>> api = substack.Api(email="substack email", password="substack password") - - Args: - email: - password: - cookies_path - To re-use your session without logging in each time, you can save your cookies to a json file and - then load them in the next session. - Make sure to re-save your cookies, as they do update over time. - cookies_string - To re-use your session without logging in each time, you can provide cookies as a semicolon-separated - string (e.g., "cookie1=value1; cookie2=value2"). This is useful when copying cookies from browser - developer tools. - base_url: - The base URL to use to contact the Substack API. - Defaults to https://substack.com/api/v1. - """ - self.base_url = base_url or "https://substack.com/api/v1" - - if debug: - logging.basicConfig() - logging.getLogger().setLevel(logging.DEBUG) - - self.timeout = timeout - - self._session = requests.Session() - original_request = self._session.request - - def _request_with_timeout(*args, **kwargs): - if kwargs.get("timeout") is None and self.timeout is not None: - kwargs["timeout"] = self.timeout - return original_request(*args, **kwargs) - - self._session.request = _request_with_timeout - - retry = Retry( - total=4, - status=4, - backoff_factor=1, - status_forcelist=(429,), - allowed_methods=frozenset({"GET", "DELETE"}), - respect_retry_after_header=True, - raise_on_status=False, - ) - adapter = HTTPAdapter(max_retries=retry) - self._session.mount("http://", adapter) - self._session.mount("https://", adapter) - - # Load cookies from file if provided - # Helps with Captcha errors by reusing cookies from "local" auth, then switching to running code in the cloud - if cookies_path is not None: - with open(cookies_path) as f: - cookies = json.load(f) - self._session.cookies.update(cookies) - - elif cookies_string is not None: - cookies = self._parse_cookies_string(cookies_string) - self._session.cookies.update(cookies) - - elif email is not None and password is not None: - self.login(email, password) - else: - raise ValueError( - "Must provide email and password, cookies_path, or cookies_string to authenticate." - ) - - user_publication = None - # if the user provided a publication url, then use that - if publication_url: - from urllib.parse import urlparse - - # Normalize requested URL - parsed_req = urlparse(publication_url.lower()) - req_hostname = parsed_req.hostname or parsed_req.path - # Strip trailing slashes and www. - req_hostname = req_hostname.strip("/").replace("www.", "", 1) - - user_publications = self.get_user_publications() - for publication in user_publications: - pub_url = Api.get_publication_url(publication).lower() - parsed_pub = urlparse(pub_url) - pub_hostname = parsed_pub.hostname or parsed_pub.path - pub_hostname = pub_hostname.strip("/").replace("www.", "", 1) - - if req_hostname == pub_hostname: - user_publication = publication - break - - if user_publication is None: - raise SubstackRequestException( - f"Requested publication is unavailable: {publication_url}" - ) - else: - # get the users primary publication - user_publication = self.get_user_primary_publication() - if user_publication is None: - raise SubstackRequestException( - "Could not find primary publication in profile" - ) - - # set the current publication to the users primary publication - self.change_publication(user_publication) - - @staticmethod - def _parse_cookies_string(cookies_string: str) -> dict: - """ - Parse a semicolon-separated cookie string into a dictionary. - - Args: - cookies_string: A semicolon-separated string of cookies (e.g., "cookie1=value1; cookie2=value2") - - Returns: - A dictionary of cookie name-value pairs - """ - cookies = {} - for cookie_pair in cookies_string.split(";"): - cookie_pair = cookie_pair.strip() - if not cookie_pair: - continue - if "=" in cookie_pair: - key, value = cookie_pair.split("=", 1) - key = key.strip() - value = value.strip() - # URL decode the value (e.g., s%3A becomes s:) - value = unquote(value) - cookies[key] = value - return cookies - - @staticmethod - def _normalize_tags(tags): - if tags is None: - return [] - if isinstance(tags, str): - return [tags] - return [str(tag) for tag in tags] - - def login(self, email, password) -> dict: - """ - - Login to the substack account. - - Args: - email: substack account email - password: substack account password - """ - - response = self._session.post( - f"{self.base_url}/login", - json={ - "captcha_response": None, - "email": email, - "for_pub": "", - "password": password, - "redirect": "/", - }, - ) - - return Api._handle_response(response=response) - - def signin_for_pub(self, publication): - """ - Complete the signin process - """ - response = self._session.get( - f"https://substack.com/sign-in?redirect=%2F&for_pub={publication['subdomain']}", - ) - try: - output = Api._handle_response(response=response) - except SubstackRequestException as ex: - output = {} - return output - - def change_publication(self, publication): - """ - Change the publication URL - """ - self.publication_url = urljoin(publication["publication_url"], "api/v1") - - # sign-in to the publication - self.signin_for_pub(publication) - - def export_cookies(self, path: str = "cookies.json"): - """ - Export cookies to a json file. - Args: - path: path to the json file - """ - cookies = self._session.cookies.get_dict() - with open(path, "w") as f: - json.dump(cookies, f) - - @staticmethod - def _handle_response(response: requests.Response): - """ - - Internal helper for handling API responses from the Substack server. - Raises the appropriate exceptions when necessary; otherwise, returns the - response. - - """ - - if not (200 <= response.status_code < 300): - raise SubstackAPIException(response.status_code, response.text) - try: - return response.json() - except ValueError: - raise SubstackRequestException("Invalid Response: %s" % response.text) - - def get_user_id(self): - """ - - Returns: - - """ - profile = self.get_user_profile() - user_id = profile["id"] - - return user_id - - @staticmethod - def get_publication_url(publication: dict) -> str: - """ - Gets the publication url - - Args: - publication: - """ - custom_domain = publication.get("custom_domain", None) - if not custom_domain and not publication.get("custom_domain_optional", None): - publication_url = f"https://{publication['subdomain']}.substack.com" - else: - publication_url = f"https://{custom_domain}" - - return publication_url - - def get_user_primary_publication(self): - """ - Gets the users primary publication - """ - - profile = self.get_user_profile() - primary_publication = None - - # Try old API format first (backward compatibility) - if ( - "primaryPublication" in profile - and profile["primaryPublication"] is not None - ): - primary_publication = profile["primaryPublication"] - else: - # New API format: look for primary publication in publicationUsers - publication_users = profile.get("publicationUsers") - if publication_users is not None and len(publication_users) > 0: - # Find the publication where is_primary is True - for pub_user in publication_users: - if pub_user.get("is_primary", False): - primary_publication = pub_user.get("publication") - if primary_publication: - break - - # If no primary found, use the first publication - if primary_publication is None: - primary_publication = publication_users[0].get("publication") - - if primary_publication is None: - raise SubstackRequestException( - "Could not find primary publication in profile" - ) - - primary_publication["publication_url"] = self.get_publication_url( - primary_publication - ) - - return primary_publication - - def get_user_publications(self): - """ - Gets the users publications - """ - - profile = self.get_user_profile() - - # Loop through users "publicationUsers" list, and return a list - # of dictionaries of "name", and "subdomain", and "id" - user_publications = [] - publication_users = profile.get("publicationUsers") - - if publication_users is None: - # If publicationUsers is None, return empty list or try to construct from other fields - # This maintains backward compatibility while handling new API format - return user_publications - - for publication in publication_users: - pub = publication.get("publication") - if pub is not None: - pub["publication_url"] = self.get_publication_url(pub) - user_publications.append(pub) - - return user_publications - - def get_user_profile(self): - """ - Gets the users profile - """ - response = self._session.get(f"{self.base_url}/user/profile/self") - - return Api._handle_response(response=response) - - def get_user_settings(self): - """ - Get list of users. - - Returns: - - """ - response = self._session.get(f"{self.base_url}/settings") - - return Api._handle_response(response=response) - - def get_publication_users(self): - """ - Get list of users. - - Returns: - - """ - response = self._session.get(f"{self.publication_url}/publication/users") - - return Api._handle_response(response=response) - - def get_publication_subscriber_count(self): - """ - Get subscriber count. - - Returns: - - """ - response = self._session.get( - f"{self.publication_url}/publication_launch_checklist" - ) - - data = Api._handle_response(response=response) - if "subscriberCount" in data: - return data["subscriberCount"] - return len(data["subscribers"]) - - def get_published_posts( - self, offset=0, limit=25, order_by="post_date", order_direction="desc" - ): - """ - Get list of published posts for the publication. - """ - response = self._session.get( - f"{self.publication_url}/post_management/published", - params={ - "offset": offset, - "limit": limit, - "order_by": order_by, - "order_direction": order_direction, - }, - ) - - return Api._handle_response(response=response) - - def get_posts(self) -> dict: - """ - - Returns: - - """ - response = self._session.get(f"{self.base_url}/reader/posts") - - return Api._handle_response(response=response) - - def get_drafts(self, filter=None, offset=None, limit=None): - """ - - Args: - filter: - offset: - limit: - - Returns: - - """ - response = self._session.get( - f"{self.publication_url}/drafts", - params={"filter": filter, "offset": offset, "limit": limit}, - ) - drafts = Api._handle_response(response=response) - if isinstance(drafts, dict) and isinstance(drafts.get("posts"), list): - return drafts["posts"] - return drafts - - def get_draft(self, draft_id): - """ - Gets a draft given it's id. - - """ - response = self._session.get(f"{self.publication_url}/drafts/{draft_id}") - return Api._handle_response(response=response) - - def export_draft_to_markdown(self, draft_id): - from substack.mdexport import document_to_markdown - from substack.revision import compute_draft_revision, format_revision_marker - - draft = self.get_draft(draft_id) - draft_body = draft.get("draft_body") - if isinstance(draft_body, str): - try: - draft_body = json.loads(draft_body) - except json.JSONDecodeError as exc: - raise ValueError( - "Malformed draft body: draft_body is not valid JSON" - ) from exc - if not isinstance(draft_body, dict): - raise ValueError("Malformed draft body: draft_body must be a JSON object") - - markdown, unsupported_nodes = document_to_markdown(draft_body) - revision = compute_draft_revision(draft) - revision_marker = format_revision_marker(revision) - full_markdown = ( - f"{revision_marker}\n\n{markdown}" if markdown else f"{revision_marker}\n" - ) - return { - "draft": draft, - "markdown": full_markdown, - "revision": revision, - "unsupported_nodes": unsupported_nodes, - } - - def update_draft_from_markdown( - self, - draft_id: int, - markdown: str, - *, - subtitle: str = None, - audience: str = None, - write_comment_permissions: str = None, - search_engine_title: str = None, - search_engine_description: str = None, - slug: str = None, - draft_section_id: int = None, - tags=None, - dry_run: bool = False, - allow_unsupported_change: bool = False, - allow_image_replacement: bool = False, - expected_revision=None, - allow_conflict: bool = False, - force: bool = False, - ) -> dict: - """ - Update an existing draft body from Markdown, with optional metadata changes. - """ - from substack import mdrender - from substack.exceptions import DraftConflictError - from substack.mdexport import document_to_markdown - from substack.post import Post - from substack.revision import ( - compare_draft_revisions, - compute_draft_revision, - parse_revision_marker, - ) - - draft = self.get_draft(draft_id) - draft_body = draft.get("draft_body") - if isinstance(draft_body, str): - try: - draft_body = json.loads(draft_body) - except json.JSONDecodeError as exc: - raise ValueError( - "Malformed draft body: draft_body is not valid JSON" - ) from exc - if not isinstance(draft_body, dict): - raise ValueError("Malformed draft body: draft_body must be a JSON object") - - current_rev = compute_draft_revision(draft) - - target_expected_rev = None - if expected_revision is not None: - if isinstance(expected_revision, dict): - target_expected_rev = expected_revision - elif isinstance(expected_revision, str): - target_expected_rev = {"revision": expected_revision} - else: - raise ValueError("expected_revision must be a revision dict or string") - else: - target_expected_rev = parse_revision_marker(markdown) - - override_enabled = bool(allow_conflict or force) - conflict_detected = False - mismatches = [] - - if target_expected_rev is None: - conflict_detected = True - mismatches = [ - "Markdown file is missing revision metadata (unprotected update); safe conflict comparison is impossible." - ] - if not override_enabled and not dry_run: - raise DraftConflictError( - "Refusing to update: Markdown file is missing revision metadata (unprotected update). " - "Export the draft first or pass allow_conflict=True to proceed.", - mismatches=mismatches, - expected_revision=None, - current_revision=current_rev, - ) - else: - mismatches = compare_draft_revisions(target_expected_rev, current_rev) - if mismatches: - conflict_detected = True - if not override_enabled and not dry_run: - details = "; ".join(mismatches) - raise DraftConflictError( - f"Refusing to update: remote draft has changed since export ({details}). " - "Re-export the draft or pass allow_conflict=True to proceed.", - mismatches=mismatches, - expected_revision=target_expected_rev, - current_revision=current_rev, - ) - - _, remote_unsupported = document_to_markdown(draft_body) - - image_markers = [] - post = Post( - title=draft.get("title", ""), - subtitle=( - subtitle if subtitle is not None else (draft.get("subtitle") or "") - ), - user_id=self.get_user_id(), - audience=audience, - write_comment_permissions=write_comment_permissions, - ) - rendered = mdrender.markdown_to_doc( - markdown, api=self, track_markers=image_markers - ) - post.draft_body["content"] = rendered - - remote_images = _image_attrs(draft_body) - submitted_images = _image_attrs(post.draft_body) - - consumed_remote_indices = set() - - for submitted, marker in zip(submitted_images, image_markers): - if marker is not None and marker.get("version") == 2: - bound_src = marker["src"] - matched_idx = None - for idx, r_img in enumerate(remote_images): - if ( - idx not in consumed_remote_indices - and r_img.get("src") == bound_src - ): - matched_idx = idx - break - - if matched_idx is None: - all_with_src = [ - idx - for idx, r_img in enumerate(remote_images) - if r_img.get("src") == bound_src - ] - if not all_with_src: - raise ValueError( - f"Refusing to update: stale image marker bound to '{bound_src}'." - ) - else: - raise ValueError( - f"Refusing to update: reused or duplicate image marker for '{bound_src}'." - ) - - consumed_remote_indices.add(matched_idx) - remote_img = remote_images[matched_idx] - source, alt, href = ( - submitted.get("src"), - submitted.get("alt"), - submitted.get("href"), - ) - submitted.update(remote_img) - submitted.update(marker["attrs"]) - submitted.update( - {"src": source, "alt": alt, "href": href, "isProcessing": False} - ) - - elif marker is not None and marker.get("version") == 1: - sub_src = submitted.get("src") - matches = [ - idx - for idx, r_img in enumerate(remote_images) - if r_img.get("src") == sub_src - and idx not in consumed_remote_indices - ] - if len(matches) == 1: - matched_idx = matches[0] - consumed_remote_indices.add(matched_idx) - remote_img = remote_images[matched_idx] - source, alt, href = ( - submitted.get("src"), - submitted.get("alt"), - submitted.get("href"), - ) - submitted.update(remote_img) - submitted.update(marker["attrs"]) - submitted.update( - {"src": source, "alt": alt, "href": href, "isProcessing": False} - ) - elif not allow_image_replacement: - raise ValueError( - "Refusing to update: image cannot be matched uniquely; set allow_image_replacement=True to proceed." - ) - - else: - if not allow_image_replacement: - raise ValueError( - "Refusing to update: image cannot be matched uniquely; set allow_image_replacement=True to proceed." - ) - - _, submitted_unsupported = document_to_markdown(post.draft_body) - - if not allow_unsupported_change: - remote_serialized = [ - json.dumps(n, ensure_ascii=False, separators=(",", ":"), sort_keys=True) - for n in remote_unsupported - ] - submitted_serialized = [ - json.dumps(n, ensure_ascii=False, separators=(",", ":"), sort_keys=True) - for n in submitted_unsupported - ] - if sorted(remote_serialized) != sorted(submitted_serialized): - raise ValueError( - "Refusing to update: remote unsupported nodes are missing, duplicated, stale, or altered. " - "Export the draft first or set allow_unsupported_change=True to proceed." - ) - - unsupported_nodes = remote_unsupported - - update_payload = {"draft_body": json.dumps(post.draft_body)} - - if subtitle is not None: - update_payload["subtitle"] = subtitle - if audience is not None: - update_payload["audience"] = audience - if write_comment_permissions is not None: - update_payload["write_comment_permissions"] = write_comment_permissions - if search_engine_title is not None: - update_payload["search_engine_title"] = search_engine_title - if search_engine_description is not None: - update_payload["search_engine_description"] = search_engine_description - if slug is not None: - update_payload["slug"] = slug - if draft_section_id is not None: - update_payload["draft_section_id"] = draft_section_id - - tags_result = None - updated_draft = draft - - if not dry_run: - updated_draft = self.put_draft(draft_id, **update_payload) - - tags_list = Api._normalize_tags(tags) - if tags_list: - tags_result = self.add_tags_to_post(draft_id, tags_list) - - result_payload = { - "action": "update", - "draft_id": draft_id, - "dry_run": dry_run, - "changed": not dry_run, - "payload": update_payload, - "draft": updated_draft, - "tags": tags_result, - "unsupported_nodes": unsupported_nodes, - "conflict": conflict_detected, - "mismatches": mismatches, - "expected_revision": target_expected_rev, - "current_revision": current_rev, - } - if override_enabled and conflict_detected: - result_payload["override"] = True - return result_payload - - def delete_draft(self, draft_id): - """ - - Args: - draft_id: - - Returns: - - """ - response = self._session.delete(f"{self.publication_url}/drafts/{draft_id}") - return Api._handle_response(response=response) - - def post_draft(self, body) -> dict: - """ - - Args: - body: - - Returns: - - """ - response = self._session.post(f"{self.publication_url}/drafts", json=body) - return Api._handle_response(response=response) - - def create_draft_from_markdown( - self, - title: str, - markdown: str, - subtitle: str = "", - audience: str = "everyone", - write_comment_permissions: str = "everyone", - search_engine_title: str = None, - search_engine_description: str = None, - slug: str = None, - draft_section_id: int = None, - tags=None, - prepublish: bool = False, - publish: bool = False, - send: bool = True, - share_automatically: bool = False, - ) -> dict: - from substack.post import Post - - post = Post( - title=title, - subtitle=subtitle or "", - user_id=self.get_user_id(), - audience=audience, - write_comment_permissions=write_comment_permissions, - ) - post.from_markdown(markdown, api=self) - - draft = self.post_draft(post.get_draft()) - draft_id = draft.get("id") - - update_payload = { - "search_engine_title": search_engine_title, - "search_engine_description": search_engine_description, - "slug": slug, - "draft_section_id": draft_section_id, - } - update_payload = { - key: value for key, value in update_payload.items() if value is not None - } - if update_payload: - draft = self.put_draft(draft_id, **update_payload) - - tags_result = None - tags_list = self._normalize_tags(tags) - if tags_list: - tags_result = self.add_tags_to_post(draft_id, tags_list) - - prepublish_result = None - if prepublish: - prepublish_result = self.prepublish_draft(draft_id) - - publish_result = None - if publish: - publish_result = self.publish_draft( - draft_id, - send=send, - share_automatically=share_automatically, - ) - - return { - "draft": draft, - "tags": tags_result, - "prepublish": prepublish_result, - "publish": publish_result, - } - - def put_draft(self, draft, **kwargs) -> dict: - """ - - Args: - draft: - **kwargs: - - Returns: - - """ - response = self._session.put( - f"{self.publication_url}/drafts/{draft}", - json=kwargs, - ) - return Api._handle_response(response=response) - - def prepublish_draft(self, draft) -> dict: - """ - - Args: - draft: draft id - - Returns: - - """ - - response = self._session.get( - f"{self.publication_url}/drafts/{draft}/prepublish" - ) - return Api._handle_response(response=response) - - def publish_draft( - self, draft, send: bool = True, share_automatically: bool = False - ) -> dict: - """ - - Args: - draft: draft id - send: - share_automatically: - - Returns: - - """ - response = self._session.post( - f"{self.publication_url}/drafts/{draft}/publish", - json={"send": send, "share_automatically": share_automatically}, - ) - return Api._handle_response(response=response) - - def schedule_draft(self, draft, draft_datetime: datetime) -> dict: - """ - - Args: - draft: draft id - draft_datetime: datetime to schedule the draft - - Returns: - - """ - response = self._session.post( - f"{self.publication_url}/drafts/{draft}/scheduled_release", - json={"trigger_at": draft_datetime.isoformat()}, - ) - return Api._handle_response(response=response) - - def unschedule_draft(self, draft) -> dict: - """ - - Args: - draft: draft id - - Returns: - - """ - response = self._session.delete( - f"{self.publication_url}/drafts/{draft}/scheduled_release" - ) - return Api._handle_response(response=response) - - def get_image(self, image: str): - """ - - This method generates a new substack link that contains the image. - - Args: - image: filepath or original url of image. - - Returns: - - """ - if os.path.exists(image): - import mimetypes - - mime_type, _ = mimetypes.guess_type(image) - if mime_type not in ["image/jpeg", "image/png", "image/gif", "image/webp"]: - ext = os.path.splitext(image)[1].lower() - if ext in [".jpg", ".jpeg"]: - mime_type = "image/jpeg" - elif ext == ".png": - mime_type = "image/png" - elif ext == ".gif": - mime_type = "image/gif" - elif ext == ".webp": - mime_type = "image/webp" - else: - mime_type = "application/octet-stream" - - with open(image, "rb") as file: - image_bytes = base64.b64encode(file.read()) - image = f"data:{mime_type};base64,".encode("ascii") + image_bytes - - response = self._session.post( - f"{self.publication_url}/image", - data={"image": image}, - ) - return Api._handle_response(response=response) - - def add_tags_to_post(self, post_id: int, tag_names: list) -> dict: - """ - Add multiple tags to a post. - - Args: - post_id: The ID of the post to tag. - tag_names: A list of tag names to add. - - Returns: - A dictionary with the results of applying all tags. - """ - results = [] - for tag_name in tag_names: - result = self.add_tag_to_post(post_id, tag_name) - results.append(result) - return {"tags_added": results} - - def get_publication_post_tags(self) -> list: - """ - Retrieve all post tags for the current publication. - - Returns: - List of tag dicts as returned by Substack API. - """ - response = self._session.get(f"{self.publication_url}/publication/post-tag") - return Api._handle_response(response=response) - - def add_tag_to_post(self, post_id: int, tag_name: str) -> dict: - """ - Add a tag to a post by first checking published tags and creating only if needed. - - Args: - post_id: The ID of the post to tag. - tag_name: The name of the tag to add. - - Returns: - The response from applying the tag to the post. - """ - # Fetch existing publication tags first (avoid re-creating an already existing tag) - existing_tags = self.get_publication_post_tags() or [] - existing_tag = next( - (tag for tag in existing_tags if tag.get("name") == tag_name), - None, - ) - - if existing_tag is not None: - tag_id = existing_tag["id"] - else: - create_tag_response = self._session.post( - f"{self.publication_url}/publication/post-tag", - json={"name": tag_name}, - ) - tag_data = Api._handle_response(create_tag_response) - tag_id = tag_data["id"] - - apply_tag_response = self._session.post( - f"{self.publication_url}/post/{post_id}/tag/{tag_id}", - ) - return Api._handle_response(apply_tag_response) - - def get_categories(self): - """ - - Retrieve list of all available categories. - - Returns: - - """ - response = self._session.get(f"{self.base_url}/categories") - return Api._handle_response(response=response) - - def get_category(self, category_id, category_type, page): - """ - - Args: - category_id: - category_type: - page: - - Returns: - - """ - response = self._session.get( - f"{self.base_url}/category/public/{category_id}/{category_type}", - params={"page": page}, - ) - return Api._handle_response(response=response) - - def get_single_category(self, category_id, category_type, page=None, limit=None): - """ - - Args: - category_id: - category_type: paid or all - page: by default substack retrieves only the first 25 publications in the category. If this is left None, - then all pages will be retrieved. The page size is 25 publications. - limit: - Returns: - - """ - if page is not None: - output = self.get_category(category_id, category_type, page) - else: - publications = [] - page = 0 - while True: - page_output = self.get_category(category_id, category_type, page) - publications.extend(page_output.get("publications", [])) - if ( - limit is not None and limit <= len(publications) - ) or not page_output.get("more", False): - publications = publications[:limit] - break - page += 1 - output = { - "publications": publications, - "more": page_output.get("more", False), - } - return output - - def delete_all_drafts(self): - """ - - Returns: - - """ - response = None - while True: - drafts = self.get_drafts(filter="draft", limit=10, offset=0) - if len(drafts) == 0: - break - for draft in drafts: - response = self.delete_draft(draft.get("id")) - return response - - def get_sections(self): - """ - Get a list of the sections of your publication. - - TODO: this is hacky but I cannot find another place where to get the sections. - Returns: - - """ - response = self._session.get( - f"{self.publication_url}/subscriptions", - ) - content = Api._handle_response(response=response) - sections = [ - p.get("sections") - for p in content.get("publications") - if p.get("hostname") in self.publication_url - ] - return sections[0] - - def publication_embed(self, url): - """ - - Args: - url: - - Returns: - - """ - return self.call("/publication/embed", "GET", url=url) - - def call(self, endpoint, method, **params): - """ - - Args: - endpoint: - method: - **params: - - Returns: - - """ - response = self._session.request( - method=method, - url=f"{self.publication_url}/{endpoint}", - params=params, - ) - return Api._handle_response(response=response) +import base64 +import logging +import os +from datetime import datetime +from urllib.parse import urljoin + +import requests + +from substack.exceptions import SubstackAPIException, SubstackRequestException + +logger = logging.getLogger(__name__) + +__all__ = ["Api"] + + +class Api: + """ + + A python interface into the Substack API + + """ + + def __init__( + self, + email=None, + password=None, + base_url=None, + publication_url=None, + debug=False, + ): + """ + + To create an instance of the substack.Api class: + >>> import substack + >>> api = substack.Api(email="substack email", password="substack password") + + Args: + email: + password: + base_url: + The base URL to use to contact the Substack API. + Defaults to https://substack.com/api/v1. + """ + self.base_url = base_url or "https://substack.com/api/v1" + self.publication_url = urljoin(publication_url, "api/v1") + + if debug: + logging.basicConfig() + logging.getLogger().setLevel(logging.DEBUG) + + self._session = requests.Session() + + if email is not None and password is not None: + self.login(email, password) + + def login(self, email, password) -> dict: + """ + + Login to the substack account. + + Args: + email: substack account email + password: substack account password + """ + + response = self._session.post( + f"{self.base_url}/login", + json={ + "captcha_response": None, + "email": email, + "for_pub": "", + "password": password, + "redirect": "/", + }, + ) + return Api._handle_response(response=response) + + @staticmethod + def _handle_response(response: requests.Response): + """ + + Internal helper for handling API responses from the Substack server. + Raises the appropriate exceptions when necessary; otherwise, returns the + response. + + """ + + if not (200 <= response.status_code < 300): + raise SubstackAPIException(response.status_code, response.text) + try: + return response.json() + except ValueError: + raise SubstackRequestException("Invalid Response: %s" % response.text) + + def get_publication_users(self): + """ + Get list of users. + + Returns: + + """ + response = self._session.get(f"{self.publication_url}/publication/users") + + return Api._handle_response(response=response) + + def get_posts(self) -> dict: + """ + + Returns: + + """ + response = self._session.get(f"{self.base_url}/reader/posts") + + return Api._handle_response(response=response) + + def get_drafts(self, filter=None, offset=None, limit=None): + """ + + Args: + filter: + offset: + limit: + + Returns: + + """ + response = self._session.get( + f"{self.publication_url}/drafts", + params={"filter": filter, "offset": offset, "limit": limit}, + ) + return Api._handle_response(response=response) + + def delete_draft(self, draft_id): + """ + + Args: + draft_id: + + Returns: + + """ + response = self._session.delete(f"{self.publication_url}/drafts/{draft_id}") + return Api._handle_response(response=response) + + def post_draft(self, body) -> dict: + """ + + Args: + body: + + Returns: + + """ + response = self._session.post(f"{self.publication_url}/drafts", json=body) + return Api._handle_response(response=response) + + def put_draft( + self, + draft, + title=None, + subtitle=None, + body=None, + cover_image=None, + ) -> dict: + """ + + Args: + draft: draft id + title: + subtitle: + body: + cover_image: + + Returns: + + """ + + response = self._session.put( + f"{self.publication_url}/drafts/{draft}", + json={ + "draft_title": title, + "draft_subtitle": subtitle, + "draft_body": body, + "cover_image": cover_image, + }, + ) + return Api._handle_response(response=response) + + def prepublish_draft(self, draft) -> dict: + """ + + Args: + draft: draft id + + Returns: + + """ + + response = self._session.get( + f"{self.publication_url}/drafts/{draft}/prepublish" + ) + return Api._handle_response(response=response) + + def publish_draft( + self, draft, send: bool = True, share_automatically: bool = False + ) -> dict: + """ + + Args: + draft: draft id + send: + share_automatically: + + Returns: + + """ + response = self._session.post( + f"{self.publication_url}/drafts/{draft}/publish", + json={"send": send, "share_automatically": share_automatically}, + ) + return Api._handle_response(response=response) + + def schedule_draft(self, draft, draft_datetime: datetime) -> dict: + """ + + Args: + draft: draft id + draft_datetime: datetime to schedule the draft + + Returns: + + """ + response = self._session.post( + f"{self.publication_url}/drafts/{draft}/schedule", + json={"post_date": draft_datetime.isoformat()}, + ) + return Api._handle_response(response=response) + + def unschedule_draft(self, draft) -> dict: + """ + + Args: + draft: draft id + + Returns: + + """ + response = self._session.post( + f"{self.publication_url}/drafts/{draft}/schedule", json={"post_date": None} + ) + return Api._handle_response(response=response) + + def get_image(self, image: str): + """ + + This method generates a new substack link that contains the image. + + Args: + image: filepath or original url of image. + + Returns: + + """ + if os.path.exists(image): + with open(image, "rb") as file: + image = b"data:image/jpeg;base64," + base64.b64encode(file.read()) + + response = self._session.post( + f"{self.publication_url}/image", + data={"image": image}, + ) + return Api._handle_response(response=response) + + def get_categories(self): + """ + + Retrieve list of all available categories. + + Returns: + + """ + response = self._session.get(f"{self.base_url}/categories") + return Api._handle_response(response=response) + + def get_category(self, category_id, category_type, page): + """ + + Args: + category_id: + category_type: + page: + + Returns: + + """ + response = self._session.get( + f"{self.base_url}/category/public/{category_id}/{category_type}", + params={"page": page}, + ) + return Api._handle_response(response=response) + + def get_single_category(self, category_id, category_type, page=None, limit=None): + """ + + Args: + category_id: + category_type: paid or all + page: by default substack retrieves only the first 25 publications in the category. If this is left None, + then all pages will be retrieved. The page size is 25 publications. + limit: + Returns: + + """ + if page is not None: + output = self.get_category(category_id, category_type, page) + else: + publications = [] + page = 0 + while True: + page_output = self.get_category(category_id, category_type, page) + publications.extend(page_output.get("publications", [])) + if ( + limit is not None and limit <= len(publications) + ) or not page_output.get("more", False): + publications = publications[:limit] + break + page += 1 + output = { + "publications": publications, + "more": page_output.get("more", False), + } + return output + + def delete_all_drafts(self): + """ + + Returns: + + """ + response = None + while True: + drafts = self.get_drafts(filter="draft", limit=10, offset=0) + if len(drafts) == 0: + break + for draft in drafts: + response = self.delete_draft(draft.get("id")) + return response diff --git a/substack/cli.py b/substack/cli.py deleted file mode 100644 index 23109cf..0000000 --- a/substack/cli.py +++ /dev/null @@ -1,777 +0,0 @@ -import argparse -import json -import os -import sys -from datetime import datetime -from pathlib import Path -from urllib.parse import urljoin - -import yaml -from dotenv import load_dotenv - -from substack import Api, __version__ -from substack.exceptions import ( - DraftConflictError, - SubstackAPIException, - SubstackRequestException, -) -from substack.post import Post - - -class CLIUsageError(Exception): - pass - - -def _api_from_env(cookies_path=None, publication_url=None, timeout=None): - load_dotenv() - - cookies_path = cookies_path or os.getenv("COOKIES_PATH") - cookies_string = os.getenv("COOKIES_STRING") - publication_url = publication_url or os.getenv("PUBLICATION_URL") - - if cookies_path or cookies_string: - return Api( - cookies_path=cookies_path, - cookies_string=cookies_string, - publication_url=publication_url, - timeout=timeout, - ) - - return Api( - email=os.getenv("EMAIL"), - password=os.getenv("PASSWORD"), - publication_url=publication_url, - timeout=timeout, - ) - - -def _auth_method(cookies_path=None): - load_dotenv() - - if cookies_path: - return "cookies_path" - if os.getenv("COOKIES_PATH"): - return "cookies_path" - if os.getenv("COOKIES_STRING"): - return "cookies_string" - if os.getenv("EMAIL") and os.getenv("PASSWORD"): - return "email_password" - return "unknown" - - -def _title_from_markdown(markdown, fallback): - for line in markdown.splitlines(): - if line.startswith("# "): - return line[2:].strip() - return fallback - - -def _print_result(result): - draft = result["draft"] - print(json.dumps({"draft_id": draft.get("id"), "draft": draft}, indent=2)) - - -def _print_json(value, stream=None): - print(json.dumps(value, indent=2, default=str), file=stream) - - -def _display(value): - if value is None or value == "": - return "-" - return str(value) - - -def _print_rows(headers, rows): - rows = [[_display(value) for value in row] for row in rows] - widths = [len(header) for header in headers] - for row in rows: - for index, value in enumerate(row): - widths[index] = max(widths[index], len(value)) - - print( - " ".join(header.ljust(widths[index]) for index, header in enumerate(headers)) - ) - print(" ".join("-" * width for width in widths)) - for row in rows: - print(" ".join(value.ljust(widths[index]) for index, value in enumerate(row))) - - -def _identity(profile): - return ( - profile.get("email") - or profile.get("name") - or profile.get("handle") - or str(profile.get("id", "unknown")) - ) - - -def _selected_publication(api, publications): - for publication in publications: - publication_url = publication.get("publication_url") - if ( - publication_url - and urljoin(publication_url, "api/v1") == api.publication_url - ): - return publication - return {"publication_url": api.publication_url.removesuffix("/api/v1")} - - -def _parse_schedule(value): - normalized = value[:-1] + "+00:00" if value.endswith(("Z", "z")) else value - try: - scheduled_at = datetime.fromisoformat(normalized) - except ValueError as exc: - raise CLIUsageError("--at must be a valid ISO 8601 timestamp") from exc - if scheduled_at.utcoffset() is None: - raise CLIUsageError("--at must include a timezone offset or Z") - return scheduled_at - - -def _confirm(action, target, yes, json_output): - if yes: - return - if json_output or not sys.stdin.isatty(): - raise CLIUsageError(f"{action} requires --yes in non-interactive or JSON mode") - try: - confirmed = input(f"{action} draft {target}? [y/N] ").strip().lower() - except EOFError as exc: - raise CLIUsageError(f"{action} requires confirmation or --yes") from exc - if confirmed not in {"y", "yes"}: - raise CLIUsageError("Cancelled") - - -def _redact(message): - redacted = str(message) - for name in ("EMAIL", "PASSWORD", "COOKIES_STRING"): - secret = os.getenv(name) - if secret: - redacted = redacted.replace(secret, "[redacted]") - return redacted - - -def _error_payload(exc): - if isinstance(exc, DraftConflictError): - return { - "error": { - "type": "conflict_error", - "message": _redact(exc.message), - "mismatches": exc.mismatches, - } - } - if isinstance(exc, SubstackAPIException): - return { - "error": { - "type": "api_error", - "message": _redact(exc.message), - "status_code": exc.status_code, - } - } - if isinstance(exc, SubstackRequestException): - return { - "error": { - "type": "request_error", - "message": _redact(exc.message), - } - } - if isinstance(exc, OSError): - return {"error": {"type": "io_error", "message": _redact(exc)}} - return {"error": {"type": "configuration_error", "message": _redact(exc)}} - - -def _print_error(exc, json_output): - payload = _error_payload(exc) - if json_output: - _print_json(payload, stream=sys.stderr) - else: - print(f"Error: {payload['error']['message']}", file=sys.stderr) - - -def _print_usage_error(exc, json_output): - if json_output: - _print_json( - {"error": {"type": "usage_error", "message": str(exc)}}, - stream=sys.stderr, - ) - else: - print(f"Error: {exc}", file=sys.stderr) - - -def _status(api, args): - profile = api.get_user_profile() - publications = api.get_user_publications() - selected = _selected_publication(api, publications) - subscriber_count = api.get_publication_subscriber_count() - result = { - "status": { - "identity": _identity(profile), - "auth_method": _auth_method(args.cookies), - "subscriber_count": subscriber_count, - }, - "profile": profile, - "publication": selected, - "publications": publications, - } - if args.json_output: - _print_json(result) - else: - print(f"Authenticated as: {result['status']['identity']}") - print(f"Auth method: {result['status']['auth_method']}") - print(f"Publication: {_display(selected.get('name'))}") - print(f"Publication URL: {_display(selected.get('publication_url'))}") - print(f"Subscribers: {subscriber_count}") - print(f"Available publications: {len(publications)}") - - -def _publications_list(api, args): - publications = api.get_user_publications() - if args.json_output: - _print_json({"publications": publications, "count": len(publications)}) - else: - _print_rows( - ["ID", "NAME", "SUBDOMAIN", "URL"], - [ - [ - publication.get("id"), - publication.get("name"), - publication.get("subdomain"), - publication.get("publication_url"), - ] - for publication in publications - ], - ) - - -def _drafts_list(api, args): - if args.offset < 0: - raise CLIUsageError("--offset must be zero or greater") - if args.limit < 1: - raise CLIUsageError("--limit must be greater than zero") - drafts = api.get_drafts(filter=args.filter, offset=args.offset, limit=args.limit) - if args.json_output: - _print_json( - { - "drafts": drafts, - "count": len(drafts), - "filter": args.filter, - "offset": args.offset, - "limit": args.limit, - } - ) - else: - _print_rows( - ["ID", "TITLE", "STATUS", "SCHEDULED"], - [ - [ - draft.get("id"), - draft.get("draft_title") or draft.get("title"), - draft.get("type") or draft.get("status") or "draft", - draft.get("post_date"), - ] - for draft in drafts - ], - ) - - -def _drafts_get(api, args): - draft = api.get_draft(args.draft_id) - if args.json_output: - _print_json({"draft": draft}) - else: - fields = [ - ("ID", draft.get("id")), - ("Title", draft.get("draft_title") or draft.get("title")), - ("Subtitle", draft.get("draft_subtitle") or draft.get("subtitle")), - ("Status", draft.get("type") or draft.get("status") or "draft"), - ("Slug", draft.get("slug")), - ("Scheduled", draft.get("post_date")), - ("Audience", draft.get("audience")), - ] - for label, value in fields: - print(f"{label}: {_display(value)}") - - -def _drafts_create(api, args): - markdown_path = Path(args.markdown_file) - markdown = markdown_path.read_text(encoding="utf-8") - title = args.title or _title_from_markdown(markdown, markdown_path.stem) - result = api.create_draft_from_markdown( - title=title, - markdown=markdown, - subtitle=args.subtitle, - audience=args.audience, - write_comment_permissions=args.write_comment_permissions, - search_engine_title=args.search_engine_title, - search_engine_description=args.search_engine_description, - slug=args.slug, - draft_section_id=args.draft_section_id, - tags=args.tags, - prepublish=False, - publish=False, - ) - draft = result["draft"] - payload = { - "action": "create", - "draft_id": draft.get("id"), - "draft": draft, - "tags": result.get("tags"), - } - if args.json_output: - _print_json(payload) - else: - print(f"Created draft {draft.get('id')}: {title}") - - -def _drafts_update(api, args): - if args.allow_unsupported_change and not args.yes: - raise CLIUsageError("--yes is required when using --allow-unsupported-change") - if args.allow_image_replacement and not args.yes: - raise CLIUsageError("--yes is required when using --allow-image-replacement") - if args.allow_conflict and not args.yes: - raise CLIUsageError("--yes is required when using --allow-conflict") - - if not args.yes and (args.json_output or not sys.stdin.isatty()): - raise CLIUsageError("--yes is required in non-interactive or JSON mode") - - markdown_file = Path(args.markdown_file) - if not markdown_file.exists(): - raise CLIUsageError(f"File not found: {markdown_file}") - - if not args.yes: - action = "update" if not args.dry_run else "dry-run update" - print(f"Ready to {action} draft {args.draft_id} from {markdown_file}") - print("Substack nodes that are not supported by Markdown export/import") - print("will cause the update to be refused to prevent data loss.") - print() - try: - response = input(f"Confirm {action}? [y/N]: ") - if response.lower() not in ["y", "yes"]: - print("Aborted.") - return - except EOFError as exc: - raise CLIUsageError( - f"Confirm {action} requires confirmation or --yes" - ) from exc - - markdown = markdown_file.read_text(encoding="utf-8") - - result = api.update_draft_from_markdown( - args.draft_id, - markdown, - subtitle=args.subtitle, - audience=args.audience, - write_comment_permissions=args.write_comment_permissions, - search_engine_title=args.search_engine_title, - search_engine_description=args.search_engine_description, - slug=args.slug, - draft_section_id=args.draft_section_id, - tags=args.tags, - dry_run=args.dry_run, - allow_unsupported_change=args.allow_unsupported_change, - allow_image_replacement=args.allow_image_replacement, - allow_conflict=args.allow_conflict, - ) - - if args.json_output: - _print_json(result) - else: - status = "Dry-run updated" if args.dry_run else "Updated" - if result.get("conflict"): - print(f"Conflict detected in draft {args.draft_id}:") - for mismatch in result.get("mismatches", []): - print(f" - {mismatch}") - if result.get("dry_run"): - print( - f"Dry-run preview completed for draft {args.draft_id} with conflicts." - ) - else: - print(f"{status} draft {args.draft_id} (override applied)") - else: - print(f"{status} draft {args.draft_id}") - - -def _drafts_export(api, args): - output_path = Path(args.output) if args.output else None - if output_path is not None and output_path.exists() and not args.force: - raise CLIUsageError( - f"Output file already exists: {output_path}; use --force to overwrite" - ) - - result = api.export_draft_to_markdown(args.draft_id) - markdown = result["markdown"] - if output_path is not None: - output_path.write_text(markdown, encoding="utf-8") - - payload = { - "action": "export", - "draft_id": args.draft_id, - "markdown": markdown, - "unsupported_nodes": result["unsupported_nodes"], - } - if "revision" in result and result["revision"] is not None: - payload["revision"] = result["revision"] - if args.json_output: - _print_json(payload) - elif output_path is not None: - print(f"Exported draft {args.draft_id} to {output_path}") - else: - print(markdown, end="") - - -def _drafts_schedule(api, args): - scheduled_at = _parse_schedule(args.at) - result = api.schedule_draft(args.draft_id, scheduled_at) - payload = { - "action": "schedule", - "draft_id": args.draft_id, - "scheduled_at": scheduled_at.isoformat(), - "result": result, - } - if args.json_output: - _print_json(payload) - else: - print(f"Scheduled draft {args.draft_id} for {scheduled_at.isoformat()}") - - -def _drafts_unschedule(api, args): - result = api.unschedule_draft(args.draft_id) - payload = {"action": "unschedule", "draft_id": args.draft_id, "result": result} - if args.json_output: - _print_json(payload) - else: - print(f"Unscheduled draft {args.draft_id}") - - -def _drafts_publish(api, args): - _confirm("Publish", args.draft_id, args.yes, args.json_output) - prepublish = api.prepublish_draft(args.draft_id) - result = api.publish_draft( - args.draft_id, - send=args.send, - share_automatically=args.share_automatically, - ) - payload = { - "action": "publish", - "draft_id": args.draft_id, - "prepublish": prepublish, - "result": result, - } - if args.json_output: - _print_json(payload) - else: - delivery = "without email" if not args.send else "with email" - print(f"Published draft {args.draft_id} {delivery}") - - -def _drafts_delete(api, args): - _confirm("Delete", args.draft_id, args.yes, args.json_output) - result = api.delete_draft(args.draft_id) - payload = {"action": "delete", "draft_id": args.draft_id, "result": result} - if args.json_output: - _print_json(payload) - else: - print(f"Deleted draft {args.draft_id}") - - -def _build_parser(): - parser = argparse.ArgumentParser( - prog="substack", description="Manage Substack publications and drafts." - ) - parser.add_argument("--cookies", help="Path to a cookies JSON file.") - parser.add_argument( - "--publication-url", help="Override PUBLICATION_URL for this command." - ) - parser.add_argument( - "--timeout", type=float, help="Timeout in seconds for API requests." - ) - parser.add_argument("--json", action="store_true", dest="json_output") - parser.add_argument("--version", action="version", version=__version__) - - commands = parser.add_subparsers(dest="command", required=True) - status = commands.add_parser( - "status", help="Show authentication and publication status." - ) - status.set_defaults(handler=_status) - - publications = commands.add_parser("publications", help="Manage publications.") - publication_commands = publications.add_subparsers( - dest="publication_command", required=True - ) - publications_list = publication_commands.add_parser( - "list", help="List available publications." - ) - publications_list.set_defaults(handler=_publications_list) - - drafts = commands.add_parser("drafts", help="Manage drafts.") - draft_commands = drafts.add_subparsers(dest="draft_command", required=True) - - drafts_list = draft_commands.add_parser("list", help="List drafts.") - drafts_list.add_argument("--filter", default="draft") - drafts_list.add_argument("--offset", type=int, default=0) - drafts_list.add_argument("--limit", type=int, default=25) - drafts_list.set_defaults(handler=_drafts_list) - - drafts_get = draft_commands.add_parser("get", help="Inspect a draft.") - drafts_get.add_argument("draft_id", type=int) - drafts_get.set_defaults(handler=_drafts_get) - - drafts_create = draft_commands.add_parser( - "create", help="Create a draft from a Markdown file." - ) - drafts_create.add_argument("markdown_file", metavar="MARKDOWN_FILE") - drafts_create.add_argument("--title") - drafts_create.add_argument("--subtitle", default="") - drafts_create.add_argument("--audience", default="everyone") - drafts_create.add_argument("--write-comment-permissions", default="everyone") - drafts_create.add_argument("--search-engine-title") - drafts_create.add_argument("--search-engine-description") - drafts_create.add_argument("--slug") - drafts_create.add_argument("--draft-section-id", type=int) - drafts_create.add_argument("--tag", action="append", dest="tags", metavar="TAG") - drafts_create.set_defaults(handler=_drafts_create) - - drafts_update = draft_commands.add_parser( - "update", help="Update a draft from a Markdown file." - ) - drafts_update.add_argument("draft_id", type=int) - drafts_update.add_argument("markdown_file", metavar="MARKDOWN_FILE") - drafts_update.add_argument("--subtitle") - drafts_update.add_argument("--audience") - drafts_update.add_argument("--write-comment-permissions") - drafts_update.add_argument("--search-engine-title") - drafts_update.add_argument("--search-engine-description") - drafts_update.add_argument("--slug") - drafts_update.add_argument("--draft-section-id", type=int) - drafts_update.add_argument("--tag", action="append", dest="tags", metavar="TAG") - drafts_update.add_argument("--dry-run", action="store_true") - drafts_update.add_argument("--allow-unsupported-change", action="store_true") - drafts_update.add_argument("--allow-image-replacement", action="store_true") - drafts_update.add_argument( - "--allow-conflict", - "--force", - action="store_true", - dest="allow_conflict", - help="Allow updating draft even if remote revision has changed or revision metadata is missing.", - ) - drafts_update.add_argument("--yes", action="store_true") - drafts_update.set_defaults(handler=_drafts_update) - - drafts_export = draft_commands.add_parser( - "export", help="Export a draft to Markdown without modifying it." - ) - drafts_export.add_argument("draft_id", type=int) - drafts_export.add_argument("--output", metavar="PATH") - drafts_export.add_argument("--force", action="store_true") - drafts_export.set_defaults(handler=_drafts_export) - - drafts_schedule = draft_commands.add_parser("schedule", help="Schedule a draft.") - drafts_schedule.add_argument("draft_id", type=int) - drafts_schedule.add_argument("--at", required=True) - drafts_schedule.set_defaults(handler=_drafts_schedule) - - drafts_unschedule = draft_commands.add_parser( - "unschedule", help="Remove a draft schedule." - ) - drafts_unschedule.add_argument("draft_id", type=int) - drafts_unschedule.set_defaults(handler=_drafts_unschedule) - - drafts_publish = draft_commands.add_parser("publish", help="Publish a draft.") - drafts_publish.add_argument("draft_id", type=int) - drafts_publish.add_argument( - "--no-send", action="store_false", dest="send", default=True - ) - drafts_publish.add_argument("--share-automatically", action="store_true") - drafts_publish.add_argument("--yes", action="store_true") - drafts_publish.set_defaults(handler=_drafts_publish) - - drafts_delete = draft_commands.add_parser("delete", help="Delete a draft.") - drafts_delete.add_argument("draft_id", type=int) - drafts_delete.add_argument("--yes", action="store_true") - drafts_delete.set_defaults(handler=_drafts_delete) - return parser - - -def main(argv=None): - parser = _build_parser() - args = parser.parse_args(argv) - try: - api = _api_from_env( - cookies_path=args.cookies, - publication_url=args.publication_url, - timeout=args.timeout, - ) - args.handler(api, args) - except CLIUsageError as exc: - _print_usage_error(exc, args.json_output) - return 2 - except (SubstackAPIException, SubstackRequestException, OSError, ValueError) as exc: - _print_error(exc, args.json_output) - return 1 - return 0 - - -def publish_markdown(argv=None): - parser = argparse.ArgumentParser() - parser.add_argument("markdown", nargs="?", default="README.md") - parser.add_argument("-m", "--markdown-file", dest="markdown_file") - parser.add_argument("--title") - parser.add_argument("--subtitle", default="") - parser.add_argument("--audience", default="everyone") - parser.add_argument("--write-comment-permissions", default="everyone") - parser.add_argument("--search-engine-title") - parser.add_argument("--search-engine-description") - parser.add_argument("--slug") - parser.add_argument("--draft-section-id", type=int) - parser.add_argument("--tag", action="append", dest="tags") - parser.add_argument("--cookies") - parser.add_argument("--prepublish", action="store_true") - parser.add_argument("--publish", action="store_true") - parser.add_argument("--no-send", action="store_false", dest="send", default=True) - parser.add_argument("--share-automatically", action="store_true") - args = parser.parse_args(argv) - - markdown_path = Path(args.markdown_file or args.markdown) - markdown = markdown_path.read_text(encoding="utf-8") - - api = _api_from_env(args.cookies) - result = api.create_draft_from_markdown( - title=args.title or _title_from_markdown(markdown, markdown_path.stem), - markdown=markdown, - subtitle=args.subtitle, - audience=args.audience, - write_comment_permissions=args.write_comment_permissions, - search_engine_title=args.search_engine_title, - search_engine_description=args.search_engine_description, - slug=args.slug, - draft_section_id=args.draft_section_id, - tags=args.tags, - prepublish=args.prepublish or args.publish, - publish=args.publish, - send=args.send, - share_automatically=args.share_automatically, - ) - _print_result(result) - return 0 - - -def publish_yaml(argv=None): - parser = argparse.ArgumentParser() - parser.add_argument("post", nargs="?", default="draft.yaml") - parser.add_argument("-p", "--post-file", dest="post_file") - parser.add_argument("--cookies") - parser.add_argument("--prepublish", action="store_true") - parser.add_argument("--publish", action="store_true") - parser.add_argument("--no-send", action="store_false", dest="send", default=True) - parser.add_argument("--share-automatically", action="store_true") - args = parser.parse_args(argv) - - post_path = Path(args.post_file or args.post) - post_data = yaml.safe_load(post_path.read_text(encoding="utf-8")) - api = _api_from_env(args.cookies) - - markdown = post_data.get("markdown") - markdown_file = post_data.get("markdown_file") - if markdown_file: - markdown_path = Path(markdown_file) - if not markdown_path.is_absolute(): - markdown_path = post_path.parent / markdown_path - markdown = markdown_path.read_text(encoding="utf-8") - - if markdown is not None: - result = api.create_draft_from_markdown( - title=post_data.get("title"), - markdown=markdown, - subtitle=post_data.get("subtitle", ""), - audience=post_data.get("audience", "everyone"), - write_comment_permissions=post_data.get( - "write_comment_permissions", "everyone" - ), - search_engine_title=post_data.get("search_engine_title"), - search_engine_description=post_data.get("search_engine_description"), - slug=post_data.get("slug"), - draft_section_id=post_data.get("draft_section_id"), - tags=post_data.get("tags"), - prepublish=args.prepublish or args.publish, - publish=args.publish, - send=args.send, - share_automatically=args.share_automatically, - ) - _print_result(result) - return 0 - - post = Post( - post_data.get("title"), - post_data.get("subtitle", ""), - api.get_user_id(), - audience=post_data.get("audience", "everyone"), - write_comment_permissions=post_data.get( - "write_comment_permissions", "everyone" - ), - ) - - section = post_data.get("section") - if section: - post.set_section(section, api.get_sections()) - - for item in post_data.get("body", {}).values(): - if item.get("type") == "captionedImage": - src = item.get("src", "") - if not src.startswith("http"): - image = api.get_image(src) - item.update({"src": image.get("url")}) - post.add(item) - - draft = api.post_draft(post.get_draft()) - draft_id = draft.get("id") - - update_payload = { - "draft_section_id": post.draft_section_id, - "search_engine_title": post_data.get("search_engine_title"), - "search_engine_description": post_data.get("search_engine_description"), - "slug": post_data.get("slug"), - } - update_payload = { - key: value for key, value in update_payload.items() if value is not None - } - if update_payload: - draft = api.put_draft(draft_id, **update_payload) - - tags = Api._normalize_tags(post_data.get("tags")) - if tags: - api.add_tags_to_post(draft_id, tags) - - if args.prepublish or args.publish: - api.prepublish_draft(draft_id) - if args.publish: - api.publish_draft( - draft_id, - send=args.send, - share_automatically=args.share_automatically, - ) - - print(json.dumps({"draft_id": draft_id, "draft": draft}, indent=2)) - return 0 - - -def auth_check(argv=None): - parser = argparse.ArgumentParser() - parser.add_argument("--cookies") - args = parser.parse_args(argv) - - api = _api_from_env(args.cookies) - profile = api.get_user_profile() - primary_publication = api.get_user_primary_publication() - publications = api.get_user_publications() - - identity = ( - profile.get("email") - or profile.get("name") - or profile.get("handle") - or str(profile.get("id", "unknown")) - ) - - print(f"Authenticated as: {identity}") - print(f"Auth method: {_auth_method(args.cookies)}") - print(f"Primary publication: {primary_publication.get('name', 'unknown')}") - print(f"Publication URL: {primary_publication.get('publication_url', 'unknown')}") - print(f"Available publications: {len(publications)}") - return 0 diff --git a/substack/exceptions.py b/substack/exceptions.py index be142ba..27a0301 100644 --- a/substack/exceptions.py +++ b/substack/exceptions.py @@ -1,70 +1,28 @@ -import json -import re - - -def _redact_message(text: str) -> str: - if not text: - return text - # Redact common cookie-like values and session tokens - # e.g., s%3A... or s:... which are typical for express session cookies - text = re.sub(r"s%3A[a-zA-Z0-9_\-\.\%]+", "[REDACTED_COOKIE]", text) - text = re.sub(r"s:[a-zA-Z0-9_\-\.\%]+", "[REDACTED_COOKIE]", text) - return text - - -class SubstackException(Exception): - """Base exception for all python-substack exceptions.""" - - pass - - -class SubstackAPIException(SubstackException): - def __init__(self, status_code, text): - text = _redact_message(text) - try: - json_res = json.loads(text) - except ValueError: - self.message = f"Invalid JSON error message from Substack: {text}" - else: - self.message = ", ".join( - list( - map(lambda error: error.get("msg", ""), json_res.get("errors", [])) - ) - ) - self.message = self.message or json_res.get("error", "") - self.status_code = status_code - - def __str__(self): - return f"APIError(code={self.status_code}): {self.message}" - - -class SubstackRequestException(SubstackException): - def __init__(self, message): - self.message = _redact_message(message) - - def __str__(self): - return f"SubstackRequestException: {self.message}" - - -class SectionNotExistsException(SubstackRequestException): - pass - - -class DraftConflictError(ValueError, SubstackException): - """Raised when an update conflicts with the current remote draft state or lacks revision metadata.""" - - def __init__( - self, - message: str, - mismatches: list = None, - expected_revision: dict = None, - current_revision: dict = None, - ): - super().__init__(message) - self.message = message - self.mismatches = mismatches or [] - self.expected_revision = expected_revision - self.current_revision = current_revision - - def __str__(self): - return self.message +import json + + +class SubstackAPIException(Exception): + def __init__(self, status_code, text): + try: + json_res = json.loads(text) + except ValueError: + self.message = f"Invalid JSON error message from Substack: {text}" + else: + self.message = ", ".join( + list( + map(lambda error: error.get("msg", ""), json_res.get("errors", [])) + ) + ) + self.message = self.message or json_res.get("error", "") + self.status_code = status_code + + def __str__(self): + return f"APIError(code={self.status_code}): {self.message}" + + +class SubstackRequestException(Exception): + def __init__(self, message): + self.message = message + + def __str__(self): + return f"SubstackRequestException: {self.message}" diff --git a/substack/mdexport.py b/substack/mdexport.py deleted file mode 100644 index 612f037..0000000 --- a/substack/mdexport.py +++ /dev/null @@ -1,413 +0,0 @@ -import base64 -import copy -import json -import re - -_BLOCK_TYPES = { - "paragraph", - "heading", - "blockquote", - "codeBlock", - "horizontal_rule", - "bullet_list", - "ordered_list", - "captionedImage", - "footnote", - "latex_block", - "pullquote", - "calloutBlock", -} -_MARK_TYPES = { - "strong", - "em", - "code", - "strikethrough", - "superscript", - "subscript", - "link", - "textStyle", - "highlight", -} -_IMAGE_ATTRS = { - "src", - "srcNoWatermark", - "fullscreen", - "imageSize", - "height", - "width", - "resizeWidth", - "bytes", - "alt", - "title", - "type", - "href", - "belowTheFold", - "topImage", - "internalRedirect", - "isProcessing", - "align", - "offset", -} - - -def _marker(node, unsupported): - unsupported.append(copy.deepcopy(node)) - payload = json.dumps( - node, ensure_ascii=False, separators=(",", ":"), sort_keys=True - ).encode("utf-8") - encoded = base64.urlsafe_b64encode(payload).decode("ascii").rstrip("=") - return f"" - - -def _image_marker(attrs): - payload_data = { - "src": attrs["src"], - **{ - key: value - for key, value in attrs.items() - if key not in {"src", "alt", "href", "isProcessing"} - }, - } - payload = json.dumps( - payload_data, ensure_ascii=False, separators=(",", ":"), sort_keys=True - ).encode("utf-8") - encoded = base64.urlsafe_b64encode(payload).decode("ascii").rstrip("=") - return f"\n" - - -def _require_dict(node, context): - if not isinstance(node, dict): - raise ValueError(f"Malformed draft body: {context} must be an object") - if not isinstance(node.get("type"), str) or not node["type"]: - raise ValueError(f"Malformed draft body: {context} has no node type") - - -def _content(node, context): - content = node.get("content", []) - if not isinstance(content, list): - raise ValueError(f"Malformed draft body: {context} content must be a list") - return content - - -def _attrs(node, context): - attrs = node.get("attrs", {}) - if not isinstance(attrs, dict): - raise ValueError(f"Malformed draft body: {context} attrs must be an object") - return attrs - - -def _has_unknown_keys(value, allowed): - return bool(set(value) - set(allowed)) - - -def _escape_text(value): - return re.sub(r"([\\`*_{}\[\]()<>#+\-.!|])", r"\\\1", value) - - -def _escape_destination(value): - return str(value).replace("\\", "\\\\").replace(")", "\\)") - - -def _escape_title(value): - return value.replace("\\", "\\\\").replace('"', '\\"') - - -def _code_span(value): - runs = [len(match.group(0)) for match in re.finditer(r"`+", value)] - delimiter = "`" * max(1, (max(runs) + 1) if runs else 1) - padding = " " if value.startswith(("`", " ")) or value.endswith(("`", " ")) else "" - return f"{delimiter}{padding}{value}{padding}{delimiter}" - - -_ATTR_MARKS = {"link", "textStyle", "highlight"} -_STYLE_PROPERTY = {"textStyle": "color", "highlight": "background-color"} - - -def _render_marked_text(value, marks, node, unsupported): - if not isinstance(value, str) or not isinstance(marks, list): - raise ValueError("Malformed draft body: text and marks have invalid types") - for mark in marks: - _require_dict(mark, "mark") - if mark["type"] not in _MARK_TYPES: - return _marker(node, unsupported) - allowed = {"type", "attrs"} if mark["type"] in _ATTR_MARKS else {"type"} - if _has_unknown_keys(mark, allowed): - return _marker(node, unsupported) - - rendered = ( - _code_span(value) - if any(mark["type"] == "code" for mark in marks) - else _escape_text(value) - ) - style_declarations = [] - for mark in marks: - mark_type = mark["type"] - if mark_type == "code": - continue - if mark_type == "strong": - rendered = f"**{rendered}**" - elif mark_type == "em": - rendered = f"*{rendered}*" - elif mark_type == "strikethrough": - rendered = f"~~{rendered}~~" - elif mark_type == "superscript": - rendered = f"^{rendered}^" - elif mark_type == "subscript": - rendered = f"~{rendered}~" - elif mark_type == "link": - attrs = _attrs(mark, "link mark") - if _has_unknown_keys(attrs, {"href"}) or not isinstance( - attrs.get("href"), str - ): - return _marker(node, unsupported) - rendered = f"[{rendered}]({_escape_destination(attrs['href'])})" - elif mark_type in _STYLE_PROPERTY: - attrs = _attrs(mark, f"{mark_type} mark") - if _has_unknown_keys(attrs, {"color"}) or not isinstance( - attrs.get("color"), str - ): - return _marker(node, unsupported) - style_declarations.append(f"{_STYLE_PROPERTY[mark_type]}:{attrs['color']}") - if style_declarations: - style_value = _escape_title("; ".join(style_declarations)) - rendered = f'[{rendered}]{{style="{style_value}"}}' - return rendered - - -def _render_inline(nodes, unsupported): - if not isinstance(nodes, list): - raise ValueError("Malformed draft body: inline content must be a list") - rendered = [] - for node in nodes: - _require_dict(node, "inline node") - node_type = node["type"] - if node_type == "text": - if _has_unknown_keys(node, {"type", "text", "marks"}): - rendered.append(_marker(node, unsupported)) - continue - rendered.append( - _render_marked_text( - node.get("text"), node.get("marks", []), node, unsupported - ) - ) - elif node_type == "footnoteAnchor": - attrs = _attrs(node, "footnote anchor") - number = attrs.get("number") - if ( - _has_unknown_keys(node, {"type", "attrs"}) - or _has_unknown_keys(attrs, {"number"}) - or not isinstance(number, int) - ): - rendered.append(_marker(node, unsupported)) - else: - rendered.append(f"[^{number}]") - elif node_type == "latex": - attrs = _attrs(node, "inline math") - expression = attrs.get("expression", attrs.get("persistentExpression")) - if ( - _has_unknown_keys(node, {"type", "attrs"}) - or _has_unknown_keys(attrs, {"expression", "persistentExpression"}) - or not isinstance(expression, str) - ): - rendered.append(_marker(node, unsupported)) - else: - rendered.append(f"${expression}$") - else: - rendered.append(_marker(node, unsupported)) - return "".join(rendered) - - -def _render_list(node, unsupported, ordered=False): - lines = [] - for index, item in enumerate(_content(node, "list"), start=1): - _require_dict(item, "list item") - if item["type"] != "list_item" or _has_unknown_keys(item, {"type", "content"}): - item_text = _marker(item, unsupported) - else: - item_blocks = [ - _render_block(child, unsupported) - for child in _content(item, "list item") - ] - item_text = "\n\n".join(item_blocks) - prefix = f"{index}. " if ordered else "- " - item_lines = item_text.splitlines() or [""] - lines.append(prefix + item_lines[0]) - lines.extend(" " + line if line else "" for line in item_lines[1:]) - return "\n".join(lines) - - -def _render_image(node, unsupported): - content = _content(node, "captioned image") - if not content: - raise ValueError("Malformed draft body: captioned image has no image") - image = content[0] - _require_dict(image, "image") - attrs = _attrs(image, "image") - if ( - image["type"] != "image2" - or _has_unknown_keys(node, {"type", "content"}) - or _has_unknown_keys(image, {"type", "attrs"}) - or not isinstance(attrs.get("src"), str) - ): - return _marker(node, unsupported) - - alt = str(attrs.get("alt") or "").replace("\\", "\\\\").replace("]", "\\]") - image_markdown = f"![{alt}]({_escape_destination(attrs['src'])}" - if len(content) > 2: - return _marker(node, unsupported) - if len(content) == 2: - caption = content[1] - _require_dict(caption, "image caption") - caption_nodes = _content(caption, "image caption") - if ( - caption["type"] != "caption" - or _has_unknown_keys(caption, {"type", "content"}) - or any( - not isinstance(child, dict) - or child.get("type") != "text" - or child.get("marks") - or not isinstance(child.get("text"), str) - for child in caption_nodes - ) - ): - return _marker(node, unsupported) - caption_text = "".join(child.get("text", "") for child in caption_nodes) - image_markdown += f' "{_escape_title(caption_text)}"' - image_markdown += ")" - href = attrs.get("href") - if href: - if not isinstance(href, str): - return _marker(node, unsupported) - image_markdown = f"[{image_markdown}]({_escape_destination(href)})" - return image_markdown + _image_marker(attrs) - - -def _render_footnote(node, unsupported): - attrs = _attrs(node, "footnote") - number = attrs.get("number") - if ( - _has_unknown_keys(node, {"type", "attrs", "content"}) - or _has_unknown_keys(attrs, {"number"}) - or not isinstance(number, int) - ): - return _marker(node, unsupported) - body = "\n\n".join( - _render_block(child, unsupported) for child in _content(node, "footnote") - ) - lines = body.splitlines() or [""] - return f"[^{number}]: {lines[0]}" + "".join( - f"\n {line}" if line else "\n" for line in lines[1:] - ) - - -def _render_block(node, unsupported): - _require_dict(node, "block node") - node_type = node["type"] - if node_type not in _BLOCK_TYPES: - return _marker(node, unsupported) - - if node_type == "paragraph": - if _has_unknown_keys(node, {"type", "content"}): - return _marker(node, unsupported) - return _render_inline(_content(node, "paragraph"), unsupported) - if node_type == "heading": - attrs = _attrs(node, "heading") - level = attrs.get("level") - if ( - _has_unknown_keys(node, {"type", "content", "attrs"}) - or _has_unknown_keys(attrs, {"level"}) - or not isinstance(level, int) - or not 1 <= level <= 6 - ): - return _marker(node, unsupported) - return f"{'#' * level} {_render_inline(_content(node, 'heading'), unsupported)}" - if node_type == "horizontal_rule": - return ( - "---" - if not _has_unknown_keys(node, {"type"}) - else _marker(node, unsupported) - ) - if node_type == "codeBlock": - attrs = _attrs(node, "code block") - if _has_unknown_keys(node, {"type", "content", "attrs"}) or _has_unknown_keys( - attrs, {"language"} - ): - return _marker(node, unsupported) - code_nodes = _content(node, "code block") - if any( - not isinstance(child, dict) - or child.get("type") != "text" - or _has_unknown_keys(child, {"type", "text"}) - or not isinstance(child.get("text"), str) - for child in code_nodes - ): - raise ValueError("Malformed draft body: invalid code block content") - code = "".join(child["text"] for child in code_nodes) - runs = [len(match.group(0)) for match in re.finditer(r"`+", code)] - fence = "`" * max(3, (max(runs) + 1) if runs else 3) - language = attrs.get("language") or "" - if not isinstance(language, str) or "\n" in language: - return _marker(node, unsupported) - return f"{fence}{language}\n{code}\n{fence}" - if node_type == "blockquote": - if _has_unknown_keys(node, {"type", "content"}): - return _marker(node, unsupported) - body = "\n\n".join( - _render_block(child, unsupported) for child in _content(node, "blockquote") - ) - return "\n".join(">" if not line else f"> {line}" for line in body.splitlines()) - if node_type in {"bullet_list", "ordered_list"}: - if _has_unknown_keys(node, {"type", "content"}): - return _marker(node, unsupported) - return _render_list(node, unsupported, ordered=node_type == "ordered_list") - if node_type == "captionedImage": - return _render_image(node, unsupported) - if node_type == "footnote": - return _render_footnote(node, unsupported) - if node_type == "latex_block": - attrs = _attrs(node, "math block") - expression = attrs.get("persistentExpression", attrs.get("expression")) - if ( - _has_unknown_keys(node, {"type", "attrs"}) - or _has_unknown_keys(attrs, {"persistentExpression", "expression", "dirty"}) - or not isinstance(expression, str) - ): - return _marker(node, unsupported) - return f"$$\n{expression}\n$$" - if node_type in {"pullquote", "calloutBlock"}: - allowed = ( - {"type", "content", "attrs"} - if node_type == "pullquote" - else {"type", "content"} - ) - if _has_unknown_keys(node, allowed): - return _marker(node, unsupported) - if node_type == "pullquote": - attrs = _attrs(node, "pull quote") - if _has_unknown_keys(attrs, {"align", "color"}) or any( - attrs.get(key) is not None for key in ("align", "color") - ): - return _marker(node, unsupported) - body = "\n\n".join( - _render_block(child, unsupported) for child in _content(node, node_type) - ) - name = "pullquote" if node_type == "pullquote" else "callout" - return f"::: {name}\n{body}\n:::" - raise AssertionError(node_type) - - -def document_to_markdown(document): - _require_dict(document, "document") - if document["type"] != "doc": - raise ValueError("Malformed draft body: root node must have type 'doc'") - if _has_unknown_keys(document, {"type", "content"}): - raise ValueError("Malformed draft body: document has unsupported root fields") - - unsupported = [] - blocks = [ - _render_block(node, unsupported) for node in _content(document, "document") - ] - markdown = "\n\n".join(blocks) - if markdown: - markdown += "\n" - return markdown, unsupported diff --git a/substack/mdrender.py b/substack/mdrender.py deleted file mode 100644 index 355889f..0000000 --- a/substack/mdrender.py +++ /dev/null @@ -1,430 +0,0 @@ -"""Markdown -> Substack ProseMirror via markdown-it-py. - -Implements Post.from_markdown() using a real CommonMark parser (markdown-it-py) -plus the standard footnote plugin, with a small renderer that walks the syntax -tree into Substack's node schema. - -Node construction goes through ``substack.nodes`` so the (undocumented) schema -lives in exactly one place. - -Footnotes: Substack numbers footnote anchors by their position in the document -and pairs them one-to-one, in order, with the footnote blocks at the end (it -ignores any explicit number and does not support one block serving several -anchors). So each reference is emitted as its own sequentially-numbered anchor, -and a matching footnote block is appended for each -- a definition referenced -more than once is duplicated, which mirrors how Substack's own editor behaves. -""" - -from __future__ import annotations - -import base64 -import copy -import json -import re -from pathlib import Path -from typing import Dict, List, Optional -from urllib.parse import unquote, urlsplit - -from markdown_it import MarkdownIt -from markdown_it.tree import SyntaxTreeNode -from mdit_py_plugins.attrs import attrs_plugin -from mdit_py_plugins.container import container_plugin -from mdit_py_plugins.dollarmath import dollarmath_plugin -from mdit_py_plugins.footnote import footnote_plugin -from mdit_py_plugins.subscript import sub_plugin -from mdit_py_plugins.superscript import superscript_plugin - -from substack import nodes -from substack.nodes import MarkType, NodeType - -_MARK_FOR = { - "strong": {"type": MarkType.STRONG}, - "em": {"type": MarkType.EM}, - "s": {"type": MarkType.STRIKETHROUGH}, - "sup": {"type": MarkType.SUPERSCRIPT}, - "sub": {"type": MarkType.SUBSCRIPT}, -} - - -def parse_node_marker(comment_content: str) -> dict | None: - """ - Parse a python-substack-node:v1 comment marker and return the parsed JSON dictionary. - - If it is not a python-substack-node:v1 marker, returns None. - If it is an attempted marker but is corrupt/malformed, raises ValueError. - """ - clean = comment_content.strip() - match = re.match( - r"^$", clean - ) - if not match: - if "python-substack-node:v1" in clean: - raise ValueError("Corrupt marker format") - return None - - encoded = match.group(1) - - try: - padding = len(encoded) % 4 - if padding: - encoded += "=" * (4 - padding) - decoded_bytes = base64.urlsafe_b64decode(encoded.encode("ascii")) - except Exception as exc: - raise ValueError("Invalid URL-safe base64 in marker") from exc - - try: - decoded_str = decoded_bytes.decode("utf-8") - except Exception as exc: - raise ValueError("Invalid UTF-8 in marker") from exc - - try: - data = json.loads(decoded_str) - except Exception as exc: - raise ValueError("Invalid JSON in marker") from exc - - if not isinstance(data, dict): - raise ValueError("Marker payload is not a top-level JSON object") - - node_type = data.get("type") - if not isinstance(node_type, str) or not node_type: - raise ValueError("Marker payload has missing or empty 'type'") - - return data - - -def parse_image_marker(comment_content: str) -> dict | None: - clean = comment_content.strip() - match = re.match( - r"^$", clean - ) - if not match: - if "python-substack-image:" in clean: - raise ValueError("Corrupt image marker format") - return None - version_str, encoded = match.group(1), match.group(2) - encoded += "=" * (-len(encoded) % 4) - try: - decoded_bytes = base64.urlsafe_b64decode(encoded.encode("ascii")) - except Exception as exc: - raise ValueError("Invalid image marker") from exc - try: - attrs = json.loads(decoded_bytes.decode("utf-8")) - except Exception as exc: - raise ValueError("Invalid image marker") from exc - if not isinstance(attrs, dict): - raise ValueError("Invalid image marker attributes") - - if version_str == "v1": - if any(key in {"src", "alt", "href", "isProcessing"} for key in attrs): - raise ValueError("Invalid image marker attributes") - return {"version": 1, "src": None, "attrs": attrs} - - if version_str == "v2": - if "src" not in attrs or not isinstance(attrs["src"], str): - raise ValueError("Invalid image marker attributes") - if any(key in {"alt", "href", "isProcessing"} for key in attrs): - raise ValueError("Invalid image marker attributes") - preserved = {k: v for k, v in attrs.items() if k != "src"} - return {"version": 2, "src": attrs["src"], "attrs": preserved} - - return None - - -def _make_parser() -> MarkdownIt: - return ( - MarkdownIt("commonmark") - .use(footnote_plugin) - # Pandoc-style delimiters: no whitespace just inside the dollars and no - # digit just outside them, so paired currency amounts ("$5 ... $10") - # stay plain text instead of becoming math. - .use(dollarmath_plugin, allow_space=False, allow_digits=False) - .use(sub_plugin) - .use(superscript_plugin) - .use(container_plugin, name="pullquote") - .use(container_plugin, name="callout") - # Pandoc-style span attributes, `[text]{style="color:#hex"}`, for text - # color and highlight. Restricted to spans only (`after=()`) so a - # stray `{...}` after an image, link or inline code is left as text. - .use(attrs_plugin, after=(), spans=True) - .enable("strikethrough") - ) - - -def _coalesce(out_nodes: List[Dict]) -> List[Dict]: - """Merge adjacent text nodes that carry identical marks (e.g. softbreaks).""" - merged: List[Dict] = [] - for node in out_nodes: - if ( - merged - and node.get("type") == NodeType.TEXT - and merged[-1].get("type") == NodeType.TEXT - and node.get("marks") == merged[-1].get("marks") - ): - merged[-1]["text"] += node["text"] - else: - merged.append(node) - return merged - - -def _style_marks(attrs: Dict) -> List[Dict]: - """Map a span's `style` attribute to textStyle/highlight marks. - - Only `color` and `background-color` declarations are recognized; any - other declaration is ignored rather than rejected, since `{...}` spans - are also used (via the attrs plugin) for plain CSS-style attributes in - general, not just color. The last nonempty declaration for each property - wins, so each style contributes at most one mark of its type. - """ - style = attrs.get("style", "") - marks: Dict[str, Dict] = {} - for declaration in style.split(";"): - prop, _, value = declaration.partition(":") - prop, value = prop.strip().lower(), value.strip() - if not value: - continue - if prop == "color": - marks[MarkType.TEXT_STYLE] = nodes.text_style_mark(value) - elif prop == "background-color": - marks[MarkType.HIGHLIGHT] = nodes.highlight_mark(value) - return list(marks.values()) - - -def _render_inline(node: SyntaxTreeNode, marks: List[Dict], ctx: Dict) -> List[Dict]: - """Render an inline subtree into a flat list of text / anchor nodes.""" - out: List[Dict] = [] - for child in node.children: - t = child.type - if t == "text": - if child.content: - out.append(nodes.text(child.content, marks)) - elif t == "code_inline": - out.append(nodes.text(child.content, marks + [nodes.code_mark()])) - elif t == "math_inline": - out.append(nodes.latex_inline(child.content.strip())) - elif t in _MARK_FOR: - out.extend(_render_inline(child, marks + [_MARK_FOR[t]], ctx)) - elif t == "link": - href = child.attrs.get("href", "") - out.extend(_render_inline(child, marks + [nodes.link_mark(href)], ctx)) - elif t == "span": - # Replace inherited styles without mutating the parent/sibling marks. - span_marks = {mark["type"]: mark for mark in marks} - span_marks.update( - (mark["type"], mark) for mark in _style_marks(child.attrs) - ) - out.extend(_render_inline(child, list(span_marks.values()), ctx)) - elif t in ("softbreak", "hardbreak"): - out.append(nodes.text(" ", marks)) - elif t == "footnote_ref": - # Number anchors by document position and record which definition each - # one points to, so matching blocks can be emitted 1:1 afterwards. - ctx["order"].append(child.meta["id"]) - out.append(nodes.footnote_anchor(len(ctx["order"]))) - elif t == "image": - # Inline images are rare in this schema; fall back to alt text. - alt = child.attrs.get("alt") or "".join( - c.content for c in child.children if c.type == "text" - ) - if alt: - out.append(nodes.text(alt, marks)) - elif t == "html_inline": - if "python-substack-image:" in child.content: - raise ValueError("Image marker must immediately follow an image") - marker_data = parse_node_marker(child.content) - if marker_data is not None: - out.append(marker_data) - return _coalesce(out) - - -def _only_image(inline: SyntaxTreeNode) -> Optional[SyntaxTreeNode]: - """If an inline node is just an image (optionally wrapped in a link), return it.""" - kids = [c for c in inline.children if c.type != "softbreak"] - if len(kids) == 1 and kids[0].type == "image": - return kids[0] - if len(kids) == 1 and kids[0].type == "link": - inner = [c for c in kids[0].children if c.type != "softbreak"] - if len(inner) == 1 and inner[0].type == "image": - img = inner[0] - img._link_href = kids[0].attrs.get("href") # type: ignore[attr-defined] - return img - return None - - -def _captioned_image(img: SyntaxTreeNode, api) -> Dict: - src = img.attrs.get("src", "") - if api is not None and ( - urlsplit(src).scheme.lower() not in ("http", "https") - and not src.startswith("//") - ): - # Markdown destinations encode spaces and non-ASCII characters as URLs. - path = Path(unquote(src)).expanduser() - if not path.is_file() and src.startswith("/"): - # Preserve legacy root-relative asset paths only when they resolve - # to a real file; an existing absolute path always takes precedence. - relative = Path(unquote(src[1:])) - if relative.is_file(): - path = relative - if not path.is_file(): - raise FileNotFoundError(f"Local image file not found: {path}") - try: - uploaded = api.get_image(str(path)) - url = uploaded.get("url") - if not isinstance(url, str) or not url.startswith(("https://", "http://")): - raise ValueError("Upload did not return an HTTP image URL") - except Exception as exc: - raise ValueError(f"Failed to upload local image: {path}") from exc - src = url - # markdown-it stores the image alt text as the node's content, not in attrs. - alt = img.content or img.attrs.get("alt") or None - # Standard markdown image title `![alt](src "caption")` maps to Substack's caption node. - title = img.attrs.get("title") or None - caption = [nodes.text(title)] if title else None - return nodes.captioned_image( - src, - alt=alt, - href=getattr(img, "_link_href", None), - caption=caption, - ) - - -def _render_block(node: SyntaxTreeNode, api, ctx: Dict) -> List[Dict]: - """Render a block-level node into zero or more Substack nodes.""" - t = node.type - - if t == "html_block": - marker_data = parse_node_marker(node.content) - if marker_data is not None: - return [marker_data] - return [] - - if t == "paragraph": - inline = node.children[0] - img = _only_image(inline) - if img is not None: - return [_captioned_image(img, api)] - return [nodes.paragraph(_render_inline(inline, [], ctx))] - - if t == "heading": - level = int(node.tag[1]) - return [nodes.heading(_render_inline(node.children[0], [], ctx), level=level)] - - if t == "hr": - return [nodes.horizontal_rule()] - - if t in ("fence", "code_block"): - return [ - nodes.code_block( - node.content.rstrip("\n"), language=node.info.strip() or None - ) - ] - - if t == "blockquote": - paras: List[Dict] = [] - for child in node.children: - paras.extend(_render_block(child, api, ctx)) - return [nodes.blockquote(paras)] - - if t == "bullet_list": - return [nodes.bullet_list(_render_list_items(node, api, ctx))] - - if t == "ordered_list": - return [nodes.ordered_list(_render_list_items(node, api, ctx))] - - # "$$...$$ (label)" tokenizes as math_block_label; Substack has no equation - # labels, so it renders like an unlabeled block. - if t in ("math_block", "math_block_label"): - return [nodes.latex_block(node.content.strip())] - - if t == "container_pullquote": - return [nodes.pullquote(_render_container_body(node, api, ctx))] - - if t == "container_callout": - return [nodes.callout_block(_render_container_body(node, api, ctx))] - - # footnote_block is handled separately in markdown_to_doc; ignore it here. - return [] - - -def _render_container_body(node: SyntaxTreeNode, api, ctx: Dict) -> List[Dict]: - body: List[Dict] = [] - for child in node.children: - body.extend(_render_block(child, api, ctx)) - return body - - -def _render_list_items(list_node: SyntaxTreeNode, api, ctx: Dict) -> List[Dict]: - items = [] - for li in list_node.children: - content: List[Dict] = [] - for child in li.children: - content.extend(_render_block(child, api, ctx)) - items.append({"type": NodeType.LIST_ITEM, "content": content}) - return items - - -def _footnote_definitions(tree: SyntaxTreeNode, api) -> Dict[int, List[Dict]]: - """Map each footnote id to its rendered block content.""" - definitions: Dict[int, List[Dict]] = {} - for node in tree.children: - if node.type != "footnote_block": - continue - for fn in node.children: - # A footnote's own content should not register anchors of its own. - local_ctx = {"order": []} - content: List[Dict] = [] - for child in fn.children: - content.extend(_render_block(child, api, local_ctx)) - definitions[fn.meta["id"]] = content - return definitions - - -def markdown_to_doc( - markdown_content: str, api=None, track_markers: Optional[List] = None -) -> List[Dict]: - """Convert Markdown into a list of Substack ProseMirror block nodes.""" - tree = SyntaxTreeNode(_make_parser().parse(markdown_content)) - - definitions = _footnote_definitions(tree, api) - - ctx: Dict = {"order": []} - out: List[Dict] = [] - last_was_image = False - last_image_idx: Optional[int] = None - - for node in tree.children: - if node.type == "footnote_block": - last_was_image = False - continue - if node.type == "html_block": - marker = parse_image_marker(node.content) - if marker is not None: - if not last_was_image or last_image_idx is None: - raise ValueError("Image marker must immediately follow an image") - last_was_image = False - out[last_image_idx]["content"][0]["attrs"].update(marker["attrs"]) - out[last_image_idx]["content"][0]["attrs"]["isProcessing"] = False - if track_markers is not None: - track_markers[-1] = marker - continue - last_was_image = False - - rendered = _render_block(node, api, ctx) - if rendered: - for blk in rendered: - out.append(blk) - if blk.get("type") == NodeType.CAPTIONED_IMAGE: - last_was_image = True - last_image_idx = len(out) - 1 - if track_markers is not None: - track_markers.append(None) - else: - last_was_image = False - else: - last_was_image = False - - # Emit one footnote block per reference, in anchor order, numbered to match. - for number, footnote_id in enumerate(ctx["order"], start=1): - content = copy.deepcopy(definitions.get(footnote_id, [])) - out.append(nodes.footnote(number, content)) - - return out diff --git a/substack/nodes.py b/substack/nodes.py deleted file mode 100644 index ce751cf..0000000 --- a/substack/nodes.py +++ /dev/null @@ -1,193 +0,0 @@ -"""ProseMirror node builders for Substack documents. - -Centralises the (undocumented) Substack ProseMirror schema in one place. -The node-type strings ("paragraph", "footnoteAnchor", "image2", ...) and -their shapes live here rather than as inline dict literals scattered across -post.py, giving: - - * one source of truth for node shapes (so a schema change is a one-line fix), - * discoverable, typed constructors instead of bare dict literals, - * a natural seam for validation. - -The builders intentionally return plain dicts so they stay 100% compatible with -the existing draft_body structure. -""" - -from __future__ import annotations - -from typing import Dict, List, Optional - - -class NodeType: - DOC = "doc" - PARAGRAPH = "paragraph" - HEADING = "heading" - TEXT = "text" - BLOCKQUOTE = "blockquote" - CODE_BLOCK = "codeBlock" - HORIZONTAL_RULE = "horizontal_rule" - BULLET_LIST = "bullet_list" - ORDERED_LIST = "ordered_list" - LIST_ITEM = "list_item" - FOOTNOTE = "footnote" - FOOTNOTE_ANCHOR = "footnoteAnchor" - CAPTIONED_IMAGE = "captionedImage" - CAPTION = "caption" - LATEX_BLOCK = "latex_block" - LATEX_INLINE = "latex" - PULLQUOTE = "pullquote" - CALLOUT_BLOCK = "calloutBlock" - - -class MarkType: - STRONG = "strong" - EM = "em" - CODE = "code" - STRIKETHROUGH = "strikethrough" - SUPERSCRIPT = "superscript" - SUBSCRIPT = "subscript" - LINK = "link" - TEXT_STYLE = "textStyle" - HIGHLIGHT = "highlight" - - -def code_mark() -> Dict: - return {"type": MarkType.CODE} - - -def text(value: str, marks: Optional[List[Dict]] = None) -> Dict: - node: Dict = {"type": NodeType.TEXT, "text": value} - if marks: - node["marks"] = marks - return node - - -def link_mark(href: str) -> Dict: - return {"type": MarkType.LINK, "attrs": {"href": href}} - - -def text_style_mark(color: str) -> Dict: - return {"type": MarkType.TEXT_STYLE, "attrs": {"color": color}} - - -def highlight_mark(color: str) -> Dict: - return {"type": MarkType.HIGHLIGHT, "attrs": {"color": color}} - - -def paragraph(content: Optional[List[Dict]] = None) -> Dict: - return {"type": NodeType.PARAGRAPH, "content": content or []} - - -def heading(content: List[Dict], level: int = 1) -> Dict: - return {"type": NodeType.HEADING, "content": content, "attrs": {"level": level}} - - -def horizontal_rule() -> Dict: - return {"type": NodeType.HORIZONTAL_RULE} - - -def blockquote(paragraphs: List[Dict]) -> Dict: - node: Dict = {"type": NodeType.BLOCKQUOTE} - if paragraphs: - node["content"] = paragraphs - return node - - -def list_item(content_nodes: List[Dict]) -> Dict: - return { - "type": NodeType.LIST_ITEM, - "content": [paragraph(content_nodes)], - } - - -def bullet_list(items: List[Dict]) -> Dict: - return {"type": NodeType.BULLET_LIST, "content": items} - - -def ordered_list(items: List[Dict]) -> Dict: - return {"type": NodeType.ORDERED_LIST, "content": items} - - -def code_block(code: str, language: Optional[str] = None) -> Dict: - node: Dict = {"type": NodeType.CODE_BLOCK, "content": [text(code)]} - if language: - node["attrs"] = {"language": language} - return node - - -def captioned_image( - src: str, - alt: Optional[str] = None, - href: Optional[str] = None, - caption: Optional[List[Dict]] = None, - image_size: str = "normal", -) -> Dict: - content: List[Dict] = [ - { - "type": "image2", - "attrs": { - "src": src, - "srcNoWatermark": None, - "fullscreen": False, - "imageSize": image_size, - "height": 819, - "width": 1456, - "resizeWidth": 728 if image_size == "normal" else None, - "bytes": None, - "alt": alt, - "title": None, - "type": None, - "href": href, - "belowTheFold": False, - "topImage": False, - "internalRedirect": None, - "isProcessing": False, - "align": None, - "offset": False, - }, - } - ] - if caption: - content.append({"type": NodeType.CAPTION, "content": caption}) - return {"type": NodeType.CAPTIONED_IMAGE, "content": content} - - -def footnote_anchor(number: int) -> Dict: - return {"type": NodeType.FOOTNOTE_ANCHOR, "attrs": {"number": number}} - - -def footnote(number: int, paragraphs: List[Dict]) -> Dict: - return { - "type": NodeType.FOOTNOTE, - "attrs": {"number": number}, - "content": paragraphs or [paragraph()], - } - - -def latex_block(expression: str) -> Dict: - return { - "type": NodeType.LATEX_BLOCK, - "attrs": {"persistentExpression": expression, "dirty": True}, - } - - -def latex_inline(expression: str) -> Dict: - return { - "type": NodeType.LATEX_INLINE, - "attrs": {"expression": expression, "persistentExpression": expression}, - } - - -def pullquote(paragraphs: List[Dict]) -> Dict: - return { - "type": NodeType.PULLQUOTE, - "attrs": {"align": None, "color": None}, - "content": paragraphs or [paragraph()], - } - - -def callout_block(paragraphs: List[Dict]) -> Dict: - return { - "type": NodeType.CALLOUT_BLOCK, - "content": paragraphs or [paragraph()], - } diff --git a/substack/post.py b/substack/post.py index 1d58385..84488a7 100644 --- a/substack/post.py +++ b/substack/post.py @@ -1,171 +1,17 @@ -""" - -Post Utilities - -""" - import json -import re -from typing import Dict, List - -__all__ = ["Post", "parse_inline", "tokens_to_text_nodes"] - -from substack import nodes -from substack.exceptions import SectionNotExistsException - - -def tokens_to_text_nodes(tokens: List[Dict]) -> List[Dict]: - """Convert parse_inline() tokens to ProseMirror text nodes. - - parse_inline() returns {"content": "text", "marks": [...]}. - ProseMirror expects {"type": "text", "text": "text", "marks": [...]}. - """ - nodes = [] - for token in tokens: - if not token or not token.get("content"): - continue - node = {"type": "text", "text": token["content"]} - marks = token.get("marks") - if marks: - node["marks"] = marks - nodes.append(node) - return nodes - - -def parse_inline(text: str) -> List[Dict]: - """ - Convert inline Markdown in a text string into a list of tokens - for use in the post content. - - Supported formatting: - - `code`: Text wrapped in backticks. - - **Bold**: Text wrapped in double asterisks. - - *Italic*: Text wrapped in single asterisks. - - ***Bold+Italic***: Text wrapped in triple asterisks. - - ~~Strikethrough~~: Text wrapped in double tildes. - - [Links]: Text wrapped in square brackets followed by URL in parentheses. - - Args: - text: Text string containing inline Markdown formatting. - - Returns: - List of token dictionaries with content and marks. - - Example: - >>> parse_inline("This is **bold** and this is [a link](https://example.com)") - [{'content': 'This is '}, {'content': 'bold', 'marks': [{'type': 'strong'}]}, {'content': ' and this is '}, {'content': 'a link', 'marks': [{'type': 'link', 'attrs': {'href': 'https://example.com'}}]}] - """ - if not text: - return [] - - tokens = [] - - # Pattern order matters: code > links > bold+italic > bold > italic > strikethrough - code_pattern = r"`([^`]+)`" - link_pattern = r"\[([^\]]+)\]\(([^)]+)\)" - bold_italic_pattern = r"\*\*\*([^*]+)\*\*\*" - bold_pattern = r"\*\*([^*]+)\*\*" - italic_pattern = r"(? last_pos: - tokens.append({"content": text[last_pos:start]}) - - # Add the formatted content - if match_type == "code": - tokens.append({"content": content, "marks": [{"type": "code"}]}) - elif match_type == "link": - tokens.append( - { - "content": content, - "marks": [{"type": "link", "attrs": {"href": url}}], - } - ) - elif match_type == "bold_italic": - tokens.append( - {"content": content, "marks": [{"type": "strong"}, {"type": "em"}]} - ) - elif match_type == "bold": - tokens.append({"content": content, "marks": [{"type": "strong"}]}) - elif match_type == "italic": - tokens.append({"content": content, "marks": [{"type": "em"}]}) - elif match_type == "strikethrough": - tokens.append({"content": content, "marks": [{"type": "strikethrough"}]}) - - last_pos = end - - # Add remaining text - if last_pos < len(text): - tokens.append({"content": text[last_pos:]}) - - # Filter out empty tokens - tokens = [t for t in tokens if t.get("content")] - - return tokens +from typing import Dict +__all__ = ["Post"] -class Post: - """ - - Post utility class - - """ +class Post: def __init__( - self, - title: str, - subtitle: str, - user_id, - audience: str = None, - write_comment_permissions: str = None, + self, + title: str, + subtitle: str, + user_id, + audience: str = None, + write_comment_permissions: str = None, ): """ @@ -181,8 +27,6 @@ def __init__( self.draft_body = {"type": "doc", "content": []} self.draft_bylines = [{"id": int(user_id), "is_guest": False}] self.audience = audience if audience is not None else "everyone" - self.draft_section_id = None - self.section_chosen = True # TODO better understand the possible values and combinations with audience if write_comment_permissions is not None: @@ -190,22 +34,6 @@ def __init__( else: self.write_comment_permissions = self.audience - def set_section(self, name: str, sections: list): - """ - - Args: - name: - sections: - - Returns: - - """ - section = [s for s in sections if s.get("name") == name] - if len(section) != 1: - raise SectionNotExistsException(name) - section = section[0] - self.draft_section_id = section.get("id") - def add(self, item: Dict): """ @@ -224,14 +52,10 @@ def add(self, item: Dict): content = item.get("content") if item.get("type") == "captionedImage": self.captioned_image(**item) - elif item.get("type") == "embeddedPublication": - self.draft_body["content"][-1]["attrs"] = item.get("url") elif item.get("type") == "youtube2": self.youtube(item.get("src")) elif item.get("type") == "subscribeWidget": self.subscribe_with_caption(item.get("message")) - elif item.get("type") == "codeBlock": - self.code_block(item.get("content"), item.get("attrs", {})) else: if content is not None: self.add_complex_text(content) @@ -276,42 +100,6 @@ def heading(self, content=None, level: int = 1): item["level"] = level return self.add(item) - def blockquote(self, content=None): - """ - Add a blockquote to the post. - - The blockquote wraps one or more paragraph nodes. - - Args: - content: Text string or list of inline token dicts. When a plain - string is provided it is wrapped in a single paragraph node. - - Returns: - Self for method chaining. - """ - paragraphs: List[Dict] = [] - if content is not None: - if isinstance(content, str): - tokens = parse_inline(content) - text_nodes = [ - {"type": "text", "text": t["content"]} for t in tokens if t - ] - if text_nodes: - paragraphs.append({"type": "paragraph", "content": text_nodes}) - elif isinstance(content, list): - for item in content: - if isinstance(item, dict) and item.get("type") == "paragraph": - paragraphs.append(item) - elif isinstance(item, dict): - text_nodes = [{"type": "text", "text": item.get("content", "")}] - paragraphs.append({"type": "paragraph", "content": text_nodes}) - - node: Dict = {"type": "blockquote"} - if paragraphs: - node["content"] = paragraphs - self.draft_body["content"] = self.draft_body.get("content", []) + [node] - return self - def horizontal_rule(self): """ @@ -335,20 +123,20 @@ def attrs(self, level): return self def captioned_image( - self, - src: str, - fullscreen: bool = False, - imageSize: str = "normal", - height: int = 819, - width: int = 1456, - resizeWidth: int = 728, - bytes: str = None, - alt: str = None, - title: str = None, - type: str = None, - href: str = None, - belowTheFold: bool = False, - internalRedirect: str = None, + self, + src: str, + fullscreen: bool = False, + imageSize: str = "normal", + height: int = 819, + width: int = 1456, + resizeWidth: int = 728, + bytes: str = None, + alt: str = None, + title: str = None, + type: str = None, + href: str = None, + belowTheFold: bool = False, + internalRedirect: str = None, ): """ @@ -437,14 +225,14 @@ def marks(self, marks): for mark in marks: new_mark = {"type": mark.get("type")} if mark.get("type") == "link": - href = mark.get("href") or mark.get("attrs", {}).get("href") + href = mark.get("href") new_mark.update({"attrs": {"href": href}}) content_marks.append(new_mark) content["marks"] = content_marks return self def remove_last_paragraph(self): - """Remove last paragraph""" + """ """ del self.draft_body.get("content")[-1] def get_draft(self): @@ -474,11 +262,7 @@ def subscribe_with_caption(self, message: str = None): Subscribe for free to receive new posts and support my work.""" subscribe = self.draft_body["content"][-1] - subscribe["attrs"] = { - "url": "%%checkout_url%%", - "text": "Subscribe", - "language": "en", - } + subscribe["attrs"] = {"url": "%%checkout_url%%", "text": "Subscribe", "language": "en"} subscribe["content"] = [ { "type": "ctaCaption", @@ -507,127 +291,3 @@ def youtube(self, value: str): content_attrs.update({"videoId": value}) self.draft_body["content"][-1]["attrs"] = content_attrs return self - - def code_block(self, content, attrs=None): - """ - Add code block to post. - - Args: - content: String containing code or list of text nodes - attrs: Optional attributes like language - - Returns: - - """ - if attrs is None: - attrs = {} - - # Handle content - can be list of text nodes or a string - if isinstance(content, str): - # Convert string to list of text nodes - code_content = [{"type": "text", "text": content}] - elif isinstance(content, list): - code_content = content - else: - code_content = [] - - # Set up the code block structure - code_block = self.draft_body["content"][-1] - code_block["content"] = code_content - if attrs: - code_block["attrs"] = attrs - - return self - - def footnote_anchor(self, number: int): - """ - - Add an inline footnote reference (the superscript marker) to the last block. - - Args: - number: The footnote number this anchor points to. - - Returns: - Self for method chaining. - - """ - content = self.draft_body["content"][-1].get("content", []) - content += [nodes.footnote_anchor(number)] - self.draft_body["content"][-1]["content"] = content - return self - - def footnote(self, number: int, content=None): - """ - - Append a footnote block (the note shown at the foot of the post). - - Args: - number: The footnote number, matching a footnote_anchor. - content: Text string or list of inline token dicts. A plain string is - parsed for inline Markdown and may contain blank-line-separated - paragraphs; a parse_inline() token list or a list of ready text - nodes is also accepted (single paragraph). - - Returns: - Self for method chaining. - - """ - paragraphs: List[Dict] = [] - if isinstance(content, str): - # Blank lines separate paragraphs within the footnote. - for chunk in re.split(r"\n\s*\n", content): - chunk = chunk.strip() - if chunk: - paragraphs.append( - nodes.paragraph(tokens_to_text_nodes(parse_inline(chunk))) - ) - elif isinstance(content, list): - # Accept either parse_inline tokens ({"content": ...}) or text nodes. - if content and content[0].get("type") == "text": - text_nodes = content - else: - text_nodes = tokens_to_text_nodes(content) - paragraphs.append(nodes.paragraph(text_nodes)) - - node: Dict = nodes.footnote(number, paragraphs) - self.draft_body["content"] = self.draft_body.get("content", []) + [node] - return self - - def from_markdown(self, markdown_content: str, api=None): - """ - Parse Markdown content and add it to the post. - - Supported Markdown features: - - Headings: Lines starting with '#' characters (1-6 levels) - - Images: Markdown image syntax ![Alt](URL) - - Linked images: [![Alt](image_url)](link_url) - images that are also links - - Links: [text](url) - inline links in paragraphs - - Code blocks: Fenced code blocks with ```language or ``` - - Blockquotes: Lines starting with '>' (consecutive lines grouped) - - Paragraphs: Regular text blocks - - Bullet lists: Lines starting with '*' or '-' - - Ordered lists: Lines starting with '1.', '2.', etc. - - Horizontal rules: Lines with ---, ***, or ___ - - Inline formatting: **bold**, *italic*, ***bold+italic***, `code`, ~~strikethrough~~ - - Footnotes: ``text.[^label]`` references plus ``[^label]: definition`` - lines. References become inline anchors and definitions become - footnote blocks, numbered by order of first appearance. Labels may be - numbers or names (e.g. ``[^1]`` or ``[^agi-book]``). - - Args: - markdown_content: Markdown string to parse and add to the post. - api: Optional Api instance for uploading local images. If provided, - local image paths will be uploaded via api.get_image(). - - Returns: - Self for method chaining. - - Example: - >>> post = Post("Title", "Subtitle", user_id) - >>> post.from_markdown("# Heading\\n\\nThis is **bold** text with [a link](https://example.com).") - """ - from substack import mdrender - - rendered = mdrender.markdown_to_doc(markdown_content, api=api) - self.draft_body["content"] = self.draft_body.get("content", []) + rendered - return self diff --git a/substack/revision.py b/substack/revision.py deleted file mode 100644 index 9c317d7..0000000 --- a/substack/revision.py +++ /dev/null @@ -1,254 +0,0 @@ -import base64 -import hashlib -import json -import re -from typing import Any, Dict, List, Optional - -from markdown_it import MarkdownIt - - -def compute_draft_revision(draft: Dict[str, Any]) -> Dict[str, Any]: - """Compute deterministic revision and fingerprint metadata from a Substack draft dict.""" - draft_id = draft.get("id") - title = ( - draft.get("draft_title") if "draft_title" in draft else draft.get("title", "") - ) - subtitle = ( - draft.get("draft_subtitle") - if "draft_subtitle" in draft - else draft.get("subtitle", "") - ) - audience = draft.get("audience") or "everyone" - write_comment_permissions = draft.get("write_comment_permissions") or "everyone" - draft_section_id = ( - draft.get("draft_section_id") - if "draft_section_id" in draft - else draft.get("section_id") - ) - slug = draft.get("slug") or "" - updated_at = draft.get("draft_updated_at") or draft.get("updated_at") - - raw_body = draft.get("draft_body") - if isinstance(raw_body, str): - try: - body_obj = json.loads(raw_body) - except Exception: - body_obj = raw_body - else: - body_obj = raw_body - - if isinstance(body_obj, (dict, list)): - body_canonical = json.dumps( - body_obj, ensure_ascii=False, separators=(",", ":"), sort_keys=True - ) - else: - body_canonical = str(body_obj or "") - - body_hash = hashlib.sha256(body_canonical.encode("utf-8")).hexdigest() - - fingerprint_components = { - "draft_id": draft_id, - "body_hash": body_hash, - "title": title or "", - "subtitle": subtitle or "", - "audience": audience, - "write_comment_permissions": write_comment_permissions, - "draft_section_id": draft_section_id, - "slug": slug, - } - fingerprint_bytes = json.dumps( - fingerprint_components, - ensure_ascii=False, - separators=(",", ":"), - sort_keys=True, - ).encode("utf-8") - revision_hash = hashlib.sha256(fingerprint_bytes).hexdigest() - - return { - "version": 1, - "draft_id": draft_id, - "revision": revision_hash, - "body_hash": body_hash, - "title": title or "", - "subtitle": subtitle or "", - "audience": audience, - "write_comment_permissions": write_comment_permissions, - "draft_section_id": draft_section_id, - "slug": slug, - "updated_at": str(updated_at) if updated_at else None, - } - - -def format_revision_marker(revision_info: Dict[str, Any]) -> str: - """Format revision metadata as a versioned HTML comment marker.""" - payload = json.dumps( - revision_info, ensure_ascii=False, separators=(",", ":"), sort_keys=True - ).encode("utf-8") - encoded = base64.urlsafe_b64encode(payload).decode("ascii").rstrip("=") - return f"" - - -def parse_revision_marker(markdown: str) -> Optional[Dict[str, Any]]: - """ - Parse a python-substack-revision:v1 comment marker from markdown content. - - Only top-level HTML comment blocks are considered; comments inside code blocks - are ignored. - - Returns the parsed revision dictionary, or None if no marker is found. - Raises ValueError if an attempted marker is corrupt, malformed, unsupported, or duplicated. - """ - md = MarkdownIt() - tokens = md.parse(markdown) - - found_markers = [] - marker_pattern = re.compile( - r"^$" - ) - - for token in tokens: - if token.type == "html_block": - clean = token.content.strip() - match = marker_pattern.match(clean) - if match: - found_markers.append(match.groups()) - elif "python-substack-revision:" in clean: - raise ValueError( - "Malformed revision marker: corrupt comment format or invalid characters" - ) - - if not found_markers: - return None - - if len(found_markers) > 1: - raise ValueError("Malformed revision marker: multiple revision markers found") - - version_str, encoded = found_markers[0] - if version_str != "1": - raise ValueError( - f"Malformed revision marker: unsupported version '{version_str}'" - ) - - pad = len(encoded) % 4 - if pad: - encoded += "=" * (4 - pad) - - try: - raw = base64.urlsafe_b64decode(encoded.encode("ascii")) - except Exception as exc: - raise ValueError("Malformed revision marker: invalid base64 encoding") from exc - - try: - data = json.loads(raw.decode("utf-8")) - except Exception as exc: - raise ValueError("Malformed revision marker: invalid JSON payload") from exc - - if not isinstance(data, dict): - raise ValueError("Malformed revision marker: payload must be a JSON object") - - if not data.get("revision") or not isinstance(data.get("revision"), str): - raise ValueError( - "Malformed revision marker: missing or empty required 'revision' field" - ) - - return data - - -def compare_draft_revisions( - expected: Dict[str, Any], current: Dict[str, Any] -) -> List[str]: - """ - Compare expected revision metadata with current remote draft revision metadata. - - Returns a list of human-readable, actionable mismatch descriptions. - If the list is empty, there is no conflict. - """ - mismatches: List[str] = [] - - if ( - expected.get("draft_id") is not None - and current.get("draft_id") is not None - and str(expected.get("draft_id")) != str(current.get("draft_id")) - ): - mismatches.append( - f"Draft ID mismatch: expected {expected.get('draft_id')}, got {current.get('draft_id')}" - ) - - if ( - expected.get("body_hash") - and current.get("body_hash") - and expected.get("body_hash") != current.get("body_hash") - ): - mismatches.append("Remote draft body has changed since export") - - if ( - expected.get("title") is not None - and current.get("title") is not None - and expected.get("title") != current.get("title") - ): - mismatches.append( - f"Remote title changed: expected '{expected.get('title')}', got '{current.get('title')}'" - ) - - if ( - expected.get("subtitle") is not None - and current.get("subtitle") is not None - and expected.get("subtitle") != current.get("subtitle") - ): - mismatches.append( - f"Remote subtitle changed: expected '{expected.get('subtitle')}', got '{current.get('subtitle')}'" - ) - - if ( - expected.get("audience") - and current.get("audience") - and expected.get("audience") != current.get("audience") - ): - mismatches.append( - f"Remote audience changed: expected '{expected.get('audience')}', got '{current.get('audience')}'" - ) - - if ( - expected.get("write_comment_permissions") - and current.get("write_comment_permissions") - and expected.get("write_comment_permissions") - != current.get("write_comment_permissions") - ): - mismatches.append( - f"Remote write_comment_permissions changed: expected '{expected.get('write_comment_permissions')}', got '{current.get('write_comment_permissions')}'" - ) - - if expected.get("draft_section_id") != current.get("draft_section_id"): - mismatches.append( - f"Remote section changed: expected {expected.get('draft_section_id')}, got {current.get('draft_section_id')}" - ) - - if ( - expected.get("slug") is not None - and current.get("slug") is not None - and expected.get("slug") != current.get("slug") - ): - mismatches.append( - f"Remote slug changed: expected '{expected.get('slug')}', got '{current.get('slug')}'" - ) - - if ( - expected.get("updated_at") - and current.get("updated_at") - and expected.get("updated_at") != current.get("updated_at") - ): - mismatches.append( - f"Remote update timestamp changed: expected '{expected.get('updated_at')}', got '{current.get('updated_at')}'" - ) - - if ( - expected.get("revision") - and current.get("revision") - and expected.get("revision") != current.get("revision") - and not mismatches - ): - mismatches.append( - f"Remote revision fingerprint mismatch: expected '{expected.get('revision')}', got '{current.get('revision')}'" - ) - - return mismatches diff --git a/substack_mcp/mcp_server.py b/substack_mcp/mcp_server.py deleted file mode 100644 index 0a4061b..0000000 --- a/substack_mcp/mcp_server.py +++ /dev/null @@ -1,386 +0,0 @@ -from __future__ import annotations - -import os -from typing import Any, Dict, List, Optional - -try: - from dotenv import load_dotenv -except ImportError: - load_dotenv = None - -from fastmcp import FastMCP - -from substack.api import Api -from substack.post import Post - -if load_dotenv is not None: - load_dotenv() - - -def get_api() -> Api: - email = os.getenv("EMAIL") - password = os.getenv("PASSWORD") - cookies_path = os.getenv("COOKIES_PATH") - cookies_string = os.getenv("COOKIES_STRING") - publication_url = os.getenv("PUBLICATION_URL") - - if cookies_path or cookies_string: - return Api( - cookies_path=cookies_path, - cookies_string=cookies_string, - publication_url=publication_url, - ) - - if email and password: - return Api( - email=email, - password=password, - publication_url=publication_url, - ) - - raise ValueError( - "Missing Substack auth configuration: set EMAIL/PASSWORD or COOKIES_PATH/COOKIES_STRING" - ) - - -def _normalize_tags(tags: Optional[Any]) -> List[str]: - if tags is None: - return [] - if isinstance(tags, str): - return [tags] - if isinstance(tags, list): - return [str(tag) for tag in tags] - raise ValueError("tags must be a string or a list of strings") - - -mcp = FastMCP("substack") - - -@mcp.tool() -async def post_draft_from_markdown( - title: str, - markdown: str, - subtitle: Optional[str] = "", - audience: str = "everyone", - write_comment_permissions: str = "everyone", - search_engine_title: Optional[str] = None, - search_engine_description: Optional[str] = None, - slug: Optional[str] = None, - draft_section_id: Optional[int] = None, - tags: Optional[Any] = None, - prepublish: bool = False, - publish: bool = False, - send: bool = True, - share_automatically: bool = False, -) -> Dict[str, Any]: - """Create or update a Substack draft from Markdown. - - This tool builds a Substack `Post` from markdown content and posts a draft. - It supports optional tag assignment, prepublish (setup check), and publishing. - - Args: - title: Draft title. - markdown: Markdown body content. - subtitle: Optional subtitle text. - audience: One of `everyone`, `only_paid`, `founding`, `only_free`. - write_comment_permissions: One of `none`, `only_paid`, `everyone`. - search_engine_title: Optional title for search engine optimization. - search_engine_description: Optional description for search engine optimization. - slug: Optional URL slug for the post. - draft_section_id: Optional section ID for the draft. - tags: Tag or list of tags to attach to the post. - prepublish: If true, calls `prepublish_draft` after creation. - publish: If true, calls `publish_draft` after creation (and optionally prepublish). - send: Passed to `publish_draft` for newsletter delivery. - share_automatically: Passed to `publish_draft`. - - Returns: - dict containing drafted post (`draft`), optional `tags`, `prepublish`, `publish` results. - - Examples: - With the YAML structure from the README, a caller can map fields like: - - ```yaml - title: "My Post Title" - subtitle: "My Post Subtitle" - audience: "everyone" - write_comment_permissions: "everyone" - markdown: | - # Hello - - This is the body. - - tags: - - python - - substack - prepublish: true - publish: true - send: false - share_automatically: true - ``` - - Then invoke via MCP directly: - - ```python - from substack_mcp.mcp_server import post_draft_from_markdown - - result = await post_draft_from_markdown( - title='My Post Title', - markdown='# Hello\n\nThis is the body.', - subtitle='My Post Subtitle', - audience='everyone', - write_comment_permissions='everyone', - tags=['python', 'substack'], - prepublish=True, - publish=False, # set true when ready - ) - print(result) - ``` - - A longer process with manual prepublish/publish calls: - - ```python - from substack_mcp.mcp_server import ( - post_draft_from_markdown, - prepublish_draft, - publish_draft, - add_tags, - ) - - d = await post_draft_from_markdown( - title='Long flow', - markdown='Content', - tags=['a','b'], - publish=False, - ) - draft_id = d['draft']['id'] - - await add_tags(draft_id, ['post-tag', 'news']) - await prepublish_draft(draft_id) - await publish_draft(draft_id, send=True, share_automatically=True) - ``` - - This docstring example is meant to mirror the YAML-driven workflow and show how to decompose the same operations into explicit tool calls. - """ - client = get_api() - - return client.create_draft_from_markdown( - title=title, - markdown=markdown, - subtitle=subtitle, - audience=audience, - write_comment_permissions=write_comment_permissions, - search_engine_title=search_engine_title, - search_engine_description=search_engine_description, - slug=slug, - draft_section_id=draft_section_id, - tags=tags, - prepublish=prepublish, - publish=publish, - send=send, - share_automatically=share_automatically, - ) - - -@mcp.tool() -async def put_draft( - draft_id: int, - update_payload: Dict[str, Any], -) -> Dict[str, Any]: - """Update an existing draft by draft ID. - - Args: - draft_id: target draft identifier. - update_payload: dict of fields supported by Substack `put_draft` (e.g. `slug`, `draft_section_id`). - - Returns: - API response dict for the updated draft. - """ - client = get_api() - return client.put_draft(draft_id, **update_payload) - - -@mcp.tool() -async def add_tags(draft_id: int, tags: Any) -> Dict[str, Any]: - """Add tags to a specific draft/post. - - Args: - draft_id: target draft identifier. - tags: string or list of tag names (e.g. `"tech"` or `["tech", "python"]`). - - Returns: - Response from `add_tags_to_post` (tag IDs + names). - """ - client = get_api() - tags_list = _normalize_tags(tags) - if not tags_list: - raise ValueError("tags is required and cannot be empty") - return client.add_tags_to_post(draft_id, tags_list) - - -@mcp.tool() -async def prepublish_draft(draft_id: int) -> Dict[str, Any]: - """Invoke prepublish checks for a draft. - - Args: - draft_id: target draft identifier. - - Returns: - Prepublish response dict from Substack API. - """ - client = get_api() - return client.prepublish_draft(draft_id) - - -@mcp.tool() -async def publish_draft( - draft_id: int, - send: bool = True, - share_automatically: bool = False, -) -> Dict[str, Any]: - """Publish a draft to live post state. (Legacy compatibility interface). - - This tool remains for backward compatibility. It is recommended to use - `publish_draft_checked` instead, which provides a safer publishing path - with explicit confirmation and prepublish validation. - - Args: - draft_id: target draft identifier. - send: if False then do not send email to subscribers. - share_automatically: whether to auto-share (e.g. social propagation). - - Returns: - Response from Substack `publish_draft`. - """ - client = get_api() - return client.publish_draft( - draft_id, send=send, share_automatically=share_automatically - ) - - -@mcp.tool() -async def publish_draft_checked( - draft_id: int, - confirm: bool = False, - send: bool = False, - share_automatically: bool = False, -) -> Dict[str, Any]: - """A safer publishing path that requires confirmation and runs prepublish checks. - - Args: - draft_id: target draft identifier. - confirm: Must be True to proceed with publication. - send: if False then do not send email to subscribers. Defaults to False. - share_automatically: whether to auto-share. - - Returns: - Response from Substack `publish_draft`. - """ - if not confirm: - raise ValueError("Publishing rejected: confirm parameter must be True.") - - client = get_api() - client.prepublish_draft(draft_id) - return client.publish_draft( - draft_id, send=send, share_automatically=share_automatically - ) - - -@mcp.tool() -async def get_status() -> Dict[str, Any]: - """Get the authentication status and basic user information. - - Returns: - A dictionary containing user profile and primary publication details. - """ - client = get_api() - profile = client.get_user_profile() - primary_pub = client.get_user_primary_publication() - return {"profile": profile, "primary_publication": primary_pub} - - -@mcp.tool() -async def list_publications() -> List[Dict[str, Any]]: - """List all publications available to the authenticated user. - - Returns: - A list of publications. - """ - client = get_api() - return client.get_user_publications() - - -@mcp.tool() -async def list_drafts( - filter: str = "draft", offset: int = 0, limit: int = 25 -) -> List[Dict[str, Any]]: - """List drafts for the current publication. - - Args: - filter: Filter string, defaults to "draft". - offset: Pagination offset. - limit: Max number of drafts to return. - - Returns: - A list of drafts. - """ - client = get_api() - return client.get_drafts(filter=filter, offset=offset, limit=limit) - - -@mcp.tool() -async def get_draft(draft_id: int) -> Dict[str, Any]: - """Get a specific draft by its ID. - - Args: - draft_id: The identifier of the draft. - - Returns: - The draft details. - """ - client = get_api() - return client.get_draft(draft_id) - - -@mcp.tool() -async def schedule_draft(draft_id: int, at: str) -> Dict[str, Any]: - """Schedule a draft for release. - - Args: - draft_id: target draft identifier. - at: ISO 8601 formatted datetime string (e.g., "2024-01-01T12:00:00Z"). - - Returns: - API response dict for the scheduled draft. - """ - from datetime import datetime - - try: - draft_datetime = datetime.fromisoformat(at.replace("Z", "+00:00")) - except ValueError as e: - raise ValueError(f"Invalid ISO datetime string for 'at': {e}") - - client = get_api() - return client.schedule_draft(draft_id, draft_datetime) - - -@mcp.tool() -async def unschedule_draft(draft_id: int) -> Dict[str, Any]: - """Unschedule a previously scheduled draft. - - Args: - draft_id: target draft identifier. - - Returns: - API response dict for unscheduling. - """ - client = get_api() - return client.unschedule_draft(draft_id) - - -def main() -> None: - mcp.run(transport="stdio") - - -if __name__ == "__main__": - main() diff --git a/tests/substack/fixtures/full_features.expected.json b/tests/substack/fixtures/full_features.expected.json deleted file mode 100644 index ecd9259..0000000 --- a/tests/substack/fixtures/full_features.expected.json +++ /dev/null @@ -1,1008 +0,0 @@ -[ - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading level 1" - } - ], - "attrs": { - "level": 1 - } - }, - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading level 2" - } - ], - "attrs": { - "level": 2 - } - }, - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading level 3" - } - ], - "attrs": { - "level": 3 - } - }, - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading level 4" - } - ], - "attrs": { - "level": 4 - } - }, - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading level 5" - } - ], - "attrs": { - "level": 5 - } - }, - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading level 6" - } - ], - "attrs": { - "level": 6 - } - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A paragraph with " - }, - { - "type": "text", - "text": "bold", - "marks": [ - { - "type": "strong" - } - ] - }, - { - "type": "text", - "text": ", " - }, - { - "type": "text", - "text": "italic", - "marks": [ - { - "type": "em" - } - ] - }, - { - "type": "text", - "text": ", " - }, - { - "type": "text", - "text": "bold italic", - "marks": [ - { - "type": "em" - }, - { - "type": "strong" - } - ] - }, - { - "type": "text", - "text": ", " - }, - { - "type": "text", - "text": "inline code", - "marks": [ - { - "type": "code" - } - ] - }, - { - "type": "text", - "text": ", " - }, - { - "type": "text", - "text": "strikethrough", - "marks": [ - { - "type": "strikethrough" - } - ] - }, - { - "type": "text", - "text": ", and a " - }, - { - "type": "text", - "text": "link", - "marks": [ - { - "type": "link", - "attrs": { - "href": "https://example.com" - } - } - ] - }, - { - "type": "text", - "text": "." - } - ] - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A sentence with a numeric footnote" - }, - { - "type": "footnoteAnchor", - "attrs": { - "number": 1 - } - }, - { - "type": "text", - "text": " and a named footnote" - }, - { - "type": "footnoteAnchor", - "attrs": { - "number": 2 - } - }, - { - "type": "text", - "text": ", plus a repeat of the first." - }, - { - "type": "footnoteAnchor", - "attrs": { - "number": 3 - } - } - ] - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A footnote whose definition is a list." - }, - { - "type": "footnoteAnchor", - "attrs": { - "number": 4 - } - } - ] - }, - { - "type": "bullet_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Bullet one" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Bullet two with " - }, - { - "type": "text", - "text": "bold", - "marks": [ - { - "type": "strong" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "ordered_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Ordered one" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Ordered two" - } - ] - } - ] - } - ] - }, - { - "type": "bullet_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Bulleted list with a nested bulleted list:" - } - ] - }, - { - "type": "bullet_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner bullet a" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner bullet b" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Bulleted list with a nested numbered list:" - } - ] - }, - { - "type": "ordered_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner number a" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner number b" - } - ] - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "ordered_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Numbered list with a nested bulleted list:" - } - ] - }, - { - "type": "bullet_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner bullet a" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner bullet b" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Numbered list with a nested numbered list:" - } - ] - }, - { - "type": "ordered_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner number a" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inner number b" - } - ] - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "blockquote", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A blockquote across two wrapped lines." - } - ] - } - ] - }, - { - "type": "blockquote", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "First quote paragraph." - } - ] - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "Second quote paragraph." - } - ] - } - ] - }, - { - "type": "codeBlock", - "content": [ - { - "type": "text", - "text": "# fenced code: footnote-like text must stay literal\nx = \"[^1]: not a footnote\"\nprint(\"reference [^1] stays text\")" - } - ], - "attrs": { - "language": "python" - } - }, - { - "type": "codeBlock", - "content": [ - { - "type": "text", - "text": "plain code block without a language" - } - ] - }, - { - "type": "horizontal_rule" - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A paragraph with inline math " - }, - { - "type": "latex", - "attrs": { - "expression": "E=mc^2", - "persistentExpression": "E=mc^2" - } - }, - { - "type": "text", - "text": ", H" - }, - { - "type": "text", - "text": "2", - "marks": [ - { - "type": "subscript" - } - ] - }, - { - "type": "text", - "text": "O subscript, and x" - }, - { - "type": "text", - "text": "2", - "marks": [ - { - "type": "superscript" - } - ] - }, - { - "type": "text", - "text": " superscript." - } - ] - }, - { - "type": "latex_block", - "attrs": { - "persistentExpression": "E=mc^2", - "dirty": true - } - }, - { - "type": "pullquote", - "attrs": { - "align": null, - "color": null - }, - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A pull quote with " - }, - { - "type": "text", - "text": "bold", - "marks": [ - { - "type": "strong" - } - ] - }, - { - "type": "text", - "text": " text." - } - ] - } - ] - }, - { - "type": "calloutBlock", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A callout block with a " - }, - { - "type": "text", - "text": "link", - "marks": [ - { - "type": "link", - "attrs": { - "href": "https://example.com" - } - } - ] - }, - { - "type": "text", - "text": "." - } - ] - } - ] - }, - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": { - "src": "", - "srcNoWatermark": null, - "fullscreen": false, - "imageSize": "normal", - "height": "", - "width": "", - "resizeWidth": "", - "bytes": null, - "alt": "A captioned image", - "title": null, - "type": null, - "href": null, - "belowTheFold": false, - "topImage": false, - "internalRedirect": null, - "isProcessing": false, - "align": null, - "offset": false - } - } - ] - }, - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": { - "src": "", - "srcNoWatermark": null, - "fullscreen": false, - "imageSize": "normal", - "height": "", - "width": "", - "resizeWidth": "", - "bytes": null, - "alt": "Linked image alt", - "title": null, - "type": null, - "href": "https://example.com/target", - "belowTheFold": false, - "topImage": false, - "internalRedirect": null, - "isProcessing": false, - "align": null, - "offset": false - } - } - ] - }, - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": { - "src": "", - "srcNoWatermark": null, - "fullscreen": false, - "imageSize": "normal", - "height": "", - "width": "", - "resizeWidth": "", - "bytes": null, - "alt": "Captioned with title", - "title": null, - "type": null, - "href": null, - "belowTheFold": false, - "topImage": false, - "internalRedirect": null, - "isProcessing": false, - "align": null, - "offset": false - } - }, - { - "type": "caption", - "content": [ - { - "type": "text", - "text": "Caption text from markdown title" - } - ] - } - ] - }, - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": { - "src": "", - "srcNoWatermark": null, - "fullscreen": false, - "imageSize": "normal", - "height": "", - "width": "", - "resizeWidth": "", - "bytes": null, - "alt": "A locally uploaded image", - "title": null, - "type": null, - "href": null, - "belowTheFold": false, - "topImage": false, - "internalRedirect": null, - "isProcessing": false, - "align": null, - "offset": false - } - } - ] - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "inline code with [^1] inside stays literal", - "marks": [ - { - "type": "code" - } - ] - } - ] - }, - { - "type": "heading", - "content": [ - { - "type": "text", - "text": "Heading with " - }, - { - "type": "text", - "text": "bold", - "marks": [ - { - "type": "strong" - } - ] - }, - { - "type": "text", - "text": ", " - }, - { - "type": "text", - "text": "italic", - "marks": [ - { - "type": "em" - } - ] - }, - { - "type": "text", - "text": ", and a " - }, - { - "type": "text", - "text": "link", - "marks": [ - { - "type": "link", - "attrs": { - "href": "https://example.com" - } - } - ] - } - ], - "attrs": { - "level": 2 - } - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "An autolink to " - }, - { - "type": "text", - "text": "https://example.com", - "marks": [ - { - "type": "link", - "attrs": { - "href": "https://example.com" - } - } - ] - }, - { - "type": "text", - "text": " becomes a link." - } - ] - }, - { - "type": "footnote", - "attrs": { - "number": 1 - }, - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "The first footnote, with a " - }, - { - "type": "text", - "text": "link", - "marks": [ - { - "type": "link", - "attrs": { - "href": "https://example.com" - } - } - ] - }, - { - "type": "text", - "text": "." - } - ] - } - ] - }, - { - "type": "footnote", - "attrs": { - "number": 2 - }, - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "A named footnote whose definition spans a continuation line in the same paragraph." - } - ] - }, - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "And a second paragraph after a blank line." - } - ] - } - ] - }, - { - "type": "footnote", - "attrs": { - "number": 3 - }, - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "The first footnote, with a " - }, - { - "type": "text", - "text": "link", - "marks": [ - { - "type": "link", - "attrs": { - "href": "https://example.com" - } - } - ] - }, - { - "type": "text", - "text": "." - } - ] - } - ] - }, - { - "type": "footnote", - "attrs": { - "number": 4 - }, - "content": [ - { - "type": "bullet_list", - "content": [ - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "list item one" - } - ] - } - ] - }, - { - "type": "list_item", - "content": [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "list item two" - } - ] - } - ] - } - ] - } - ] - } -] diff --git a/tests/substack/fixtures/full_features.md b/tests/substack/fixtures/full_features.md deleted file mode 100644 index 3cd028c..0000000 --- a/tests/substack/fixtures/full_features.md +++ /dev/null @@ -1,93 +0,0 @@ -# Heading level 1 - -## Heading level 2 - -### Heading level 3 - -#### Heading level 4 - -##### Heading level 5 - -###### Heading level 6 - -A paragraph with **bold**, *italic*, ***bold italic***, `inline code`, ~~strikethrough~~, and a [link](https://example.com). - -A sentence with a numeric footnote[^1] and a named footnote[^note], plus a repeat of the first.[^1] - -A footnote whose definition is a list.[^listnote] - -- Bullet one -- Bullet two with **bold** - -1. Ordered one -2. Ordered two - -- Bulleted list with a nested bulleted list: - - inner bullet a - - inner bullet b -- Bulleted list with a nested numbered list: - 1. inner number a - 2. inner number b - -1. Numbered list with a nested bulleted list: - - inner bullet a - - inner bullet b -2. Numbered list with a nested numbered list: - 1. inner number a - 2. inner number b - -> A blockquote across -> two wrapped lines. - -> First quote paragraph. -> -> Second quote paragraph. - -```python -# fenced code: footnote-like text must stay literal -x = "[^1]: not a footnote" -print("reference [^1] stays text") -``` - -``` -plain code block without a language -``` - ---- - -A paragraph with inline math $E=mc^2$, H~2~O subscript, and x^2^ superscript. - -$$ -E=mc^2 -$$ - -:::pullquote -A pull quote with **bold** text. -::: - -:::callout -A callout block with a [link](https://example.com). -::: - -![A captioned image](https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png) - -[![Linked image alt](https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png)](https://example.com/target) - -![Captioned with title](https://upload.wikimedia.org/wikipedia/commons/4/47/PNG_transparency_demonstration_1.png "Caption text from markdown title") - -![A locally uploaded image](local_image.png) - -`inline code with [^1] inside stays literal` - -## Heading with **bold**, *italic*, and a [link](https://example.com) - -An autolink to becomes a link. - -[^1]: The first footnote, with a [link](https://example.com). -[^note]: A named footnote whose definition spans - a continuation line in the same paragraph. - - And a second paragraph after a blank line. -[^unused]: This definition is never referenced and should be dropped. -[^listnote]: - list item one - - list item two diff --git a/tests/substack/fixtures/local_image.png b/tests/substack/fixtures/local_image.png deleted file mode 100644 index e1aabd8..0000000 Binary files a/tests/substack/fixtures/local_image.png and /dev/null differ diff --git a/tests/substack/test_api.py b/tests/substack/test_api.py index f0e71c9..e0cadf6 100644 --- a/tests/substack/test_api.py +++ b/tests/substack/test_api.py @@ -1,9 +1,6 @@ import os import unittest -from datetime import datetime, timezone -from unittest.mock import Mock, patch -import pytest from dotenv import load_dotenv from substack import Api @@ -12,168 +9,66 @@ load_dotenv() -def _api_from_env() -> Api: - cookies_string = os.getenv("COOKIES_STRING") - cookies_path = os.getenv("COOKIES_PATH") - publication_url = os.getenv("PUBLICATION_URL") - if cookies_string or cookies_path: - return Api( - cookies_string=cookies_string, - cookies_path=cookies_path, - publication_url=publication_url, - ) - return Api( - email=os.getenv("EMAIL"), - password=os.getenv("PASSWORD"), - publication_url=publication_url, - ) - - -_e2e = unittest.skipUnless( - os.getenv("RUN_SUBSTACK_E2E"), - "set RUN_SUBSTACK_E2E=1 and configure credentials to run live API tests", -) - - class ApiTest(unittest.TestCase): - def test_api_retries_rate_limited_get_and_delete_requests(self): - publication = { - "subdomain": "writer", - "publication_url": "https://writer.substack.com", - } - with ( - patch("requests.Session") as session_class, - patch.object(Api, "get_user_primary_publication", return_value=publication), - patch.object(Api, "change_publication"), - ): - Api(cookies_string="sid=value") - - adapters = [ - call.args[1] for call in session_class.return_value.mount.call_args_list - ] - self.assertEqual(len(adapters), 2) - retry = adapters[0].max_retries - self.assertEqual(retry.total, 4) - self.assertEqual(retry.status, 4) - self.assertEqual(retry.status_forcelist, (429,)) - self.assertEqual(retry.allowed_methods, frozenset({"GET", "DELETE"})) - self.assertFalse(retry.raise_on_status) - def test_api_exception(self): - response = Mock(status_code=401, text="Unauthorized") with self.assertRaises(SubstackAPIException): - with patch("requests.Session.post", return_value=response): - Api(email="", password="") - - def test_get_publication_subscriber_count_from_legacy_response(self): - api = Api.__new__(Api) - api.publication_url = "https://writer.substack.com/api/v1" - api._session = Mock() - response = Mock(status_code=200) - response.json.return_value = {"subscriberCount": 123} - api._session.get.return_value = response - - self.assertEqual(api.get_publication_subscriber_count(), 123) - - def test_get_publication_subscriber_count_from_subscribers(self): - api = Api.__new__(Api) - api.publication_url = "https://writer.substack.com/api/v1" - api._session = Mock() - response = Mock(status_code=200) - response.json.return_value = {"subscribers": [{"id": 1}, {"id": 2}]} - api._session.get.return_value = response - - self.assertEqual(api.get_publication_subscriber_count(), 2) - - def test_get_publication_subscriber_count_prefers_legacy_count(self): - api = Api.__new__(Api) - api.publication_url = "https://writer.substack.com/api/v1" - api._session = Mock() - response = Mock(status_code=200) - response.json.return_value = { - "subscriberCount": 123, - "subscribers": [{"id": 1}], - } - api._session.get.return_value = response - - self.assertEqual(api.get_publication_subscriber_count(), 123) + Api(email="", password="") - def test_schedule_draft_uses_scheduled_release_contract(self): - api = Api.__new__(Api) - api.publication_url = "https://writer.substack.com/api/v1" - api._session = Mock() - response = Mock(status_code=200) - response.json.return_value = {"scheduled": True} - api._session.post.return_value = response - scheduled_at = datetime(2030, 1, 2, 3, 4, 5, tzinfo=timezone.utc) - - self.assertEqual( - api.schedule_draft(42, scheduled_at), - {"scheduled": True}, - ) - api._session.post.assert_called_once_with( - "https://writer.substack.com/api/v1/drafts/42/scheduled_release", - json={"trigger_at": "2030-01-02T03:04:05+00:00"}, + def test_login(self): + api = Api( + email=os.getenv("EMAIL"), + password=os.getenv("PASSWORD"), + publication_url=os.getenv("PUBLICATION_URL"), ) + self.assertIsNotNone(api) - def test_unschedule_draft_deletes_scheduled_release(self): - api = Api.__new__(Api) - api.publication_url = "https://writer.substack.com/api/v1" - api._session = Mock() - response = Mock(status_code=200) - response.json.return_value = {"scheduled": False} - api._session.delete.return_value = response - - self.assertEqual(api.unschedule_draft(42), {"scheduled": False}) - api._session.delete.assert_called_once_with( - "https://writer.substack.com/api/v1/drafts/42/scheduled_release" - ) - - def test_get_drafts_extracts_posts_from_response_envelope(self): - api = Api.__new__(Api) - api.publication_url = "https://writer.substack.com/api/v1" - api._session = Mock() - response = Mock(status_code=200) - response.json.return_value = { - "posts": [{"id": 42}], - "hasMore": False, - "nextCursor": None, - } - api._session.get.return_value = response - - self.assertEqual(api.get_drafts(), [{"id": 42}]) - - @pytest.mark.live - @_e2e def test_get_posts(self): - api = _api_from_env() + api = Api(email=os.getenv("EMAIL"), password=os.getenv("PASSWORD")) posts = api.get_posts() self.assertIsNotNone(posts) - @pytest.mark.live - @_e2e def test_get_drafts(self): - api = _api_from_env() + api = Api( + email=os.getenv("EMAIL"), + password=os.getenv("PASSWORD"), + publication_url=os.getenv("PUBLICATION_URL"), + ) drafts = api.get_drafts() self.assertIsNotNone(drafts) - @pytest.mark.live - @_e2e + def test_post_draft(self): + api = Api( + email=os.getenv("EMAIL"), + password=os.getenv("PASSWORD"), + publication_url=os.getenv("PUBLICATION_URL"), + ) + posted_draft = api.post_draft([{"id": os.getenv("USER_ID"), "is_guest": False}]) + self.assertIsNotNone(posted_draft) + def test_publication_users(self): - api = _api_from_env() + api = Api( + email=os.getenv("EMAIL"), + password=os.getenv("PASSWORD"), + publication_url=os.getenv("PUBLICATION_URL"), + ) users = api.get_publication_users() self.assertIsNotNone(users) - @pytest.mark.live - @_e2e + def test_put_draft(self): + api = Api( + email=os.getenv("EMAIL"), + password=os.getenv("PASSWORD"), + publication_url=os.getenv("PUBLICATION_URL"), + ) + posted_draft = api.put_draft("") + self.assertIsNotNone(posted_draft) + def test_get_categories(self): - api = _api_from_env() + api = Api() categories = api.get_categories() self.assertIsNotNone(categories) - @pytest.mark.live - @_e2e def test_get_single_category(self): - api = _api_from_env() + api = Api() category = api.get_single_category(4, "all", limit=100) self.assertIsNotNone(category) diff --git a/tests/substack/test_api_update.py b/tests/substack/test_api_update.py deleted file mode 100644 index 47bf877..0000000 --- a/tests/substack/test_api_update.py +++ /dev/null @@ -1,42 +0,0 @@ -from unittest.mock import Mock - -import pytest - -from substack import Api -from substack.exceptions import DraftConflictError -from substack.revision import compute_draft_revision, format_revision_marker - - -def test_update_draft_from_markdown_basic(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - mock_get_user_id = Mock(return_value=1) - monkeypatch.setattr(api, "get_user_id", mock_get_user_id) - draft = {"id": 42, "draft_body": '{"type":"doc","content":[]}'} - mock_get_draft = Mock(return_value=draft) - monkeypatch.setattr(api, "get_draft", mock_get_draft) - mock_put_draft = Mock(return_value={"id": 42}) - monkeypatch.setattr(api, "put_draft", mock_put_draft) - - # 1. Without revision marker or override, raises DraftConflictError (unprotected update) - with pytest.raises(DraftConflictError, match="missing revision metadata"): - api.update_draft_from_markdown(42, "Updated content") - - # 2. With allow_conflict=True override, succeeds - res_override = api.update_draft_from_markdown( - 42, "Updated content", allow_conflict=True - ) - assert res_override["action"] == "update" - assert res_override["draft_id"] == 42 - assert res_override["conflict"] is True - assert res_override["override"] is True - assert mock_put_draft.called - - # 3. With matching revision marker, succeeds without conflict - mock_put_draft.reset_mock() - marker = format_revision_marker(compute_draft_revision(draft)) - res_marker = api.update_draft_from_markdown(42, f"{marker}\n\nUpdated content") - assert res_marker["action"] == "update" - assert res_marker["draft_id"] == 42 - assert res_marker["conflict"] is False - assert mock_put_draft.called diff --git a/tests/substack/test_cli.py b/tests/substack/test_cli.py deleted file mode 100644 index 1926879..0000000 --- a/tests/substack/test_cli.py +++ /dev/null @@ -1,102 +0,0 @@ -from substack import cli - - -class FakeApi: - def __init__(self): - self.kwargs = None - - def create_draft_from_markdown(self, **kwargs): - self.kwargs = kwargs - return {"draft": {"id": 42}} - - def get_user_profile(self): - return {"email": "writer@example.com"} - - def get_user_primary_publication(self): - return { - "name": "Writer Notes", - "publication_url": "https://writer.substack.com", - } - - def get_user_publications(self): - return [ - {"name": "Writer Notes"}, - {"name": "Second Pub"}, - ] - - -def test_publish_markdown_creates_draft_by_default(tmp_path, monkeypatch, capsys): - markdown = tmp_path / "post.md" - markdown.write_text("# Title from file\n\nBody", encoding="utf-8") - api = FakeApi() - monkeypatch.setattr(cli, "_api_from_env", lambda cookies_path=None: api) - - result = cli.publish_markdown([str(markdown)]) - - assert result == 0 - assert api.kwargs["title"] == "Title from file" - assert api.kwargs["publish"] is False - assert api.kwargs["prepublish"] is False - assert '"draft_id": 42' in capsys.readouterr().out - - -def test_publish_markdown_publish_flag_prepublishes_and_publishes( - tmp_path, monkeypatch -): - markdown = tmp_path / "post.md" - markdown.write_text("Body", encoding="utf-8") - api = FakeApi() - monkeypatch.setattr(cli, "_api_from_env", lambda cookies_path=None: api) - - result = cli.publish_markdown( - [ - str(markdown), - "--title", - "Explicit title", - "--tag", - "python", - "--publish", - "--no-send", - ] - ) - - assert result == 0 - assert api.kwargs["title"] == "Explicit title" - assert api.kwargs["tags"] == ["python"] - assert api.kwargs["publish"] is True - assert api.kwargs["prepublish"] is True - assert api.kwargs["send"] is False - - -def test_auth_check_prints_profile_and_publication(monkeypatch, capsys): - api = FakeApi() - monkeypatch.setattr(cli, "_api_from_env", lambda cookies_path=None: api) - monkeypatch.setattr(cli, "_auth_method", lambda cookies_path=None: "cookies_path") - - result = cli.auth_check(["--cookies", "cookies.json"]) - - assert result == 0 - output = capsys.readouterr().out - assert "Authenticated as: writer@example.com" in output - assert "Auth method: cookies_path" in output - assert "Primary publication: Writer Notes" in output - assert "Publication URL: https://writer.substack.com" in output - assert "Available publications: 2" in output - - -def test_auth_method_prefers_explicit_cookies_path(monkeypatch): - monkeypatch.delenv("COOKIES_PATH", raising=False) - monkeypatch.delenv("COOKIES_STRING", raising=False) - monkeypatch.setenv("EMAIL", "writer@example.com") - monkeypatch.setenv("PASSWORD", "secret") - - assert cli._auth_method("cookies.json") == "cookies_path" - - -def test_auth_method_reads_env(monkeypatch): - monkeypatch.delenv("EMAIL", raising=False) - monkeypatch.delenv("PASSWORD", raising=False) - monkeypatch.delenv("COOKIES_PATH", raising=False) - monkeypatch.setenv("COOKIES_STRING", "substack.sid=value") - - assert cli._auth_method() == "cookies_string" diff --git a/tests/substack/test_cli_end_to_end.py b/tests/substack/test_cli_end_to_end.py deleted file mode 100644 index b6d0a12..0000000 --- a/tests/substack/test_cli_end_to_end.py +++ /dev/null @@ -1,107 +0,0 @@ -import json -import os -from datetime import datetime, timedelta, timezone - -import pytest -from dotenv import load_dotenv - -from substack import cli -from substack.mdrender import markdown_to_doc -from substack.post import Post - -load_dotenv() - - -def _enabled(): - if os.getenv("RUN_SUBSTACK_CLI_E2E") != "1": - return False - has_cookies = bool(os.getenv("COOKIES_PATH") or os.getenv("COOKIES_STRING")) - has_password = bool(os.getenv("EMAIL") and os.getenv("PASSWORD")) - return bool(os.getenv("PUBLICATION_URL") and (has_cookies or has_password)) - - -@pytest.mark.skipif( - not _enabled(), - reason="Set RUN_SUBSTACK_CLI_E2E=1 and configure Substack credentials.", -) -@pytest.mark.live -def test_cli_draft_lifecycle(monkeypatch, capsys): - api = cli._api_from_env() - post = Post("python-substack CLI smoke test", "Disposable draft", api.get_user_id()) - post.paragraph("This draft is created and deleted by the opt-in CLI smoke test.") - draft = api.post_draft(post.get_draft()) - draft_id = draft["id"] - - monkeypatch.setattr( - cli, - "_api_from_env", - lambda cookies_path=None, publication_url=None, timeout=None: api, - ) - - try: - assert cli.main(["--json", "status"]) == 0 - assert cli.main(["--json", "publications", "list"]) == 0 - assert cli.main(["--json", "drafts", "list", "--limit", "10"]) == 0 - assert cli.main(["--json", "drafts", "get", str(draft_id)]) == 0 - capsys.readouterr() - assert cli.main(["--json", "drafts", "export", str(draft_id)]) == 0 - exported = json.loads(capsys.readouterr().out) - assert exported["draft_id"] == draft_id - assert exported["unsupported_nodes"] == [] - assert markdown_to_doc(exported["markdown"]) == [ - { - "type": "paragraph", - "content": [ - { - "type": "text", - "text": "This draft is created and deleted by the opt-in CLI smoke test.", - } - ], - } - ] - - scheduled_at = datetime.now(timezone.utc) + timedelta(days=1) - assert ( - cli.main( - [ - "--json", - "drafts", - "schedule", - str(draft_id), - "--at", - scheduled_at.isoformat(), - ] - ) - == 0 - ) - assert cli.main(["--json", "drafts", "unschedule", str(draft_id)]) == 0 - finally: - assert cli.main(["--json", "drafts", "delete", str(draft_id), "--yes"]) == 0 - capsys.readouterr() - - -@pytest.mark.skipif( - not _enabled(), - reason="Set RUN_SUBSTACK_CLI_E2E=1 and configure Substack credentials.", -) -@pytest.mark.live -def test_cli_create_markdown_draft(tmp_path, monkeypatch, capsys): - api = cli._api_from_env() - markdown = tmp_path / "cli-create.md" - markdown.write_text( - "# CLI create smoke test\n\nDisposable draft.", encoding="utf-8" - ) - monkeypatch.setattr( - cli, - "_api_from_env", - lambda cookies_path=None, publication_url=None, timeout=None: api, - ) - - assert cli.main(["--json", "drafts", "create", str(markdown)]) == 0 - created = json.loads(capsys.readouterr().out) - draft_id = created["draft_id"] - try: - stored = api.get_draft(draft_id) - assert stored["id"] == draft_id - finally: - api.delete_draft(draft_id) diff --git a/tests/substack/test_cli_operations.py b/tests/substack/test_cli_operations.py deleted file mode 100644 index 32788be..0000000 --- a/tests/substack/test_cli_operations.py +++ /dev/null @@ -1,661 +0,0 @@ -import io -import json -import sys -from datetime import datetime, timedelta, timezone - -import pytest - -from substack import cli -from substack.exceptions import SubstackAPIException - - -class OperationsApi: - publication_url = "https://writer.substack.com/api/v1" - - def __init__(self): - self.calls = [] - self.publish_error = None - - def get_user_profile(self): - self.calls.append(("profile",)) - return {"id": 7, "email": "writer@example.com"} - - def get_user_publications(self): - self.calls.append(("publications",)) - return [ - { - "id": 11, - "name": "Writer Notes", - "subdomain": "writer", - "publication_url": "https://writer.substack.com", - } - ] - - def get_publication_subscriber_count(self): - self.calls.append(("subscriber_count",)) - return 123 - - def get_drafts(self, **kwargs): - self.calls.append(("list", kwargs)) - return [ - { - "id": 42, - "draft_title": "Draft title", - "type": "draft", - "post_date": None, - } - ] - - def get_draft(self, draft_id): - self.calls.append(("get", draft_id)) - return {"id": draft_id, "draft_title": "Draft title", "slug": "draft-title"} - - def create_draft_from_markdown(self, **kwargs): - self.calls.append(("create", kwargs)) - return { - "draft": {"id": 43, "draft_title": kwargs["title"]}, - "tags": {"tags_added": kwargs["tags"]} if kwargs["tags"] else None, - "prepublish": None, - "publish": None, - } - - def export_draft_to_markdown(self, draft_id): - self.calls.append(("export", draft_id)) - return { - "draft": {"id": draft_id}, - "markdown": "# Exported\n", - "unsupported_nodes": [{"type": "futureWidget"}], - } - - def schedule_draft(self, draft_id, scheduled_at): - self.calls.append(("schedule", draft_id, scheduled_at)) - return {"scheduled": True} - - def unschedule_draft(self, draft_id): - self.calls.append(("unschedule", draft_id)) - return {"scheduled": False} - - def prepublish_draft(self, draft_id): - self.calls.append(("prepublish", draft_id)) - if self.publish_error: - raise self.publish_error - return {"ready": True} - - def publish_draft(self, draft_id, send=True, share_automatically=False): - self.calls.append(("publish", draft_id, send, share_automatically)) - return {"published": True} - - def delete_draft(self, draft_id): - self.calls.append(("delete", draft_id)) - return {"deleted": True} - - -class TTYInput(io.StringIO): - def isatty(self): - return True - - -def use_api(monkeypatch, api): - monkeypatch.setattr( - cli, - "_api_from_env", - lambda cookies_path=None, publication_url=None, timeout=None: api, - ) - - -def test_status_human_output(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - monkeypatch.setattr(cli, "_auth_method", lambda cookies_path=None: "cookies_path") - - assert cli.main(["status"]) == 0 - - output = capsys.readouterr().out - assert "Authenticated as: writer@example.com" in output - assert "Publication: Writer Notes" in output - assert "Subscribers: 123" in output - - -def test_publications_json_contract(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "publications", "list"]) == 0 - - output = json.loads(capsys.readouterr().out) - assert output["count"] == 1 - assert output["publications"][0]["id"] == 11 - - -def test_drafts_list_defaults_and_json_contract(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "list"]) == 0 - - output = json.loads(capsys.readouterr().out) - assert output == { - "drafts": [ - { - "id": 42, - "draft_title": "Draft title", - "type": "draft", - "post_date": None, - } - ], - "count": 1, - "filter": "draft", - "offset": 0, - "limit": 25, - } - assert api.calls == [("list", {"filter": "draft", "offset": 0, "limit": 25})] - - -def test_drafts_list_validates_pagination(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "list", "--limit", "0"]) == 2 - - assert "--limit must be greater than zero" in capsys.readouterr().err - assert api.calls == [] - - -def test_drafts_get_human_output(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "get", "42"]) == 0 - - output = capsys.readouterr().out - assert "ID: 42" in output - assert "Title: Draft title" in output - assert "Slug: draft-title" in output - - -def test_drafts_create_infers_title_and_preserves_safe_defaults( - tmp_path, monkeypatch, capsys -): - markdown = tmp_path / "release-notes.md" - markdown.write_text("# Inferred title\n\nBody", encoding="utf-8") - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "create", str(markdown)]) == 0 - - assert capsys.readouterr().out == "Created draft 43: Inferred title\n" - kwargs = api.calls[0][1] - assert kwargs == { - "title": "Inferred title", - "markdown": "# Inferred title\n\nBody", - "subtitle": "", - "audience": "everyone", - "write_comment_permissions": "everyone", - "search_engine_title": None, - "search_engine_description": None, - "slug": None, - "draft_section_id": None, - "tags": None, - "prepublish": False, - "publish": False, - } - assert not any( - call[0] in {"prepublish", "publish", "schedule", "delete"} for call in api.calls - ) - - -def test_drafts_create_help_lists_supported_options(capsys): - with pytest.raises(SystemExit) as exc_info: - cli._build_parser().parse_args(["drafts", "create", "--help"]) - - assert exc_info.value.code == 0 - output = capsys.readouterr().out - for option in ( - "--title", - "--subtitle", - "--audience", - "--write-comment-permissions", - "--search-engine-title", - "--search-engine-description", - "--slug", - "--draft-section-id", - "--tag", - ): - assert option in output - - -def test_drafts_create_json_contract_and_options(tmp_path, monkeypatch, capsys): - markdown = tmp_path / "post.md" - markdown.write_text("Body", encoding="utf-8") - api = OperationsApi() - use_api(monkeypatch, api) - - assert ( - cli.main( - [ - "--json", - "drafts", - "create", - str(markdown), - "--title", - "Explicit title", - "--subtitle", - "Subtitle", - "--audience", - "only_paid", - "--write-comment-permissions", - "only_paid", - "--search-engine-title", - "Search title", - "--search-engine-description", - "Search description", - "--slug", - "explicit-title", - "--draft-section-id", - "9", - "--tag", - "python", - "--tag", - "automation", - ] - ) - == 0 - ) - - kwargs = api.calls[0][1] - assert kwargs["title"] == "Explicit title" - assert kwargs["subtitle"] == "Subtitle" - assert kwargs["audience"] == "only_paid" - assert kwargs["write_comment_permissions"] == "only_paid" - assert kwargs["search_engine_title"] == "Search title" - assert kwargs["search_engine_description"] == "Search description" - assert kwargs["slug"] == "explicit-title" - assert kwargs["draft_section_id"] == 9 - assert kwargs["tags"] == ["python", "automation"] - assert json.loads(capsys.readouterr().out) == { - "action": "create", - "draft_id": 43, - "draft": {"id": 43, "draft_title": "Explicit title"}, - "tags": {"tags_added": ["python", "automation"]}, - } - - -def test_drafts_create_uses_filename_when_heading_is_missing( - tmp_path, monkeypatch, capsys -): - markdown = tmp_path / "file-title.md" - markdown.write_text("Body", encoding="utf-8") - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "create", str(markdown)]) == 0 - - assert api.calls[0][1]["title"] == "file-title" - assert capsys.readouterr().out == "Created draft 43: file-title\n" - - -def test_drafts_create_missing_file_uses_existing_error_contract( - tmp_path, monkeypatch, capsys -): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "create", str(tmp_path / "missing.md")]) == 1 - - error = json.loads(capsys.readouterr().err) - assert error["error"]["type"] == "io_error" - assert api.calls == [] - - -def test_drafts_export_prints_markdown_without_writing(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "export", "42"]) == 0 - - assert capsys.readouterr().out == "# Exported\n" - assert api.calls == [("export", 42)] - - -def test_drafts_export_help_lists_file_safety_options(capsys): - with pytest.raises(SystemExit) as exc_info: - cli._build_parser().parse_args(["drafts", "export", "--help"]) - - assert exc_info.value.code == 0 - output = capsys.readouterr().out - assert "--output" in output - assert "--force" in output - - -def test_drafts_export_json_contract(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "export", "42"]) == 0 - - assert json.loads(capsys.readouterr().out) == { - "action": "export", - "draft_id": 42, - "markdown": "# Exported\n", - "unsupported_nodes": [{"type": "futureWidget"}], - } - - -def test_drafts_export_writes_utf8_and_refuses_overwrite(tmp_path, monkeypatch, capsys): - output = tmp_path / "backup.md" - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "export", "42", "--output", str(output)]) == 0 - assert output.read_text(encoding="utf-8") == "# Exported\n" - assert "Exported draft 42" in capsys.readouterr().out - - output.write_text("keep me", encoding="utf-8") - api.calls.clear() - assert cli.main(["drafts", "export", "42", "--output", str(output)]) == 2 - assert output.read_text(encoding="utf-8") == "keep me" - assert api.calls == [] - assert "--force" in capsys.readouterr().err - - assert cli.main(["drafts", "export", "42", "--output", str(output), "--force"]) == 0 - assert output.read_text(encoding="utf-8") == "# Exported\n" - - -def test_drafts_export_malformed_body_leaves_no_partial_file( - tmp_path, monkeypatch, capsys -): - output = tmp_path / "backup.md" - api = OperationsApi() - monkeypatch.setattr( - api, - "export_draft_to_markdown", - lambda draft_id: (_ for _ in ()).throw(ValueError("Malformed draft body")), - ) - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "export", "42", "--output", str(output)]) == 1 - - assert not output.exists() - error = json.loads(capsys.readouterr().err) - assert error["error"]["message"] == "Malformed draft body" - - -def test_drafts_create_invalid_utf8_uses_existing_error_contract( - tmp_path, monkeypatch, capsys -): - markdown = tmp_path / "invalid.md" - markdown.write_bytes(b"\xff") - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "create", str(markdown)]) == 1 - - error = json.loads(capsys.readouterr().err) - assert error["error"]["type"] == "configuration_error" - assert api.calls == [] - - -def test_drafts_create_api_error_is_redacted(tmp_path, monkeypatch, capsys): - markdown = tmp_path / "post.md" - markdown.write_text("Body", encoding="utf-8") - secret = "draft-secret" - api = OperationsApi() - monkeypatch.setenv("PASSWORD", secret) - monkeypatch.setattr( - api, - "create_draft_from_markdown", - lambda **kwargs: (_ for _ in ()).throw( - SubstackAPIException(400, json.dumps({"error": f"failed {secret}"})) - ), - ) - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "create", str(markdown)]) == 1 - - error_text = capsys.readouterr().err - assert secret not in error_text - assert "[redacted]" in error_text - assert json.loads(error_text)["error"]["type"] == "api_error" - - -def test_schedule_accepts_z_timestamp(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert ( - cli.main(["--json", "drafts", "schedule", "42", "--at", "2030-01-02T03:04:05Z"]) - == 0 - ) - - scheduled_at = api.calls[0][2] - assert scheduled_at == datetime(2030, 1, 2, 3, 4, 5, tzinfo=timezone.utc) - output = json.loads(capsys.readouterr().out) - assert output["scheduled_at"] == "2030-01-02T03:04:05+00:00" - - -def test_schedule_preserves_timezone_offset(monkeypatch): - api = OperationsApi() - use_api(monkeypatch, api) - - assert ( - cli.main(["drafts", "schedule", "42", "--at", "2030-01-02T03:04:05+02:30"]) == 0 - ) - - assert api.calls[0][2].utcoffset() == timedelta(hours=2, minutes=30) - - -def test_schedule_rejects_naive_and_malformed_timestamps(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["drafts", "schedule", "42", "--at", "2030-01-02T03:04:05"]) == 2 - assert "timezone offset or Z" in capsys.readouterr().err - assert cli.main(["drafts", "schedule", "42", "--at", "tomorrow"]) == 2 - assert "valid ISO 8601" in capsys.readouterr().err - assert api.calls == [] - - -def test_unschedule_json_contract(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "unschedule", "42"]) == 0 - - assert json.loads(capsys.readouterr().out) == { - "action": "unschedule", - "draft_id": 42, - "result": {"scheduled": False}, - } - - -def test_publish_requires_yes_in_noninteractive_mode(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - monkeypatch.setattr(sys, "stdin", io.StringIO()) - - assert cli.main(["drafts", "publish", "42"]) == 2 - - assert "requires --yes" in capsys.readouterr().err - assert api.calls == [] - - -def test_publish_requires_yes_in_json_mode(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - monkeypatch.setattr(sys, "stdin", TTYInput("yes\n")) - - assert cli.main(["--json", "drafts", "publish", "42"]) == 2 - - error = json.loads(capsys.readouterr().err) - assert error["error"]["type"] == "usage_error" - assert "requires --yes" in error["error"]["message"] - assert api.calls == [] - - -def test_publish_calls_prepublish_before_publish(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert ( - cli.main( - [ - "--json", - "drafts", - "publish", - "42", - "--no-send", - "--share-automatically", - "--yes", - ] - ) - == 0 - ) - - assert api.calls == [ - ("prepublish", 42), - ("publish", 42, False, True), - ] - output = json.loads(capsys.readouterr().out) - assert output["prepublish"] == {"ready": True} - assert output["result"] == {"published": True} - - -def test_publish_stops_when_prepublish_fails(monkeypatch, capsys): - api = OperationsApi() - api.publish_error = SubstackAPIException(400, '{"error":"Draft is not ready"}') - use_api(monkeypatch, api) - - assert cli.main(["drafts", "publish", "42", "--yes"]) == 1 - - assert api.calls == [("prepublish", 42)] - assert "Draft is not ready" in capsys.readouterr().err - - -def test_delete_interactive_confirmation(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - monkeypatch.setattr(sys, "stdin", TTYInput("yes\n")) - - assert cli.main(["drafts", "delete", "42"]) == 0 - - assert api.calls == [("delete", 42)] - assert "Deleted draft 42" in capsys.readouterr().out - - -def test_delete_interactive_decline(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - monkeypatch.setattr(sys, "stdin", TTYInput("no\n")) - - assert cli.main(["drafts", "delete", "42"]) == 2 - - assert api.calls == [] - assert "Cancelled" in capsys.readouterr().err - - -def test_delete_yes_json_contract(monkeypatch, capsys): - api = OperationsApi() - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "delete", "42", "--yes"]) == 0 - - assert json.loads(capsys.readouterr().out) == { - "action": "delete", - "draft_id": 42, - "result": {"deleted": True}, - } - assert api.calls == [("delete", 42)] - - -def test_json_error_redacts_secrets(monkeypatch, capsys): - secret = "session-secret" - api = OperationsApi() - monkeypatch.setenv("COOKIES_STRING", secret) - monkeypatch.setattr( - api, - "get_drafts", - lambda **kwargs: (_ for _ in ()).throw( - SubstackAPIException(401, json.dumps({"error": f"bad cookie {secret}"})) - ), - ) - use_api(monkeypatch, api) - - assert cli.main(["--json", "drafts", "list"]) == 1 - - error = capsys.readouterr().err - assert secret not in error - assert "[redacted]" in error - assert json.loads(error)["error"]["status_code"] == 401 - - -def test_api_from_env_preserves_auth_precedence_and_publication_override(monkeypatch): - calls = [] - monkeypatch.setenv("COOKIES_PATH", "environment-cookies.json") - monkeypatch.setenv("COOKIES_STRING", "cookie=value") - monkeypatch.setenv("EMAIL", "writer@example.com") - monkeypatch.setenv("PASSWORD", "secret") - monkeypatch.setenv("PUBLICATION_URL", "https://environment.substack.com") - monkeypatch.setattr(cli, "Api", lambda **kwargs: calls.append(kwargs) or kwargs) - - result = cli._api_from_env( - cookies_path="explicit-cookies.json", - publication_url="https://selected.substack.com", - ) - - assert result == { - "cookies_path": "explicit-cookies.json", - "cookies_string": "cookie=value", - "publication_url": "https://selected.substack.com", - "timeout": None, - } - assert calls == [result] - - -def test_api_from_env_uses_email_password_without_cookies(monkeypatch): - calls = [] - monkeypatch.setattr(cli, "load_dotenv", lambda: None) - monkeypatch.delenv("COOKIES_PATH", raising=False) - monkeypatch.delenv("COOKIES_STRING", raising=False) - monkeypatch.setenv("EMAIL", "writer@example.com") - monkeypatch.setenv("PASSWORD", "secret") - monkeypatch.setenv("PUBLICATION_URL", "https://writer.substack.com") - monkeypatch.setattr(cli, "Api", lambda **kwargs: calls.append(kwargs) or kwargs) - - result = cli._api_from_env() - - assert result == { - "email": "writer@example.com", - "password": "secret", - "publication_url": "https://writer.substack.com", - "timeout": None, - } - assert calls == [result] - - -def test_main_forwards_global_auth_and_publication_options(monkeypatch): - api = OperationsApi() - received = [] - monkeypatch.setattr( - cli, - "_api_from_env", - lambda cookies_path=None, publication_url=None, timeout=None: ( - received.append((cookies_path, publication_url, timeout)) or api - ), - ) - - assert ( - cli.main( - [ - "--cookies", - "cookies.json", - "--publication-url", - "https://selected.substack.com", - "drafts", - "get", - "42", - ] - ) - == 0 - ) - - assert received == [("cookies.json", "https://selected.substack.com", None)] diff --git a/tests/substack/test_cli_update.py b/tests/substack/test_cli_update.py deleted file mode 100644 index 5e82cb1..0000000 --- a/tests/substack/test_cli_update.py +++ /dev/null @@ -1,171 +0,0 @@ -import json -from pathlib import Path - -import pytest - -from substack import cli - - -class UpdateOperationsApi: - def __init__(self): - self.calls = [] - - def update_draft_from_markdown(self, draft_id, markdown, **kwargs): - self.calls.append(("update", draft_id, markdown, kwargs)) - return { - "action": "update", - "draft_id": draft_id, - "dry_run": kwargs.get("dry_run", False), - "changed": not kwargs.get("dry_run", False), - "payload": {}, - "draft": {"id": draft_id}, - "tags": None, - "unsupported_nodes": [], - } - - -def use_api(monkeypatch, mock_api): - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: mock_api) - - -def test_drafts_update_requires_yes_in_json_mode(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert cli.main(["--json", "drafts", "update", "42", str(md_file)]) == 2 - err = capsys.readouterr().err - assert "requires" in err or "required" in err - assert "--yes" in err - assert api.calls == [] - - -def test_drafts_update_json_dry_run(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert ( - cli.main( - ["--json", "drafts", "update", "42", str(md_file), "--dry-run", "--yes"] - ) - == 0 - ) - out = json.loads(capsys.readouterr().out) - assert out["action"] == "update" - assert out["draft_id"] == 42 - assert out["dry_run"] is True - assert api.calls[0][0] == "update" - assert api.calls[0][1] == 42 - assert api.calls[0][2] == "# Test" - assert api.calls[0][3]["dry_run"] is True - - -def test_drafts_update_requires_yes_for_allow_image_replacement( - tmp_path, monkeypatch, capsys -): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert ( - cli.main(["drafts", "update", "42", str(md_file), "--allow-image-replacement"]) - == 2 - ) - err = capsys.readouterr().err - assert "--yes is required when using --allow-image-replacement" in err - assert api.calls == [] - - -def test_drafts_update_passes_allow_image_replacement(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert ( - cli.main( - [ - "--json", - "drafts", - "update", - "42", - str(md_file), - "--allow-image-replacement", - "--yes", - ] - ) - == 0 - ) - assert api.calls[0][0] == "update" - assert api.calls[0][1] == 42 - assert api.calls[0][3]["allow_image_replacement"] is True - - -def test_drafts_update_requires_yes_for_allow_conflict(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert cli.main(["drafts", "update", "42", str(md_file), "--allow-conflict"]) == 2 - err = capsys.readouterr().err - assert "--yes is required when using --allow-conflict" in err - assert api.calls == [] - - -def test_drafts_update_requires_yes_for_force(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert cli.main(["drafts", "update", "42", str(md_file), "--force"]) == 2 - err = capsys.readouterr().err - assert "--yes is required when using --allow-conflict" in err - assert api.calls == [] - - -def test_drafts_update_passes_allow_conflict(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert ( - cli.main( - [ - "--json", - "drafts", - "update", - "42", - str(md_file), - "--allow-conflict", - "--yes", - ] - ) - == 0 - ) - assert api.calls[0][0] == "update" - assert api.calls[0][1] == 42 - assert api.calls[0][3]["allow_conflict"] is True - - -def test_drafts_update_passes_force_as_allow_conflict(tmp_path, monkeypatch, capsys): - api = UpdateOperationsApi() - use_api(monkeypatch, api) - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - assert ( - cli.main( - [ - "--json", - "drafts", - "update", - "42", - str(md_file), - "--force", - "--yes", - ] - ) - == 0 - ) - assert api.calls[0][0] == "update" - assert api.calls[0][1] == 42 - assert api.calls[0][3]["allow_conflict"] is True diff --git a/tests/substack/test_conflict_aware_update.py b/tests/substack/test_conflict_aware_update.py deleted file mode 100644 index 1ec4445..0000000 --- a/tests/substack/test_conflict_aware_update.py +++ /dev/null @@ -1,472 +0,0 @@ -import base64 -import json -from unittest.mock import Mock - -import pytest - -from substack import Api, cli -from substack.exceptions import DraftConflictError, SubstackException -from substack.nodes import paragraph, text -from substack.revision import ( - compare_draft_revisions, - compute_draft_revision, - format_revision_marker, - parse_revision_marker, -) - - -def _sample_draft( - draft_id=42, - body_text="Hello world", - title="Original Title", - subtitle="Original Subtitle", - audience="everyone", - write_comment_permissions="everyone", - draft_section_id=None, - slug="original-slug", - updated_at="2026-10-01T10:00:00Z", -): - body = {"type": "doc", "content": [paragraph([text(body_text)])]} - return { - "id": draft_id, - "draft_body": json.dumps(body), - "draft_title": title, - "draft_subtitle": subtitle, - "audience": audience, - "write_comment_permissions": write_comment_permissions, - "draft_section_id": draft_section_id, - "slug": slug, - "draft_updated_at": updated_at, - } - - -# ============================================================================== -# 1. Revision Helper Unit Tests -# ============================================================================== - - -def test_compute_draft_revision_stability(): - draft1 = _sample_draft() - draft2 = _sample_draft() - rev1 = compute_draft_revision(draft1) - rev2 = compute_draft_revision(draft2) - assert rev1["revision"] == rev2["revision"] - assert rev1["body_hash"] == rev2["body_hash"] - assert rev1["draft_id"] == 42 - assert rev1["version"] == 1 - - -def test_format_and_parse_revision_marker_roundtrip(): - draft = _sample_draft() - rev = compute_draft_revision(draft) - marker = format_revision_marker(rev) - assert marker.startswith("") - - markdown = f"{marker}\n\n# Document Title\n\nSome text content." - parsed = parse_revision_marker(markdown) - assert parsed is not None - assert parsed["revision"] == rev["revision"] - assert parsed["draft_id"] == 42 - assert parsed["body_hash"] == rev["body_hash"] - - -def test_parse_revision_marker_ignores_code_blocks(): - draft = _sample_draft() - rev = compute_draft_revision(draft) - marker = format_revision_marker(rev) - - # Marker inside fenced code block should not be parsed as the document revision marker - fenced_code_md = f"""# Guide - -```markdown -{marker} -``` - -No top-level marker here. -""" - assert parse_revision_marker(fenced_code_md) is None - - -def test_parse_revision_marker_rejects_malformed_syntax(): - with pytest.raises(ValueError, match="Malformed revision marker"): - parse_revision_marker("") - - with pytest.raises(ValueError, match="Malformed revision marker"): - parse_revision_marker("") - - -def test_parse_revision_marker_rejects_corrupt_json(): - corrupt_bytes = base64.urlsafe_b64encode(b"{not json").decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="invalid JSON"): - parse_revision_marker(f"") - - -def test_parse_revision_marker_rejects_non_dict_payload(): - non_dict = base64.urlsafe_b64encode(b'["list"]').decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="payload must be a JSON object"): - parse_revision_marker(f"") - - -def test_parse_revision_marker_rejects_missing_revision_field(): - missing_rev = ( - base64.urlsafe_b64encode(b'{"draft_id": 42}').decode("ascii").rstrip("=") - ) - with pytest.raises(ValueError, match="missing or empty required 'revision' field"): - parse_revision_marker(f"") - - -def test_parse_revision_marker_rejects_unsupported_version(): - valid = base64.urlsafe_b64encode(b'{"revision": "abc"}').decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="unsupported version '2'"): - parse_revision_marker(f"") - - -def test_parse_revision_marker_rejects_multiple_markers(): - draft = _sample_draft() - rev = compute_draft_revision(draft) - m = format_revision_marker(rev) - multi_md = f"{m}\n\nSome text\n\n{m}" - with pytest.raises(ValueError, match="multiple revision markers found"): - parse_revision_marker(multi_md) - - -# ============================================================================== -# 2. SDK Unchanged Draft Updates -# ============================================================================== - - -def test_sdk_update_unchanged_draft_succeeds(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - draft = _sample_draft() - monkeypatch.setattr(api, "get_draft", lambda d_id: draft) - put_mock = Mock(return_value={"id": 42}) - monkeypatch.setattr(api, "put_draft", put_mock) - - exported = api.export_draft_to_markdown(42) - assert "revision" in exported - assert "python-substack-revision:v1" in exported["markdown"] - - # Update using exported markdown - res = api.update_draft_from_markdown(42, exported["markdown"]) - assert res["action"] == "update" - assert res["conflict"] is False - assert res["mismatches"] == [] - assert put_mock.called - - -# ============================================================================== -# 3. SDK Conflict Detection: Remote Body and Metadata Changes -# ============================================================================== - - -def test_sdk_update_detects_remote_body_conflict(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - initial_draft = _sample_draft(body_text="Initial remote content") - monkeypatch.setattr(api, "get_draft", lambda d_id: initial_draft) - exported = api.export_draft_to_markdown(42) - - # Remote draft body is modified on Substack after export - modified_draft = _sample_draft(body_text="Altered content on Substack web editor") - monkeypatch.setattr(api, "get_draft", lambda d_id: modified_draft) - put_mock = Mock() - monkeypatch.setattr(api, "put_draft", put_mock) - - # 1. Normal update fails closed - with pytest.raises(DraftConflictError) as exc_info: - api.update_draft_from_markdown(42, exported["markdown"]) - - err = exc_info.value - assert isinstance(err, ValueError) - assert isinstance(err, SubstackException) - assert "Remote draft body has changed since export" in err.message - assert "Remote draft body has changed since export" in err.mismatches - assert not put_mock.called - - # 2. Dry run returns conflict details without writing - dry = api.update_draft_from_markdown(42, exported["markdown"], dry_run=True) - assert dry["dry_run"] is True - assert dry["conflict"] is True - assert "Remote draft body has changed since export" in dry["mismatches"] - assert not put_mock.called - - # 3. Explicit override proceeds - overridden = api.update_draft_from_markdown( - 42, exported["markdown"], allow_conflict=True - ) - assert overridden["action"] == "update" - assert overridden["conflict"] is True - assert overridden["override"] is True - assert put_mock.called - - -def test_sdk_update_detects_remote_metadata_conflicts(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - initial_draft = _sample_draft( - title="Title A", - subtitle="Subtitle A", - audience="everyone", - write_comment_permissions="everyone", - draft_section_id=10, - slug="slug-a", - ) - monkeypatch.setattr(api, "get_draft", lambda d_id: initial_draft) - exported = api.export_draft_to_markdown(42) - - # Remote metadata modified on Substack - changed_draft = _sample_draft( - title="Title B", - subtitle="Subtitle B", - audience="paid", - write_comment_permissions="none", - draft_section_id=20, - slug="slug-b", - ) - monkeypatch.setattr(api, "get_draft", lambda d_id: changed_draft) - - dry = api.update_draft_from_markdown(42, exported["markdown"], dry_run=True) - assert dry["conflict"] is True - mismatches_text = " ".join(dry["mismatches"]) - assert "Remote title changed" in mismatches_text - assert "Remote subtitle changed" in mismatches_text - assert "Remote audience changed" in mismatches_text - assert "Remote write_comment_permissions changed" in mismatches_text - assert "Remote section changed" in mismatches_text - assert "Remote slug changed" in mismatches_text - - -def test_sdk_update_detects_draft_id_mismatch(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - draft_42 = _sample_draft(draft_id=42) - monkeypatch.setattr(api, "get_draft", lambda d_id: draft_42) - exported = api.export_draft_to_markdown(42) - - # Try applying markdown exported from 42 to draft 99 - draft_99 = _sample_draft(draft_id=99) - monkeypatch.setattr(api, "get_draft", lambda d_id: draft_99) - - with pytest.raises(DraftConflictError, match="Draft ID mismatch"): - api.update_draft_from_markdown(99, exported["markdown"]) - - -# ============================================================================== -# 4. Old Exports / Missing Revision Metadata (Unprotected Update) -# ============================================================================== - - -def test_sdk_update_missing_revision_marker_fails_closed(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - draft = _sample_draft() - monkeypatch.setattr(api, "get_draft", lambda d_id: draft) - put_mock = Mock(return_value={"id": 42}) - monkeypatch.setattr(api, "put_draft", put_mock) - - legacy_markdown = "# Legacy Markdown\n\nNo revision marker here." - - # 1. Fails closed by default - with pytest.raises(DraftConflictError) as exc_info: - api.update_draft_from_markdown(42, legacy_markdown) - assert "missing revision metadata" in exc_info.value.message - assert not put_mock.called - - # 2. Dry run identifies missing metadata - dry = api.update_draft_from_markdown(42, legacy_markdown, dry_run=True) - assert dry["conflict"] is True - assert any("missing revision metadata" in m for m in dry["mismatches"]) - assert not put_mock.called - - # 3. Explicit override with allow_conflict=True proceeds - res = api.update_draft_from_markdown(42, legacy_markdown, allow_conflict=True) - assert res["action"] == "update" - assert res["conflict"] is True - assert res["override"] is True - assert put_mock.called - - # 4. Explicit override with force=True proceeds - put_mock.reset_mock() - res_force = api.update_draft_from_markdown(42, legacy_markdown, force=True) - assert res_force["action"] == "update" - assert res_force["conflict"] is True - assert put_mock.called - - -# ============================================================================== -# 5. CLI Verification: JSON, Non-Interactive, Conflict Display, and Overrides -# ============================================================================== - - -class MockCliApi: - def __init__(self, conflict=False, mismatches=None): - self.calls = [] - self.conflict = conflict - self.mismatches = mismatches or [] - - def update_draft_from_markdown(self, draft_id, markdown, **kwargs): - self.calls.append(("update", draft_id, markdown, kwargs)) - dry_run = kwargs.get("dry_run", False) - allow_conflict = kwargs.get("allow_conflict", False) - - if self.conflict and not dry_run and not allow_conflict: - raise DraftConflictError( - f"Refusing to update: remote draft has changed since export ({'; '.join(self.mismatches)}). " - "Re-export the draft or pass allow_conflict=True to proceed.", - mismatches=self.mismatches, - ) - - payload = { - "action": "update", - "draft_id": draft_id, - "dry_run": dry_run, - "changed": not dry_run, - "conflict": self.conflict, - "mismatches": self.mismatches, - } - if self.conflict and allow_conflict: - payload["override"] = True - return payload - - -def test_cli_update_conflict_fails_with_exit_code_1(tmp_path, monkeypatch, capsys): - mock_api = MockCliApi( - conflict=True, mismatches=["Remote draft body has changed since export"] - ) - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: mock_api) - - md_file = tmp_path / "draft.md" - md_file.write_text("# Draft Content", encoding="utf-8") - - # Non-interactive without --allow-conflict fails with exit code 1 - code = cli.main(["drafts", "update", "42", str(md_file), "--yes"]) - assert code == 1 - err = capsys.readouterr().err - assert "remote draft has changed since export" in err - - -def test_cli_update_conflict_json_output(tmp_path, monkeypatch, capsys): - mock_api = MockCliApi( - conflict=True, mismatches=["Remote draft body has changed since export"] - ) - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: mock_api) - - md_file = tmp_path / "draft.md" - md_file.write_text("# Draft Content", encoding="utf-8") - - # In --json mode, outputs structured conflict error - code = cli.main(["--json", "drafts", "update", "42", str(md_file), "--yes"]) - assert code == 1 - err = json.loads(capsys.readouterr().err) - assert err["error"]["type"] == "conflict_error" - assert "Remote draft body has changed since export" in err["error"]["mismatches"] - - -def test_cli_update_dry_run_conflict_json_output(tmp_path, monkeypatch, capsys): - mock_api = MockCliApi( - conflict=True, mismatches=["Remote draft body has changed since export"] - ) - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: mock_api) - - md_file = tmp_path / "draft.md" - md_file.write_text("# Draft Content", encoding="utf-8") - - code = cli.main( - ["--json", "drafts", "update", "42", str(md_file), "--dry-run", "--yes"] - ) - assert code == 0 - out = json.loads(capsys.readouterr().out) - assert out["conflict"] is True - assert out["dry_run"] is True - assert "Remote draft body has changed since export" in out["mismatches"] - - -def test_cli_update_override_with_allow_conflict_and_yes(tmp_path, monkeypatch, capsys): - mock_api = MockCliApi( - conflict=True, mismatches=["Remote draft body has changed since export"] - ) - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: mock_api) - - md_file = tmp_path / "draft.md" - md_file.write_text("# Draft Content", encoding="utf-8") - - code = cli.main( - [ - "--json", - "drafts", - "update", - "42", - str(md_file), - "--allow-conflict", - "--yes", - ] - ) - assert code == 0 - out = json.loads(capsys.readouterr().out) - assert out["conflict"] is True - assert out["override"] is True - - -def test_cli_export_includes_revision_in_json(monkeypatch, capsys): - class ExportApi: - def export_draft_to_markdown(self, draft_id): - return { - "draft": {"id": draft_id}, - "markdown": "\n\n# Body", - "unsupported_nodes": [], - "revision": {"draft_id": draft_id, "revision": "rev123", "version": 1}, - } - - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: ExportApi()) - code = cli.main(["--json", "drafts", "export", "42"]) - assert code == 0 - out = json.loads(capsys.readouterr().out) - assert out["action"] == "export" - assert out["revision"] == { - "draft_id": 42, - "revision": "rev123", - "version": 1, - } - - -# ============================================================================== -# 6. Adversarial Tests: Bidi, Unicode, Special Chars, Complex Nested Documents -# ============================================================================== - - -def test_adversarial_bidi_and_nested_content_conflict_resolution(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - complex_title = "Hebrew & Arabic \u202e\u05e2\u05d1\u05e8\u05d9\u05ea\u202c \u202e\u0627\u0644\u0639\u0631\u0628\u064a\u0629\u202c \"Quotes\" 'Single'" - complex_subtitle = "Special πŸš€πŸ”₯✨ zero\u200bwidth & chars \x00 null test" - - draft = _sample_draft( - title=complex_title, - subtitle=complex_subtitle, - body_text="Complex body with emojis πŸŒŸπŸŽ‰", - ) - monkeypatch.setattr(api, "get_draft", lambda d_id: draft) - put_mock = Mock(return_value={"id": 42}) - monkeypatch.setattr(api, "put_draft", put_mock) - - exported = api.export_draft_to_markdown(42) - assert "python-substack-revision:v1" in exported["markdown"] - - # Updating with the exact exported markdown resolves without conflict - res = api.update_draft_from_markdown(42, exported["markdown"]) - assert res["conflict"] is False - assert put_mock.called diff --git a/tests/substack/test_documentation.py b/tests/substack/test_documentation.py deleted file mode 100644 index 20c2b71..0000000 --- a/tests/substack/test_documentation.py +++ /dev/null @@ -1,153 +0,0 @@ -from pathlib import Path - -import pytest -from markdown_it import MarkdownIt - -from substack import cli -from substack.cli import main - -ROOT = Path(__file__).parents[2] - - -@pytest.mark.parametrize("option", ["--help", "--version"]) -def test_documented_installation_checks_do_not_authenticate(option): - with pytest.raises(SystemExit) as exc: - main([option]) - - assert exc.value.code == 0 - - -def test_local_markdown_links_exist(): - documents = [ - ROOT / "README.md", - ROOT / "CONTRIBUTING.md", - ROOT / "SECURITY.md", - *sorted((ROOT / "docs").rglob("*.md")), - ] - - for document in documents: - markdown = document.read_text(encoding="utf-8") - for target in _local_markdown_targets(markdown): - linked = document.parent / target - assert linked.is_file(), f"{document.relative_to(ROOT)} -> {target}" - - -def _local_markdown_targets(markdown): - for token in MarkdownIt("commonmark").parse(markdown): - for child in token.children or []: - if child.type == "link_open": - target = child.attrs.get("href", "") - elif child.type == "image": - target = child.attrs.get("src", "") - else: - continue - - target = target.split("#", 1)[0] - if target and "://" not in target and not target.startswith("#"): - yield target - - -def test_pages_documents_have_front_matter(): - for document in sorted((ROOT / "docs").rglob("*.md")): - markdown = document.read_text(encoding="utf-8") - assert markdown.startswith("---\n"), document.relative_to(ROOT) - assert "\nlayout: default\n" in markdown, document.relative_to(ROOT) - - -class DocumentationApi: - publication_url = "https://example.substack.com/api/v1" - - def __init__(self): - self.calls = [] - - def get_user_profile(self): - return {"id": 1, "email": "writer@example.com"} - - def get_user_publications(self): - return [ - { - "id": 2, - "name": "Example", - "subdomain": "example", - "publication_url": "https://example.substack.com", - } - ] - - def get_publication_subscriber_count(self): - return 3 - - def create_draft_from_markdown(self, **kwargs): - self.calls.append(("create", kwargs)) - return {"draft": {"id": 12345}, "tags": None} - - def get_drafts(self, **kwargs): - self.calls.append(("list", kwargs)) - return [] - - def schedule_draft(self, draft_id, scheduled_at): - self.calls.append(("schedule", draft_id, scheduled_at.isoformat())) - return {"scheduled": True} - - -def test_documented_cli_onboarding_examples(tmp_path, monkeypatch, capsys): - getting_started = (ROOT / "docs" / "getting-started.md").read_text(encoding="utf-8") - cli_guide = (ROOT / "docs" / "cli.md").read_text(encoding="utf-8") - documented = getting_started + cli_guide - for command in ( - "substack status", - "substack drafts create first-draft.md", - "substack publications list", - "substack --publication-url https://example.substack.com drafts list", - "substack drafts schedule 12345 --at 2030-01-02T09:00:00+01:00", - "substack --json drafts list --limit 10", - ): - assert command in documented - - markdown = tmp_path / "first-draft.md" - markdown.write_text("# My first automated draft\n\nBody", encoding="utf-8") - api = DocumentationApi() - received = [] - monkeypatch.setattr( - cli, - "_api_from_env", - lambda cookies_path=None, publication_url=None, timeout=None: ( - received.append((cookies_path, publication_url, timeout)) or api - ), - ) - - assert main(["status"]) == 0 - assert main(["drafts", "create", str(markdown)]) == 0 - assert main(["publications", "list"]) == 0 - assert ( - main( - [ - "--publication-url", - "https://example.substack.com", - "drafts", - "list", - ] - ) - == 0 - ) - assert ( - main( - [ - "drafts", - "schedule", - "12345", - "--at", - "2030-01-02T09:00:00+01:00", - ] - ) - == 0 - ) - assert main(["--json", "drafts", "list", "--limit", "10"]) == 0 - - capsys.readouterr() - assert received[3] == (None, "https://example.substack.com", None) - assert ("list", {"filter": "draft", "offset": 0, "limit": 10}) in api.calls - assert ( - "schedule", - 12345, - "2030-01-02T09:00:00+01:00", - ) in api.calls diff --git a/tests/substack/test_end_to_end.py b/tests/substack/test_end_to_end.py deleted file mode 100644 index f1c5855..0000000 --- a/tests/substack/test_end_to_end.py +++ /dev/null @@ -1,196 +0,0 @@ -"""End-to-end Markdown -> Substack draft round-trip test. - -Reads a feature-complete Markdown fixture, creates a real draft via the API, -retrieves it, and compares the (normalised) stored document against a saved -golden file (``full_features.expected.json``). - -This test creates and deletes a real draft, so it is opt-in: it only runs when -``RUN_SUBSTACK_E2E`` is set **and** credentials are configured (a ``.env`` file -is loaded). A normal ``pytest`` run with a ``.env`` present will skip it rather -than touching the account. - - - ``RUN_SUBSTACK_E2E=1`` to enable - - ``COOKIES_STRING`` (or ``COOKIES_PATH``), **or** ``EMAIL`` + ``PASSWORD`` - - ``PUBLICATION_URL`` (optional but recommended) - -To regenerate the golden file after an intentional change:: - - python -m tests.substack.test_end_to_end --generate -""" - -import copy -import json -import os -import sys -from pathlib import Path - -import pytest -from dotenv import load_dotenv - -from substack import Api -from substack.mdrender import markdown_to_doc -from substack.post import Post - -load_dotenv() - -FIXTURES = Path(__file__).parent / "fixtures" -MARKDOWN_FILE = FIXTURES / "full_features.md" -EXPECTED_FILE = FIXTURES / "full_features.expected.json" - -TITLE = "python-substack e2e feature test" -SUBTITLE = "Automated round-trip fixture" - -LOCAL_IMAGE_ALT = "A locally uploaded image" - - -def _image_srcs_by_alt(content, alt): - """Collect every image2 src whose alt matches (for upload verification).""" - found = [] - - def walk(node): - if isinstance(node, dict): - if node.get("type") == "image2" and node.get("attrs", {}).get("alt") == alt: - found.append(node["attrs"].get("src")) - for value in node.values(): - walk(value) - elif isinstance(node, list): - for item in node: - walk(item) - - walk(content) - return found - - -def _has_credentials() -> bool: - return bool( - os.getenv("COOKIES_STRING") - or os.getenv("COOKIES_PATH") - or (os.getenv("EMAIL") and os.getenv("PASSWORD")) - ) - - -def _e2e_enabled() -> bool: - """Only run when explicitly opted in AND credentials are present. - - Creating/deleting real drafts should never happen by surprise on a local - ``pytest`` run that merely has a ``.env`` file, so an explicit - ``RUN_SUBSTACK_E2E`` opt-in is required. - """ - return bool(os.getenv("RUN_SUBSTACK_E2E")) and _has_credentials() - - -def _api_from_env() -> Api: - cookies_string = os.getenv("COOKIES_STRING") - cookies_path = os.getenv("COOKIES_PATH") - publication_url = os.getenv("PUBLICATION_URL") - if cookies_string or cookies_path: - return Api( - cookies_string=cookies_string, - cookies_path=cookies_path, - publication_url=publication_url, - ) - return Api( - email=os.getenv("EMAIL"), - password=os.getenv("PASSWORD"), - publication_url=publication_url, - ) - - -def _normalize(content): - """Replace values that vary between runs/environments. - - Image ``src`` is a per-upload URL, and Substack fills in the dimension - attributes (``height``/``width``/``resizeWidth``) for uploaded images via its - own image pipeline (not deterministically), so all of these are blanked - before comparison. - """ - volatile = { - "src": "", - "height": "", - "width": "", - "resizeWidth": "", - } - - def walk(node): - if isinstance(node, dict): - return { - key: (volatile[key] if key in volatile else walk(value)) - for key, value in node.items() - } - if isinstance(node, list): - return [walk(item) for item in node] - return node - - return walk(copy.deepcopy(content)) - - -def _roundtrip(api: Api): - """Post the fixture as a draft, read it back, and return its stored content.""" - markdown = MARKDOWN_FILE.read_text(encoding="utf-8") - post = Post(TITLE, SUBTITLE, user_id=api.get_user_id()) - # Markdown image paths resolve relative to the working directory (this is how - # get_image uploads local files), so render from the fixtures directory just as - # a user authoring alongside their images would. - previous_cwd = os.getcwd() - os.chdir(FIXTURES) - try: - post.from_markdown(markdown, api=api) - finally: - os.chdir(previous_cwd) - draft = api.post_draft(post.get_draft()) - draft_id = draft.get("id") - try: - stored = api.get_draft(draft_id) - body = stored.get("draft_body") - if isinstance(body, str): - body = json.loads(body) - exported = api.export_draft_to_markdown(draft_id) - assert exported["draft"]["id"] == draft_id - assert exported["unsupported_nodes"] == [] - assert markdown_to_doc(exported["markdown"]) == body["content"] - return body["content"] - finally: - try: - api.delete_draft(draft_id) - except Exception: - pass - - -@pytest.mark.skipif( - not _e2e_enabled(), - reason="set RUN_SUBSTACK_E2E=1 and configure credentials to run the live e2e test", -) -@pytest.mark.live -def test_full_features_roundtrip(): - api = _api_from_env() - content = _roundtrip(api) - - # The locally-sourced image must have been uploaded to a remote Substack URL - # rather than left as the local file path. - local_srcs = _image_srcs_by_alt(content, LOCAL_IMAGE_ALT) - assert local_srcs, "local image node not found in stored draft" - assert local_srcs[0].startswith( - "http" - ), f"local image was not uploaded: {local_srcs[0]!r}" - - expected = json.loads(EXPECTED_FILE.read_text(encoding="utf-8")) - assert _normalize(content) == expected - - -def _generate(): - """Regenerate the golden file from a live round-trip.""" - if not _has_credentials(): - raise SystemExit("No credentials configured; cannot generate golden file.") - api = _api_from_env() - content = _normalize(_roundtrip(api)) - EXPECTED_FILE.write_text( - json.dumps(content, indent=2, ensure_ascii=False) + "\n", encoding="utf-8" - ) - print(f"Wrote {EXPECTED_FILE}") - - -if __name__ == "__main__": - if "--generate" in sys.argv: - _generate() - else: - print(__doc__) diff --git a/tests/substack/test_examples.py b/tests/substack/test_examples.py deleted file mode 100644 index a8ac539..0000000 --- a/tests/substack/test_examples.py +++ /dev/null @@ -1,14 +0,0 @@ -from pathlib import Path - - -def test_publish_flags_use_store_true(): - root = Path(__file__).parents[2] - for path in [ - root / "examples" / "publish_post.py", - root / "examples" / "publish_markdown.py", - ]: - source = path.read_text(encoding="utf-8") - assert '"--publish", help="Publish the draft.", action="store_true"' in source - assert ( - '"--publish", help="Publish the draft.", action="store_false"' not in source - ) diff --git a/tests/substack/test_footnotes.py b/tests/substack/test_footnotes.py deleted file mode 100644 index 3fd9b12..0000000 --- a/tests/substack/test_footnotes.py +++ /dev/null @@ -1,271 +0,0 @@ -"""Tests for Markdown footnote support in post.py.""" - -from substack.post import Post - -# --------------------------------------------------------------------------- -# Helpers -# --------------------------------------------------------------------------- - - -def make_post(): - """Create a fresh Post instance for testing.""" - return Post(title="Test", subtitle="Sub", user_id=1) - - -def body_content(post): - """Return the content list from the post's draft body.""" - return post.draft_body["content"] - - -def find_nodes(node, node_type, acc=None): - """Recursively collect every node of a given type from a doc tree.""" - if acc is None: - acc = [] - if isinstance(node, dict): - if node.get("type") == node_type: - acc.append(node) - for value in node.values(): - find_nodes(value, node_type, acc) - elif isinstance(node, list): - for value in node: - find_nodes(value, node_type, acc) - return acc - - -def anchors(post): - return find_nodes(post.draft_body, "footnoteAnchor") - - -def footnotes(post): - return find_nodes(post.draft_body, "footnote") - - -# --------------------------------------------------------------------------- -# TestFootnoteHelpers -# --------------------------------------------------------------------------- - - -class TestFootnoteHelpers: - def test_footnote_anchor_added_inline(self): - post = make_post() - post.paragraph(content=[{"content": "See here."}]) - post.footnote_anchor(1) - para = body_content(post)[0] - assert para["content"][-1] == {"type": "footnoteAnchor", "attrs": {"number": 1}} - - def test_footnote_block_from_string(self): - post = make_post() - post.footnote(1, "A simple note.") - block = body_content(post)[-1] - assert block["type"] == "footnote" - assert block["attrs"] == {"number": 1} - assert block["content"][0]["type"] == "paragraph" - assert block["content"][0]["content"][0]["text"] == "A simple note." - - def test_footnote_block_parses_inline_markdown(self): - post = make_post() - post.footnote(2, "See [the source](https://example.com).") - block = footnotes(post)[0] - text_nodes = block["content"][0]["content"] - link_node = next(n for n in text_nodes if n.get("marks")) - assert link_node["text"] == "the source" - assert link_node["marks"] == [ - {"type": "link", "attrs": {"href": "https://example.com"}} - ] - - -# --------------------------------------------------------------------------- -# TestFromMarkdownFootnotes -# --------------------------------------------------------------------------- - - -class TestFromMarkdownFootnotes: - def test_basic_reference_and_definition(self): - post = make_post() - post.from_markdown("A claim.[^1]\n\n[^1]: The supporting detail.") - assert len(anchors(post)) == 1 - assert anchors(post)[0]["attrs"]["number"] == 1 - blocks = footnotes(post) - assert len(blocks) == 1 - assert blocks[0]["attrs"]["number"] == 1 - assert blocks[0]["content"][0]["content"][0]["text"] == "The supporting detail." - - def test_definition_removed_from_body(self): - post = make_post() - post.from_markdown("A claim.[^1]\n\n[^1]: The note.") - # The definition line must not leak into a paragraph. - paragraphs = find_nodes(post.draft_body, "paragraph") - body_text = " ".join( - n.get("text", "") for p in paragraphs for n in p.get("content", []) - ) - assert "[^1]:" not in body_text - - def test_anchor_injected_mid_sentence(self): - post = make_post() - post.from_markdown("Before[^1] and after.\n\n[^1]: Note.") - para = find_nodes(post.draft_body, "paragraph")[0] - types = [c["type"] for c in para["content"]] - assert types == ["text", "footnoteAnchor", "text"] - assert para["content"][0]["text"] == "Before" - assert para["content"][2]["text"] == " and after." - - def test_named_labels_numbered_by_first_appearance(self): - post = make_post() - md = ( - "First[^book] then second[^study].\n\n" - "[^study]: Second definition.\n" - "[^book]: First definition.\n" - ) - post.from_markdown(md) - nums = [a["attrs"]["number"] for a in anchors(post)] - assert nums == [1, 2] # order of reference, not of definition - blocks = sorted(footnotes(post), key=lambda b: b["attrs"]["number"]) - assert blocks[0]["content"][0]["content"][0]["text"] == "First definition." - assert blocks[1]["content"][0]["content"][0]["text"] == "Second definition." - - def test_repeated_reference_duplicates_footnote(self): - # Substack numbers anchors by position and pairs them 1:1 with footnote - # blocks, so a definition referenced twice yields two sequentially-numbered - # anchors and two footnote blocks with identical content. - post = make_post() - post.from_markdown("One[^a] two[^a].\n\n[^a]: Note.") - nums = [a["attrs"]["number"] for a in anchors(post)] - assert nums == [1, 2] - blocks = footnotes(post) - assert [b["attrs"]["number"] for b in blocks] == [1, 2] - assert blocks[0]["content"] == blocks[1]["content"] - assert blocks[0]["content"][0]["content"][0]["text"] == "Note." - - def test_link_inside_definition_preserved(self): - post = make_post() - post.from_markdown("Claim.[^1]\n\n[^1]: See [docs](https://example.com).") - block = footnotes(post)[0] - link_node = next(n for n in block["content"][0]["content"] if n.get("marks")) - assert link_node["marks"][0]["attrs"]["href"] == "https://example.com" - - def test_multiline_definition(self): - post = make_post() - md = "Claim.[^1]\n\n[^1]: First line\n continued on the next line." - post.from_markdown(md) - text = footnotes(post)[0]["content"][0]["content"][0]["text"] - assert text == "First line continued on the next line." - - def test_unreferenced_definition_is_dropped(self): - # CommonMark footnote semantics: a definition that is never referenced is - # not rendered, and must not leak into the body text. - post = make_post() - post.from_markdown("No references here.\n\n[^1]: Orphan note.") - assert len(anchors(post)) == 0 - assert len(footnotes(post)) == 0 - paragraphs = find_nodes(post.draft_body, "paragraph") - body_text = " ".join( - n.get("text", "") for para in paragraphs for n in para.get("content", []) - ) - assert "Orphan note" not in body_text - - def test_reference_without_definition_left_as_text(self): - post = make_post() - post.from_markdown("A dangling[^missing] reference.") - assert len(anchors(post)) == 0 - assert len(footnotes(post)) == 0 - para = find_nodes(post.draft_body, "paragraph")[0] - assert "[^missing]" in para["content"][0]["text"] - - def test_definition_in_middle_moves_to_end(self): - post = make_post() - md = "First paragraph.[^1]\n\n[^1]: First footnote.\n\nSecond paragraph." - post.from_markdown(md) - - types = [node["type"] for node in body_content(post)] - # Both paragraphs come first; the footnote block is last regardless of - # where the definition appeared in the source. - assert types == ["paragraph", "paragraph", "footnote"] - - paragraphs = find_nodes(post.draft_body, "paragraph") - assert paragraphs[0]["content"][0]["text"] == "First paragraph." - # The definition line did not become a paragraph in the body. - assert paragraphs[1]["content"][0]["text"] == "Second paragraph." - - assert len(anchors(post)) == 1 - block = footnotes(post)[0] - assert block["content"][0]["content"][0]["text"] == "First footnote." - - def test_footnote_definition_inside_fenced_code_stays_code(self): - post = make_post() - post.from_markdown("```\n[^1]: not a footnote\n```") - content = body_content(post) - assert len(content) == 1 - assert content[0]["type"] == "codeBlock" - assert content[0]["content"][0]["text"] == "[^1]: not a footnote" - - def test_footnote_reference_inside_fenced_code_stays_text(self): - post = make_post() - post.from_markdown("```\ncode [^1]\n```\n\n[^1]: note") - content = body_content(post) - assert content[0]["type"] == "codeBlock" - assert content[0]["content"][0]["text"] == "code [^1]" - - def test_footnote_reference_inside_inline_code_stays_text(self): - post = make_post() - post.from_markdown("`code [^1]`\n\n[^1]: note") - content = body_content(post) - assert content[0]["type"] == "paragraph" - assert content[0]["content"][0]["text"] == "code [^1]" - assert content[0]["content"][0]["marks"] == [{"type": "code"}] - - def test_multiparagraph_definition(self): - post = make_post() - md = "Claim.[^1]\n\n[^1]: First para.\n\n Second para." - post.from_markdown(md) - # The second paragraph must stay in the footnote, not leak into the body. - assert [n["type"] for n in body_content(post)] == ["paragraph", "footnote"] - block = footnotes(post)[0] - assert len(block["content"]) == 2 - assert block["content"][0]["content"][0]["text"] == "First para." - assert block["content"][1]["content"][0]["text"] == "Second para." - - def test_multiparagraph_definition_in_middle(self): - post = make_post() - md = ( - "First.[^1]\n\n" - "[^1]: Note para one.\n\n" - " Note para two.\n\n" - "Back to the body." - ) - post.from_markdown(md) - types = [n["type"] for n in body_content(post)] - assert types == ["paragraph", "paragraph", "footnote"] - assert body_content(post)[1]["content"][0]["text"] == "Back to the body." - assert len(footnotes(post)[0]["content"]) == 2 - - def test_footnote_helper_splits_paragraphs(self): - post = make_post() - post.footnote(1, "Para one.\n\nPara two.") - block = footnotes(post)[0] - assert len(block["content"]) == 2 - assert block["content"][1]["content"][0]["text"] == "Para two." - - def test_definition_with_block_content_is_preserved(self): - # A footnote whose definition is a list (or other block content) must keep - # its text rather than dropping it. - post = make_post() - post.from_markdown("Claim[^1]\n\n[^1]: - item one\n - item two") - note = footnotes(post)[0] - text = " ".join( - n.get("text", "") - for para in find_nodes(note, "paragraph") - for n in para.get("content", []) - ) - assert "item one" in text - assert "item two" in text - # rendered as a real nested list inside the footnote - assert find_nodes(note, "bullet_list") - - def test_no_footnotes_is_unchanged(self): - post = make_post() - post.from_markdown("Just a plain paragraph.") - assert len(anchors(post)) == 0 - assert len(footnotes(post)) == 0 - assert find_nodes(post.draft_body, "paragraph")[0]["content"][0]["text"] == ( - "Just a plain paragraph." - ) diff --git a/tests/substack/test_from_markdown_features.py b/tests/substack/test_from_markdown_features.py deleted file mode 100644 index 1ebd93c..0000000 --- a/tests/substack/test_from_markdown_features.py +++ /dev/null @@ -1,325 +0,0 @@ -"""End-to-end coverage of every feature listed in Post.from_markdown(). - -These exercise the renderer through from_markdown() (as opposed to the -parse_inline() unit tests), so they cover the actual Markdown -> Substack path. -""" - -from substack.post import Post - - -def make_post(): - return Post(title="T", subtitle="S", user_id=1) - - -def body(post): - return post.draft_body["content"] - - -def first_para_nodes(post): - return body(post)[0]["content"] - - -def marked(nodes, text): - """Return the marks on the text node with the given text.""" - node = next(n for n in nodes if n.get("text") == text) - return node.get("marks", []) - - -class TestInlineFormatting: - def test_bold(self): - post = make_post() - post.from_markdown("x **b** y") - assert {"type": "strong"} in marked(first_para_nodes(post), "b") - - def test_italic(self): - post = make_post() - post.from_markdown("x *i* y") - assert {"type": "em"} in marked(first_para_nodes(post), "i") - - def test_bold_italic(self): - post = make_post() - post.from_markdown("***bi***") - marks = marked(first_para_nodes(post), "bi") - assert {"type": "strong"} in marks - assert {"type": "em"} in marks - - def test_inline_code(self): - post = make_post() - post.from_markdown("use `code` now") - assert marked(first_para_nodes(post), "code") == [{"type": "code"}] - - def test_strikethrough(self): - post = make_post() - post.from_markdown("a ~~s~~ b") - assert marked(first_para_nodes(post), "s") == [{"type": "strikethrough"}] - - def test_link(self): - post = make_post() - post.from_markdown("[t](https://e.com)") - assert marked(first_para_nodes(post), "t") == [ - {"type": "link", "attrs": {"href": "https://e.com"}} - ] - - def test_text_color(self): - post = make_post() - post.from_markdown('x [c]{style="color:#ff00ff"} y') - assert marked(first_para_nodes(post), "c") == [ - {"type": "textStyle", "attrs": {"color": "#ff00ff"}} - ] - - def test_highlight(self): - post = make_post() - post.from_markdown('x [h]{style="background-color:#ffff00"} y') - assert marked(first_para_nodes(post), "h") == [ - {"type": "highlight", "attrs": {"color": "#ffff00"}} - ] - - def test_text_color_and_highlight_combined(self): - post = make_post() - post.from_markdown('x [both]{style="color:#fff; background-color:#000"} y') - marks = marked(first_para_nodes(post), "both") - assert {"type": "textStyle", "attrs": {"color": "#fff"}} in marks - assert {"type": "highlight", "attrs": {"color": "#000"}} in marks - - def test_unrecognized_style_declaration_is_ignored(self): - post = make_post() - post.from_markdown('x [p]{style="font-weight:bold"} y') - # No recognized color/background-color, so the span adds no marks and - # merges back into plain surrounding text. - assert first_para_nodes(post) == [{"type": "text", "text": "x p y"}] - - def test_multiple_marks_in_one_paragraph(self): - post = make_post() - post.from_markdown("**b** and *i* and `c` and [l](https://e.com)") - nodes = first_para_nodes(post) - assert {"type": "strong"} in marked(nodes, "b") - assert {"type": "em"} in marked(nodes, "i") - assert marked(nodes, "c") == [{"type": "code"}] - assert marked(nodes, "l")[0]["type"] == "link" - - -class TestBlocks: - def test_all_heading_levels(self): - for level in range(1, 7): - post = make_post() - post.from_markdown("#" * level + " Heading") - block = body(post)[0] - assert block["type"] == "heading" - assert block["attrs"]["level"] == level - - def test_paragraph(self): - post = make_post() - post.from_markdown("Just a plain paragraph.") - block = body(post)[0] - assert block["type"] == "paragraph" - assert block["content"][0]["text"] == "Just a plain paragraph." - - def test_bullet_list(self): - post = make_post() - post.from_markdown("- a\n- b") - block = body(post)[0] - assert block["type"] == "bullet_list" - assert len(block["content"]) == 2 - assert block["content"][0]["type"] == "list_item" - - def test_ordered_list(self): - post = make_post() - post.from_markdown("1. a\n2. b") - block = body(post)[0] - assert block["type"] == "ordered_list" - assert len(block["content"]) == 2 - - def test_code_block_with_language(self): - post = make_post() - post.from_markdown("```python\nprint('hi')\n```") - block = body(post)[0] - assert block["type"] == "codeBlock" - assert block["attrs"]["language"] == "python" - assert block["content"][0]["text"] == "print('hi')" - - def test_code_block_without_language(self): - post = make_post() - post.from_markdown("```\nplain\n```") - block = body(post)[0] - assert block["type"] == "codeBlock" - assert "attrs" not in block or "language" not in block.get("attrs", {}) - - def test_horizontal_rule(self): - post = make_post() - post.from_markdown("a\n\n---\n\nb") - assert [n["type"] for n in body(post)] == [ - "paragraph", - "horizontal_rule", - "paragraph", - ] - - def test_blockquote(self): - post = make_post() - post.from_markdown("> quote") - block = body(post)[0] - assert block["type"] == "blockquote" - assert block["content"][0]["type"] == "paragraph" - - def test_image(self): - post = make_post() - post.from_markdown("![alt](https://example.com/img.png)") - block = body(post)[0] - assert block["type"] == "captionedImage" - assert len(block["content"]) == 1 - assert block["content"][0]["type"] == "image2" - attrs = block["content"][0]["attrs"] - assert attrs["src"] == "https://example.com/img.png" - assert attrs["alt"] == "alt" - assert attrs["href"] is None - assert attrs["imageSize"] == "normal" - assert attrs["srcNoWatermark"] is None - assert attrs["topImage"] is False - assert attrs["isProcessing"] is False - assert attrs["align"] is None - assert attrs["offset"] is False - - def test_image_with_caption(self): - post = make_post() - post.from_markdown('![alt](https://example.com/img.png "My caption")') - block = body(post)[0] - assert block["type"] == "captionedImage" - assert len(block["content"]) == 2 - assert block["content"][0]["type"] == "image2" - assert block["content"][0]["attrs"]["alt"] == "alt" - caption = block["content"][1] - assert caption["type"] == "caption" - assert caption["content"] == [{"type": "text", "text": "My caption"}] - - def test_image_without_caption_has_no_caption_node(self): - post = make_post() - post.from_markdown("![alt](https://example.com/img.png)") - block = body(post)[0] - types = [n["type"] for n in block["content"]] - assert "caption" not in types - - def test_linked_image(self): - post = make_post() - post.from_markdown("[![alt](https://i/x.png)](https://link)") - block = body(post)[0] - assert block["type"] == "captionedImage" - assert block["content"][0]["type"] == "image2" - attrs = block["content"][0]["attrs"] - assert attrs["src"] == "https://i/x.png" - assert attrs["href"] == "https://link" - - def test_latex_block(self): - post = make_post() - post.from_markdown("$$\nE=mc^2\n$$\n") - block = body(post)[0] - assert block["type"] == "latex_block" - assert block["attrs"]["persistentExpression"] == "E=mc^2" - assert block["attrs"]["dirty"] is True - - def test_labeled_latex_block_is_preserved(self): - post = make_post() - post.from_markdown("$$\nE=mc^2\n$$ (mass-energy)\n\nAfter the equation.") - blocks = body(post) - assert [block["type"] for block in blocks] == ["latex_block", "paragraph"] - assert blocks[0]["attrs"]["persistentExpression"] == "E=mc^2" - - def test_latex_inline(self): - post = make_post() - post.from_markdown("A paragraph with $E=mc^2$ inline.") - para = body(post)[0] - assert para["type"] == "paragraph" - latex = [n for n in para["content"] if n["type"] == "latex"] - assert len(latex) == 1 - assert latex[0]["attrs"]["expression"] == "E=mc^2" - assert latex[0]["attrs"]["persistentExpression"] == "E=mc^2" - - def test_currency_dollar_signs_are_not_parsed_as_latex(self): - post = make_post() - markdown = "Revenue grew from $5 million to $10 million this year." - post.from_markdown(markdown) - paragraph = body(post)[0] - assert [node["type"] for node in paragraph["content"]] == ["text"] - assert paragraph["content"][0]["text"] == markdown - - def test_unclosed_inline_math_is_plain_text(self): - post = make_post() - post.from_markdown("An unclosed $expression remains text.") - paragraph = body(post)[0] - assert paragraph["content"] == [ - {"type": "text", "text": "An unclosed $expression remains text."} - ] - - def test_superscript(self): - post = make_post() - post.from_markdown("E=mc^2^ here.") - para = body(post)[0] - sup = [n for n in para["content"] if n.get("marks")] - assert sup[0]["text"] == "2" - assert sup[0]["marks"] == [{"type": "superscript"}] - - def test_subscript(self): - post = make_post() - post.from_markdown("H~2~O here.") - para = body(post)[0] - sub = [n for n in para["content"] if n.get("marks")] - assert sub[0]["text"] == "2" - assert sub[0]["marks"] == [{"type": "subscript"}] - - def test_subscript_does_not_clash_with_strikethrough(self): - post = make_post() - post.from_markdown("~~struck~~ and H~2~O") - para = body(post)[0] - marks = {m["type"] for n in para["content"] for m in n.get("marks", [])} - assert marks == {"strikethrough", "subscript"} - - def test_pullquote(self): - post = make_post() - post.from_markdown(":::pullquote\nA **bold** quote.\n:::\n") - block = body(post)[0] - assert block["type"] == "pullquote" - assert block["attrs"] == {"align": None, "color": None} - para = block["content"][0] - assert para["type"] == "paragraph" - assert para["content"][1]["text"] == "bold" - assert para["content"][1]["marks"] == [{"type": "strong"}] - - def test_callout(self): - post = make_post() - post.from_markdown( - ":::callout\nA callout with a [link](https://example.com).\n:::\n" - ) - block = body(post)[0] - assert block["type"] == "calloutBlock" - para = block["content"][0] - assert para["type"] == "paragraph" - link = [n for n in para["content"] if n.get("marks")][0] - assert link["marks"][0]["attrs"]["href"] == "https://example.com" - - def test_empty_containers_remain_valid_blocks(self): - pullquote = make_post() - pullquote.from_markdown(":::pullquote\n:::\n") - assert body(pullquote) == [ - { - "type": "pullquote", - "attrs": {"align": None, "color": None}, - "content": [{"type": "paragraph", "content": []}], - } - ] - - callout = make_post() - callout.from_markdown(":::callout\n:::\n") - assert body(callout) == [ - { - "type": "calloutBlock", - "content": [{"type": "paragraph", "content": []}], - } - ] - - def test_unknown_container_is_plain_text(self): - post = make_post() - post.from_markdown(":::unknown\ntext\n:::\n") - assert body(post) == [ - { - "type": "paragraph", - "content": [{"type": "text", "text": ":::unknown text :::"}], - } - ] diff --git a/tests/substack/test_image_sync_safety.py b/tests/substack/test_image_sync_safety.py deleted file mode 100644 index de322c1..0000000 --- a/tests/substack/test_image_sync_safety.py +++ /dev/null @@ -1,724 +0,0 @@ -import base64 -import json -import re -from unittest.mock import Mock - -import pytest - -from substack.api import Api -from substack.mdexport import document_to_markdown -from substack.mdrender import markdown_to_doc, parse_image_marker -from substack.nodes import captioned_image, paragraph, text -from substack.post import Post -from substack.revision import compute_draft_revision, format_revision_marker - - -def _with_rev(markdown: str, remote_doc: dict, draft_id: int = 42) -> str: - draft = {"id": draft_id, "draft_body": json.dumps(remote_doc)} - marker = format_revision_marker(compute_draft_revision(draft)) - return f"{marker}\n\n{markdown}" - - -def _make_v2_marker(src: str, attrs: dict) -> str: - payload = {"src": src, **attrs} - data = json.dumps( - payload, ensure_ascii=False, separators=(",", ":"), sort_keys=True - ).encode("utf-8") - encoded = base64.urlsafe_b64encode(data).decode("ascii").rstrip("=") - return f"" - - -def _make_v1_marker(attrs: dict) -> str: - data = json.dumps( - attrs, ensure_ascii=False, separators=(",", ":"), sort_keys=True - ).encode("utf-8") - encoded = base64.urlsafe_b64encode(data).decode("ascii").rstrip("=") - return f"" - - -def test_document_to_markdown_exports_v2_image_marker(): - img = captioned_image( - "https://example.com/photo.png", - alt="Photo alt", - caption=[text("Photo caption")], - ) - # Customize some attributes - img["content"][0]["attrs"]["imageSize"] = "wide" - img["content"][0]["attrs"]["align"] = "center" - img["content"][0]["attrs"]["fullscreen"] = True - - document = {"type": "doc", "content": [img]} - markdown, unsupported = document_to_markdown(document) - - assert unsupported == [] - assert "python-substack-image:v2" in markdown - assert "python-substack-image:v1" not in markdown - - # Extract marker payload - match = re.search(r"", markdown) - assert match is not None - encoded = match.group(1) - encoded += "=" * (-len(encoded) % 4) - payload = json.loads( - base64.urlsafe_b64decode(encoded.encode("ascii")).decode("utf-8") - ) - - assert payload["src"] == "https://example.com/photo.png" - assert payload["imageSize"] == "wide" - assert payload["align"] == "center" - assert payload["fullscreen"] is True - assert "alt" not in payload - assert "href" not in payload - assert "isProcessing" not in payload - - -def test_document_to_markdown_preserves_unknown_attributes_in_v2(): - img = captioned_image("https://example.com/photo.png") - img["content"][0]["attrs"]["customEditorAttr"] = {"nested": [1, 2, 3]} - img["content"][0]["attrs"]["watermarkVersion"] = 42 - - document = {"type": "doc", "content": [img]} - markdown, unsupported = document_to_markdown(document) - - assert unsupported == [] - match = re.search(r"", markdown) - assert match is not None - encoded = match.group(1) - encoded += "=" * (-len(encoded) % 4) - payload = json.loads( - base64.urlsafe_b64decode(encoded.encode("ascii")).decode("utf-8") - ) - - assert payload["customEditorAttr"] == {"nested": [1, 2, 3]} - assert payload["watermarkVersion"] == 42 - - -def test_v2_changed_source_update(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img = captioned_image("https://substackcdn.com/original.png")["content"][0][ - "attrs" - ] - remote_img["imageSize"] = "wide" - remote_img["align"] = "center" - remote_img["fullscreen"] = True - remote_img["height"] = 600 - remote_img["width"] = 1200 - remote_img["srcNoWatermark"] = "https://substackcdn.com/nowatermark.png" - remote_img["unknownAttr"] = "preserved" - - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - - mock_get_draft = Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}) - monkeypatch.setattr(api, "get_draft", mock_get_draft) - - put_calls = [] - - def mock_put_draft(draft_id, **kwargs): - put_calls.append((draft_id, kwargs)) - return {"id": draft_id} - - monkeypatch.setattr(api, "put_draft", mock_put_draft) - - # User changes image in markdown to a new URL, new alt, new caption - marker = _make_v2_marker( - "https://substackcdn.com/original.png", - { - "imageSize": "wide", - "align": "center", - "fullscreen": True, - "height": 600, - "width": 1200, - "srcNoWatermark": "https://substackcdn.com/nowatermark.png", - "unknownAttr": "preserved", - }, - ) - submitted_md = _with_rev( - f'![New Alt](https://substackcdn.com/replacement.png "New Caption")\n{marker}\n', - remote_doc, - ) - - res = api.update_draft_from_markdown( - 42, submitted_md, allow_image_replacement=False - ) - assert res["action"] == "update" - assert len(put_calls) == 1 - - saved_body = json.loads(put_calls[0][1]["draft_body"]) - saved_img = saved_body["content"][0]["content"][0]["attrs"] - - # Markdown authoritative for src and alt - assert saved_img["src"] == "https://substackcdn.com/replacement.png" - assert saved_img["alt"] == "New Alt" - # Preserved editor attributes - assert saved_img["imageSize"] == "wide" - assert saved_img["align"] == "center" - assert saved_img["fullscreen"] is True - assert saved_img["height"] == 600 - assert saved_img["width"] == 1200 - assert saved_img["srcNoWatermark"] == "https://substackcdn.com/nowatermark.png" - assert saved_img["unknownAttr"] == "preserved" - assert saved_img["isProcessing"] is False - - -def test_v1_resolvable_update(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img = captioned_image("https://example.com/unique.png")["content"][0][ - "attrs" - ] - remote_img["imageSize"] = "wide" - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - put_calls = [] - monkeypatch.setattr( - api, - "put_draft", - lambda d_id, **kw: put_calls.append((d_id, kw)) or {"id": d_id}, - ) - - # V1 marker with identical src - v1_marker = _make_v1_marker({"imageSize": "wide"}) - submitted_md = _with_rev( - f"![Alt](https://example.com/unique.png)\n{v1_marker}\n", remote_doc - ) - - res = api.update_draft_from_markdown( - 42, submitted_md, allow_image_replacement=False - ) - assert res["action"] == "update" - assert len(put_calls) == 1 - saved_body = json.loads(put_calls[0][1]["draft_body"]) - saved_img = saved_body["content"][0]["content"][0]["attrs"] - assert saved_img["src"] == "https://example.com/unique.png" - assert saved_img["imageSize"] == "wide" - - -def test_v1_ambiguous_update_rejected(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - # 2 remote images with identical URLs - remote_img1 = captioned_image("https://example.com/dup.png")["content"][0]["attrs"] - remote_img2 = captioned_image("https://example.com/dup.png")["content"][0]["attrs"] - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img1}], - }, - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img2}], - }, - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - monkeypatch.setattr(api, "put_draft", Mock()) - - # V1 marker submitted - v1_marker = _make_v1_marker({"imageSize": "wide"}) - submitted_md = _with_rev( - f"![Alt](https://example.com/dup.png)\n{v1_marker}\n", remote_doc - ) - - with pytest.raises(ValueError, match="cannot be matched uniquely"): - api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=False) - - # Succeeds with allow_image_replacement=True - res = api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=True) - assert res["action"] == "update" - - -def test_v1_changed_source_rejected(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img = captioned_image("https://example.com/original.png")["content"][0][ - "attrs" - ] - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - monkeypatch.setattr(api, "put_draft", Mock()) - - # V1 marker with changed source in markdown - v1_marker = _make_v1_marker({"imageSize": "wide"}) - submitted_md = _with_rev( - f"![Alt](https://example.com/changed.png)\n{v1_marker}\n", remote_doc - ) - - with pytest.raises( - ValueError, match="cannot be matched uniquely|cannot authorize changed source" - ): - api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=False) - - res = api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=True) - assert res["action"] == "update" - - -def test_duplicate_remote_urls_with_v2(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img1 = captioned_image("https://example.com/dup.png")["content"][0]["attrs"] - remote_img1["imageSize"] = "wide" - remote_img1["align"] = "center" - - remote_img2 = captioned_image("https://example.com/dup.png")["content"][0]["attrs"] - remote_img2["imageSize"] = "normal" - remote_img2["align"] = "left" - - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img1}], - }, - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img2}], - }, - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - - put_calls = [] - monkeypatch.setattr( - api, - "put_draft", - lambda d_id, **kw: put_calls.append((d_id, kw)) or {"id": d_id}, - ) - - # Two V2 markers each bound to https://example.com/dup.png - m1 = _make_v2_marker( - "https://example.com/dup.png", {"imageSize": "wide", "align": "center"} - ) - m2 = _make_v2_marker( - "https://example.com/dup.png", {"imageSize": "normal", "align": "left"} - ) - - submitted_md = _with_rev( - f"![First](https://example.com/dup.png)\n{m1}\n\n![Second](https://example.com/dup.png)\n{m2}\n", - remote_doc, - ) - - res = api.update_draft_from_markdown( - 42, submitted_md, allow_image_replacement=False - ) - assert res["action"] == "update" - - saved_body = json.loads(put_calls[0][1]["draft_body"]) - saved_img1 = saved_body["content"][0]["content"][0]["attrs"] - saved_img2 = saved_body["content"][1]["content"][0]["attrs"] - - assert saved_img1["imageSize"] == "wide" - assert saved_img1["align"] == "center" - assert saved_img2["imageSize"] == "normal" - assert saved_img2["align"] == "left" - - -def test_v2_marker_reuse_rejected(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img = captioned_image("https://example.com/single.png")["content"][0][ - "attrs" - ] - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - monkeypatch.setattr(api, "put_draft", Mock()) - - # Two images in markdown reusing the marker bound to the single remote image - m = _make_v2_marker("https://example.com/single.png", {"imageSize": "wide"}) - submitted_md = _with_rev( - f"![First](https://example.com/single.png)\n{m}\n\n![Second](https://example.com/other.png)\n{m}\n", - remote_doc, - ) - - with pytest.raises(ValueError, match="reused or duplicate image marker"): - api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=False) - - -def test_v2_stale_marker_rejected(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img = captioned_image("https://example.com/actual.png")["content"][0][ - "attrs" - ] - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - monkeypatch.setattr(api, "put_draft", Mock()) - - # Marker bound to a non-existent remote source - m = _make_v2_marker("https://example.com/stale.png", {"imageSize": "wide"}) - submitted_md = _with_rev( - f"![Photo](https://example.com/actual.png)\n{m}\n", remote_doc - ) - - with pytest.raises(ValueError, match="stale image marker"): - api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=False) - - -def test_corrupt_image_markers(): - # Corrupt base64 - with pytest.raises(ValueError, match="Corrupt image marker format"): - markdown_to_doc("![Photo](url.png)\n\n") - - # Missing src in v2 - payload = json.dumps({"imageSize": "wide"}).encode("utf-8") - enc = base64.urlsafe_b64encode(payload).decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="Invalid image marker attributes"): - markdown_to_doc(f"![Photo](url.png)\n\n") - - # Forbidden keys in v2 (alt, href, isProcessing) - payload = json.dumps({"src": "url.png", "alt": "bad"}).encode("utf-8") - enc = base64.urlsafe_b64encode(payload).decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="Invalid image marker attributes"): - markdown_to_doc(f"![Photo](url.png)\n\n") - - # Forbidden keys in v1 (src in v1) - payload = json.dumps({"src": "url.png"}).encode("utf-8") - enc = base64.urlsafe_b64encode(payload).decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="Invalid image marker attributes"): - markdown_to_doc(f"![Photo](url.png)\n\n") - - -def test_non_adjacent_image_markers(): - m = _make_v2_marker("https://example.com/img.png", {"imageSize": "wide"}) - - # Marker before image / at document start - with pytest.raises( - ValueError, match="Image marker must immediately follow an image" - ): - markdown_to_doc(f"{m}\n\n![Photo](https://example.com/img.png)\n") - - # Marker after paragraph - with pytest.raises( - ValueError, match="Image marker must immediately follow an image" - ): - markdown_to_doc(f"Some text paragraph.\n\n{m}\n") - - # Marker after heading - with pytest.raises( - ValueError, match="Image marker must immediately follow an image" - ): - markdown_to_doc(f"# Heading\n\n{m}\n") - - # Two markers after one image - with pytest.raises( - ValueError, match="Image marker must immediately follow an image" - ): - markdown_to_doc(f"![Photo](https://example.com/img.png)\n{m}\n{m}\n") - - # Marker inlined inside text - with pytest.raises( - ValueError, match="Image marker must immediately follow an image" - ): - markdown_to_doc(f"Some text with {m} inline.\n") - - -def test_new_image_without_marker(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_img = captioned_image("https://example.com/existing.png")["content"][0][ - "attrs" - ] - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - monkeypatch.setattr(api, "put_draft", Mock(return_value={"id": 42})) - - # Markdown has existing image with v2 marker + a brand new image without marker - m = _make_v2_marker("https://example.com/existing.png", {"imageSize": "wide"}) - submitted_md = _with_rev( - f"![Existing](https://example.com/existing.png)\n{m}\n\n" - f"![Brand New](https://example.com/brand_new.png)\n", - remote_doc, - ) - - with pytest.raises(ValueError, match="cannot be matched uniquely"): - api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=False) - - # Allowed with allow_image_replacement=True - res = api.update_draft_from_markdown(42, submitted_md, allow_image_replacement=True) - assert res["action"] == "update" - - -def test_adversarial_unicode_bidi_and_special_characters(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - complex_url = "https://substackcdn.com/test%20image%F0%9F%9A%80.png?v=1&foo=bar#baz" - bidi_alt = 'Bidi test \u202e\u0627\u0644\u0639\u0631\u0628\u064a\u0629\u202c [brackets] "quotes"' - complex_attrs = { - "align": "center", - "custom_emoji": "πŸš€πŸ”₯✨", - "nested": {"array": [1, None, False, {"deep": "utf-8 \u00e9\u00e8\u00e0"}]}, - } - - remote_img = captioned_image(complex_url)["content"][0]["attrs"] - remote_img.update(complex_attrs) - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": remote_img}], - } - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - put_calls = [] - monkeypatch.setattr( - api, - "put_draft", - lambda d_id, **kw: put_calls.append((d_id, kw)) or {"id": d_id}, - ) - - # Export document to markdown - md, unsupported = document_to_markdown(remote_doc) - assert unsupported == [] - assert "python-substack-image:v2" in md - - # Round-trip update - res = api.update_draft_from_markdown( - 42, _with_rev(md, remote_doc), allow_image_replacement=False - ) - assert res["action"] == "update" - saved = json.loads(put_calls[0][1]["draft_body"]) - saved_img = saved["content"][0]["content"][0]["attrs"] - assert saved_img["custom_emoji"] == "πŸš€πŸ”₯✨" - assert saved_img["nested"]["array"][3]["deep"] == "utf-8 \u00e9\u00e8\u00e0" - - -def test_adversarial_mixed_v1_and_v2_with_interleaved_blocks(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - img1_attrs = captioned_image("https://example.com/one.png")["content"][0]["attrs"] - img1_attrs["imageSize"] = "wide" - img2_attrs = captioned_image("https://example.com/two.png")["content"][0]["attrs"] - img2_attrs["align"] = "center" - - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": img1_attrs}], - }, - { - "type": "captionedImage", - "content": [{"type": "image2", "attrs": img2_attrs}], - }, - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - put_calls = [] - monkeypatch.setattr( - api, - "put_draft", - lambda d_id, **kw: put_calls.append((d_id, kw)) or {"id": d_id}, - ) - - # Image 1 uses V1 marker, Image 2 uses V2 marker with changed source, separated by code block and callout - v1_m = _make_v1_marker({"imageSize": "wide"}) - v2_m = _make_v2_marker("https://example.com/two.png", {"align": "center"}) - - submitted_md = f"""# Title - -![Image 1](https://example.com/one.png) -{v1_m} - -```python -print("interleaved code block") -``` - -::: callout -Interleaved callout -::: - -![Image 2 replaced](https://example.com/two-replacement.png) -{v2_m} -""" - - res = api.update_draft_from_markdown( - 42, _with_rev(submitted_md, remote_doc), allow_image_replacement=False - ) - assert res["action"] == "update" - saved = json.loads(put_calls[0][1]["draft_body"]) - images = [ - node["content"][0]["attrs"] - for node in saved["content"] - if node["type"] == "captionedImage" - ] - assert len(images) == 2 - assert images[0]["src"] == "https://example.com/one.png" - assert images[0]["imageSize"] == "wide" - assert images[1]["src"] == "https://example.com/two-replacement.png" - assert images[1]["align"] == "center" - - -def test_adversarial_3_duplicates_and_4th_reused_rejected(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - remote_doc = { - "type": "doc", - "content": [ - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": {"src": "https://example.com/same.png", "idx": 1}, - } - ], - }, - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": {"src": "https://example.com/same.png", "idx": 2}, - } - ], - }, - { - "type": "captionedImage", - "content": [ - { - "type": "image2", - "attrs": {"src": "https://example.com/same.png", "idx": 3}, - } - ], - }, - ], - } - monkeypatch.setattr( - api, - "get_draft", - Mock(return_value={"id": 42, "draft_body": json.dumps(remote_doc)}), - ) - monkeypatch.setattr(api, "put_draft", Mock()) - - m = _make_v2_marker("https://example.com/same.png", {"imageSize": "normal"}) - # 4 images claiming the 3 remote images - submitted_md = f""" -![1](https://example.com/same.png) -{m} - -![2](https://example.com/same.png) -{m} - -![3](https://example.com/same.png) -{m} - -![4](https://example.com/same.png) -{m} -""" - with pytest.raises(ValueError, match="reused or duplicate image marker"): - api.update_draft_from_markdown( - 42, _with_rev(submitted_md, remote_doc), allow_image_replacement=False - ) diff --git a/tests/substack/test_local_markdown_images.py b/tests/substack/test_local_markdown_images.py deleted file mode 100644 index 1fb7859..0000000 --- a/tests/substack/test_local_markdown_images.py +++ /dev/null @@ -1,126 +0,0 @@ -"""Offline regression tests for Markdown local-image uploads.""" - -import os -from unittest.mock import Mock - -import pytest - -from substack.api import Api -from substack.post import Post - -UPLOADED = "https://substack-post-media.s3.amazonaws.com/test-image.gif" - - -@pytest.fixture -def api(): - client = Api.__new__(Api) - client.get_image = Mock(return_value={"url": UPLOADED}) - return client - - -def render(src, api=None): - post = Post(title="Image test", subtitle="", user_id=1) - post.from_markdown(f'![alt](<{src}> "caption")', api=api) - return post.draft_body["content"][0]["content"][0]["attrs"]["src"] - - -@pytest.mark.parametrize("extension", ["png", "jpg", "gif", "webp"]) -def test_absolute_file_uploaded_unchanged(tmp_path, api, extension): - path = tmp_path / f"image.{extension}" - path.write_bytes(b"image bytes") - assert render(str(path), api) == UPLOADED - api.get_image.assert_called_once_with(str(path)) - - -def test_home_path_expanded(tmp_path, monkeypatch, api): - monkeypatch.setenv("HOME", str(tmp_path)) - monkeypatch.setenv("USERPROFILE", str(tmp_path)) - path = tmp_path / "image.png" - path.touch() - assert render("~/image.png", api) == UPLOADED - api.get_image.assert_called_once_with(str(path)) - - -def test_spaces_unicode_and_percent_in_filename(tmp_path, api): - path = tmp_path / "obraz ΕΌΓ³Ε‚ty 100%.png" - path.touch() - assert render(str(path), api) == UPLOADED - api.get_image.assert_called_once_with(str(path)) - - -@pytest.mark.parametrize("src", ["missing.png", "/missing/image.gif", "~/missing.webp"]) -def test_missing_file_fails_before_upload(tmp_path, monkeypatch, api, src): - monkeypatch.chdir(tmp_path) - monkeypatch.setenv("HOME", str(tmp_path)) - monkeypatch.setenv("USERPROFILE", str(tmp_path)) - with pytest.raises(FileNotFoundError, match="Local image file not found:") as error: - render(src, api) - assert src.rsplit("/", 1)[-1] in str(error.value) - api.get_image.assert_not_called() - - -def test_directory_is_not_an_image(tmp_path, api): - with pytest.raises(FileNotFoundError): - render(str(tmp_path), api) - api.get_image.assert_not_called() - - -@pytest.mark.parametrize("src", ["image.png", "/image.png"]) -def test_relative_and_legacy_root_relative_file(tmp_path, monkeypatch, api, src): - monkeypatch.chdir(tmp_path) - (tmp_path / "image.png").touch() - assert render(src, api) == UPLOADED - api.get_image.assert_called_once_with("image.png") - - -@pytest.mark.skipif( - os.name == "nt", - reason="Drive-qualified paths do not have a legacy root-relative fallback", -) -def test_absolute_file_takes_priority_over_relative(tmp_path, monkeypatch, api): - absolute = tmp_path / "image.png" - absolute.touch() - cwd = tmp_path / "cwd" - shadow = cwd / str(absolute)[1:] - shadow.parent.mkdir(parents=True) - shadow.touch() - monkeypatch.chdir(cwd) - assert render(str(absolute), api) == UPLOADED - api.get_image.assert_called_once_with(str(absolute)) - - -def test_upload_error_names_file(tmp_path, api): - path = tmp_path / "failed.gif" - path.touch() - api.get_image.side_effect = RuntimeError("upload refused") - with pytest.raises(ValueError, match="Failed to upload local image:") as error: - render(str(path), api) - assert str(path) in str(error.value) - assert error.value.__cause__ is api.get_image.side_effect - - -@pytest.mark.parametrize( - "result", [{}, {"url": None}, {"url": ""}, {"url": "local.png"}, None] -) -def test_invalid_upload_result_fails(tmp_path, api, result): - path = tmp_path / "failed.png" - path.touch() - api.get_image.return_value = result - with pytest.raises(ValueError, match="failed.png"): - render(str(path), api) - - -@pytest.mark.parametrize( - "src", - ["http://example.com/a.jpg", "https://example.com/a.png", "//example.com/a.gif"], -) -def test_remote_url_unchanged(api, src): - assert render(src, api) == src - api.get_image.assert_not_called() - - -@pytest.mark.parametrize( - "src", ["/missing/image.png", "~/missing.gif", "relative.webp"] -) -def test_without_api_retains_source(src): - assert render(src) == src diff --git a/tests/substack/test_markdown_draft_helper.py b/tests/substack/test_markdown_draft_helper.py deleted file mode 100644 index cec3a3e..0000000 --- a/tests/substack/test_markdown_draft_helper.py +++ /dev/null @@ -1,105 +0,0 @@ -import json -from unittest.mock import Mock - -from substack import Api -from substack.exceptions import SubstackAPIException - - -def make_api(): - api = object.__new__(Api) - api.get_user_id = Mock(return_value=1) - api.post_draft = Mock(return_value={"id": 123, "title": "Draft"}) - api.put_draft = Mock(return_value={"id": 123, "slug": "my-post"}) - api.add_tags_to_post = Mock(return_value={"tags_added": [{"id": 1}]}) - api.prepublish_draft = Mock(return_value={"ok": True}) - api.publish_draft = Mock(return_value={"published": True}) - return api - - -def test_create_draft_from_markdown_creates_draft_and_updates_metadata(): - api = make_api() - - result = api.create_draft_from_markdown( - title="Title", - subtitle="Subtitle", - markdown="# Heading\n\nBody", - slug="my-post", - search_engine_title="SEO title", - search_engine_description="SEO description", - tags="python", - prepublish=True, - publish=True, - send=False, - share_automatically=True, - ) - - api.post_draft.assert_called_once() - draft_payload = api.post_draft.call_args.args[0] - draft_body = json.loads(draft_payload["draft_body"]) - assert draft_body["content"][0]["type"] == "heading" - assert draft_body["content"][1]["type"] == "paragraph" - - api.put_draft.assert_called_once_with( - 123, - search_engine_title="SEO title", - search_engine_description="SEO description", - slug="my-post", - ) - api.add_tags_to_post.assert_called_once_with(123, ["python"]) - api.prepublish_draft.assert_called_once_with(123) - api.publish_draft.assert_called_once_with( - 123, - send=False, - share_automatically=True, - ) - assert result["draft"] == {"id": 123, "slug": "my-post"} - assert result["tags"] == {"tags_added": [{"id": 1}]} - - -def test_create_draft_from_markdown_skips_optional_calls_by_default(): - api = make_api() - - result = api.create_draft_from_markdown( - title="Title", - markdown="Body", - ) - - api.put_draft.assert_not_called() - api.add_tags_to_post.assert_not_called() - api.prepublish_draft.assert_not_called() - api.publish_draft.assert_not_called() - assert result == { - "draft": {"id": 123, "title": "Draft"}, - "tags": None, - "prepublish": None, - "publish": None, - } - - -def test_create_draft_from_markdown_leaves_created_draft_when_tagging_fails(): - api = make_api() - api.add_tags_to_post.side_effect = SubstackAPIException( - 400, '{"error":"Tagging failed"}' - ) - - try: - api.create_draft_from_markdown( - title="Title", - markdown="Body", - tags=["python"], - ) - except SubstackAPIException: - pass - else: - raise AssertionError("tagging failure was not propagated") - - api.post_draft.assert_called_once() - api.add_tags_to_post.assert_called_once_with(123, ["python"]) - api.prepublish_draft.assert_not_called() - api.publish_draft.assert_not_called() - - -def test_normalize_tags_accepts_none_string_and_iterable(): - assert Api._normalize_tags(None) == [] - assert Api._normalize_tags("python") == ["python"] - assert Api._normalize_tags(["python", 123]) == ["python", "123"] diff --git a/tests/substack/test_markdown_export.py b/tests/substack/test_markdown_export.py deleted file mode 100644 index 6bc88fd..0000000 --- a/tests/substack/test_markdown_export.py +++ /dev/null @@ -1,332 +0,0 @@ -import base64 -import json -import re -from pathlib import Path - -import pytest - -from substack.api import Api -from substack.mdexport import document_to_markdown -from substack.mdrender import markdown_to_doc -from substack.nodes import captioned_image -from substack.post import Post - - -def _text(value, marks=None): - node = {"type": "text", "text": value} - if marks: - node["marks"] = marks - return node - - -def _paragraph(value): - return {"type": "paragraph", "content": [_text(value)]} - - -def _paragraph_with(*inline_nodes): - return {"type": "paragraph", "content": list(inline_nodes)} - - -def test_document_to_markdown_golden_covers_supported_nodes(): - image = captioned_image( - "https://example.com/image.png", - alt="Alt text", - href="https://example.com/target", - caption=[_text("Caption")], - ) - document = { - "type": "doc", - "content": [ - { - "type": "heading", - "attrs": {"level": 2}, - "content": [_text("Heading", [{"type": "strong"}])], - }, - { - "type": "paragraph", - "content": [ - _text("Bold", [{"type": "strong"}]), - _text(" and "), - _text("italic", [{"type": "em"}]), - _text(" and "), - _text("code", [{"type": "code"}]), - _text(" and "), - _text("strike", [{"type": "strikethrough"}]), - _text(" and "), - _text("sup", [{"type": "superscript"}]), - _text(" and "), - _text("sub", [{"type": "subscript"}]), - _text(" and "), - _text( - "link", - [ - { - "type": "link", - "attrs": {"href": "https://example.com"}, - } - ], - ), - _text(" "), - { - "type": "latex", - "attrs": { - "expression": "E=mc^2", - "persistentExpression": "E=mc^2", - }, - }, - {"type": "footnoteAnchor", "attrs": {"number": 1}}, - ], - }, - { - "type": "bullet_list", - "content": [ - { - "type": "list_item", - "content": [ - _paragraph("Bullet"), - { - "type": "ordered_list", - "content": [ - { - "type": "list_item", - "content": [_paragraph("Nested")], - } - ], - }, - ], - } - ], - }, - { - "type": "blockquote", - "content": [_paragraph("First"), _paragraph("Second")], - }, - { - "type": "codeBlock", - "attrs": {"language": "python"}, - "content": [_text("print('ok')")], - }, - {"type": "horizontal_rule"}, - { - "type": "latex_block", - "attrs": {"persistentExpression": "x^2", "dirty": True}, - }, - { - "type": "pullquote", - "attrs": {"align": None, "color": None}, - "content": [_paragraph("Pull")], - }, - {"type": "calloutBlock", "content": [_paragraph("Callout")]}, - image, - { - "type": "footnote", - "attrs": {"number": 1}, - "content": [_paragraph("Footnote")], - }, - ], - } - - markdown, unsupported = document_to_markdown(document) - - assert unsupported == [] - assert "python-substack-image:v2" in markdown - markdown = re.sub( - r"\n", "", markdown - ) - assert markdown == ( - "## **Heading**\n\n" - "**Bold** and *italic* and `code` and ~~strike~~ and ^sup^ and ~sub~ " - "and [link](https://example.com) $E=mc^2$[^1]\n\n" - "- Bullet\n\n" - " 1. Nested\n\n" - "> First\n>\n> Second\n\n" - "```python\nprint('ok')\n```\n\n" - "---\n\n" - "$$\nx^2\n$$\n\n" - "::: pullquote\nPull\n:::\n\n" - "::: callout\nCallout\n:::\n\n" - '[![Alt text](https://example.com/image.png "Caption")]' - "(https://example.com/target)\n\n" - "[^1]: Footnote\n" - ) - round_trip = markdown_to_doc(markdown) - assert [node["type"] for node in round_trip] == [ - "heading", - "paragraph", - "bullet_list", - "blockquote", - "codeBlock", - "horizontal_rule", - "latex_block", - "pullquote", - "calloutBlock", - "captionedImage", - "footnote", - ] - - -def test_document_to_markdown_renders_text_color(): - document = { - "type": "doc", - "content": [ - _paragraph_with( - _text("c", [{"type": "textStyle", "attrs": {"color": "#ff00ff"}}]) - ) - ], - } - markdown, unsupported = document_to_markdown(document) - assert unsupported == [] - assert markdown == '[c]{style="color:#ff00ff"}\n' - - -def test_document_to_markdown_renders_highlight(): - document = { - "type": "doc", - "content": [ - _paragraph_with( - _text("h", [{"type": "highlight", "attrs": {"color": "#ffff00"}}]) - ) - ], - } - markdown, unsupported = document_to_markdown(document) - assert unsupported == [] - assert markdown == '[h]{style="background-color:#ffff00"}\n' - - -def test_document_to_markdown_renders_combined_color_and_highlight(): - document = { - "type": "doc", - "content": [ - _paragraph_with( - _text( - "both", - [ - {"type": "textStyle", "attrs": {"color": "#fff"}}, - {"type": "highlight", "attrs": {"color": "#000"}}, - ], - ) - ) - ], - } - markdown, unsupported = document_to_markdown(document) - assert unsupported == [] - assert markdown == '[both]{style="color:#fff; background-color:#000"}\n' - - -@pytest.mark.parametrize( - "mark", - [ - {"type": "textStyle", "attrs": {}}, - {"type": "highlight", "attrs": {"color": 1}}, - {"type": "textStyle", "attrs": {"color": "#fff", "extra": True}}, - ], -) -def test_document_to_markdown_treats_malformed_style_mark_as_opaque(mark): - document = { - "type": "doc", - "content": [_paragraph_with(_text("c", [mark]))], - } - markdown, unsupported = document_to_markdown(document) - assert len(unsupported) == 1 - assert markdown.startswith("") - decoded = base64.urlsafe_b64decode(encoded + "=" * (-len(encoded) % 4)) - assert json.loads(decoded.decode("utf-8")) == unknown - assert unsupported == [unknown] - - -def test_unknown_attribute_preserves_the_entire_node_as_opaque(): - node = {"type": "paragraph", "content": [_text("Visible")], "future": True} - - markdown, unsupported = document_to_markdown({"type": "doc", "content": [node]}) - - assert markdown.startswith("" - - parsed = parse_node_marker(comment) - assert parsed == node - - -def test_parse_node_marker_corrupt_format(): - with pytest.raises(ValueError, match="Corrupt marker format"): - parse_node_marker("") - - -def test_parse_node_marker_invalid_base64(): - # Attempted but bad character - with pytest.raises(ValueError, match="Corrupt marker format"): - parse_node_marker("") - - -def test_parse_node_marker_invalid_json(): - # Valid base64 but invalid JSON (not a complete object) - encoded = base64.urlsafe_b64encode(b"{not valid json").decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="Invalid JSON"): - parse_node_marker(f"") - - -def test_parse_node_marker_not_object(): - # Valid JSON but a list instead of a dict - encoded = base64.urlsafe_b64encode(b"[]").decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="not a top-level JSON object"): - parse_node_marker(f"") - - -def test_parse_node_marker_missing_type(): - # Valid object but missing type - encoded = base64.urlsafe_b64encode(b'{"attrs": {}}').decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="missing or empty 'type'"): - parse_node_marker(f"") - - -def test_parse_node_marker_empty_type(): - # Valid object but empty type - encoded = base64.urlsafe_b64encode(b'{"type": ""}').decode("ascii").rstrip("=") - with pytest.raises(ValueError, match="missing or empty 'type'"): - parse_node_marker(f"") - - -def test_parse_node_marker_ordinary_comment(): - assert parse_node_marker("") is None - - -def test_markdown_to_doc_preserves_block_and_inline_markers(): - # Build a button node - btn = { - "type": "button", - "attrs": {"text": "Click me", "url": "https://example.com"}, - } - btn_payload = json.dumps(btn, separators=(",", ":"), sort_keys=True).encode("utf-8") - btn_encoded = base64.urlsafe_b64encode(btn_payload).decode("ascii").rstrip("=") - btn_comment = f"" - - # Build an inline recipe node - recipe = {"type": "recipe", "attrs": {"id": 123}} - recipe_payload = json.dumps(recipe, separators=(",", ":"), sort_keys=True).encode( - "utf-8" - ) - recipe_encoded = ( - base64.urlsafe_b64encode(recipe_payload).decode("ascii").rstrip("=") - ) - recipe_comment = f"" - - markdown = f"""# Heading 1 - -Some text and inline {recipe_comment} recipe. - -{btn_comment} - - -""" - doc = markdown_to_doc(markdown) - - # doc should have heading, paragraph (with text, recipe inline node, text), and the button block node - assert len(doc) == 3 - assert doc[0]["type"] == "heading" - - p = doc[1] - assert p["type"] == "paragraph" - inline_content = p["content"] - assert len(inline_content) == 3 - assert inline_content[0]["text"] == "Some text and inline " - assert inline_content[1] == recipe - assert inline_content[2]["text"] == " recipe." - - assert doc[2] == btn - - -def test_update_draft_from_markdown_preservation(monkeypatch): - api = Api.__new__(Api) - api.publication_url = "https://test.substack.com" - monkeypatch.setattr(api, "get_user_id", lambda: 1) - - # Remote draft contains an unsupported "button" node - remote_btn = { - "type": "button", - "attrs": {"text": "Click", "url": "https://example.com"}, - } - remote_body = { - "type": "doc", - "content": [ - { - "type": "heading", - "attrs": {"level": 1}, - "content": [{"type": "text", "text": "Hello"}], - }, - remote_btn, - ], - } - mock_get_draft = Mock( - return_value={"id": 42, "draft_body": json.dumps(remote_body)} - ) - monkeypatch.setattr(api, "get_draft", mock_get_draft) - - mock_put_draft = Mock(return_value={"id": 42}) - monkeypatch.setattr(api, "put_draft", mock_put_draft) - - # 1. Update with correct marker matches and succeeds - from substack.revision import compute_draft_revision, format_revision_marker - - remote_draft_obj = {"id": 42, "draft_body": json.dumps(remote_body)} - rev_marker = format_revision_marker(compute_draft_revision(remote_draft_obj)) - - btn_payload = json.dumps(remote_btn, separators=(",", ":"), sort_keys=True).encode( - "utf-8" - ) - btn_encoded = base64.urlsafe_b64encode(btn_payload).decode("ascii").rstrip("=") - submitted_markdown = f"{rev_marker}\n\n# New Title\n\n\n" - - res = api.update_draft_from_markdown(42, submitted_markdown) - assert res["action"] == "update" - assert res["dry_run"] is False - assert mock_put_draft.called - - # 2. Update without marker fails when allow_unsupported_change is False - mock_put_draft.reset_mock() - with pytest.raises(ValueError, match="remote unsupported nodes are missing"): - api.update_draft_from_markdown( - 42, f"{rev_marker}\n\n# New Title without button" - ) - assert not mock_put_draft.called - - # 3. Update without marker succeeds when allow_unsupported_change is True - mock_put_draft.reset_mock() - res = api.update_draft_from_markdown( - 42, f"{rev_marker}\n\n# New Title without button", allow_unsupported_change=True - ) - assert res["action"] == "update" - assert mock_put_draft.called - - -def test_cli_update_requires_yes_for_allow_unsupported_change( - tmp_path, monkeypatch, capsys -): - # Mocking UpdateOperationsApi - class MockApi: - def update_draft_from_markdown(self, *args, **kwargs): - return {"action": "update"} - - monkeypatch.setattr(cli, "_api_from_env", lambda **kw: MockApi()) - - md_file = tmp_path / "test.md" - md_file.write_text("# Test", encoding="utf-8") - - # If passing --allow-unsupported-change without --yes, it must raise CLIUsageError - assert ( - cli.main(["drafts", "update", "42", str(md_file), "--allow-unsupported-change"]) - == 2 - ) - err = capsys.readouterr().err - assert "--yes is required when using --allow-unsupported-change" in err