Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .speakeasy/workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ targets:
target: python
source: Outpost API (Python)
output: ./sdks/outpost-python
# Override: Speakeasy generates readme = "README-PYPI.md" but does not emit that file.
# We use README.md as the single source of truth; patch pyproject after generation.
compileCommand: "python scripts/patch_pyproject_readme.py && poetry build"
publish:
pypi:
token: $pypi_token
Expand Down
2 changes: 1 addition & 1 deletion sdks/outpost-python/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ __pycache__/
.python-version
.DS_Store
pyrightconfig.json
# README-PYPI.md is committed as a temporary workaround for Speakeasy compile; overwritten by scripts/prepare_readme.py at publish.
README-PYPI.md
.DS_Store

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.gitignore contains a duplicate .DS_Store entry. Removing the duplicate reduces noise and makes the ignore list easier to maintain.

Suggested change
.DS_Store

Copilot uses AI. Check for mistakes.
**/.speakeasy/temp/
**/.speakeasy/logs/
Expand Down
5 changes: 0 additions & 5 deletions sdks/outpost-python/README-PYPI.md

This file was deleted.

2 changes: 1 addition & 1 deletion sdks/outpost-python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name = "outpost_sdk"
version = "0.5.0"
description = "Python Client SDK Generated by Speakeasy."
authors = [{ name = "Speakeasy" },]
readme = "README-PYPI.md"
readme = "README.md"
requires-python = ">=3.9.2"
dependencies = [
"httpcore >=1.0.9",
Expand Down
42 changes: 42 additions & 0 deletions sdks/outpost-python/scripts/patch_pyproject_readme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""
Override Speakeasy-generated pyproject.toml to use README.md as the package readme.

Speakeasy emits readme = "README-PYPI.md" but does not generate that file. We use
README.md as the single source of truth for the SDK; this script patches pyproject.toml
after generation so build/test work. At publish time, prepare_readme.py creates
README-PYPI.md and publish.sh builds with it.
"""
import sys

PYPROJECT = "pyproject.toml"
OLD = 'readme = "README-PYPI.md"'
NEW = 'readme = "README.md"'
Comment on lines +11 to +13

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script patches pyproject.toml using an exact string match (OLD = 'readme = "README-PYPI.md"'). If Speakeasy changes whitespace/quoting or uses the table form for readme, the patch will fail CI. Consider matching the readme key more flexibly (e.g., regex on the assignment) so the patch is resilient to generator formatting changes.

Copilot uses AI. Check for mistakes.


def main() -> int:
try:
with open(PYPROJECT, "r", encoding="utf-8") as f:
content = f.read()
except OSError as e:
print(f"Failed to read {PYPROJECT}: {e}", file=sys.stderr)
return 1

if OLD not in content:
if NEW in content:
return 0 # Already patched
print(f"Neither {OLD!r} nor {NEW!r} found in {PYPROJECT}", file=sys.stderr)
return 1

content = content.replace(OLD, NEW, 1)
try:
with open(PYPROJECT, "w", encoding="utf-8") as f:
f.write(content)
except OSError as e:
print(f"Failed to write {PYPROJECT}: {e}", file=sys.stderr)
return 1

return 0


if __name__ == "__main__":
sys.exit(main())
6 changes: 5 additions & 1 deletion sdks/outpost-python/scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#!/usr/bin/env bash
# README.md is the source of truth. For PyPI we need absolute links, so we
# generate README-PYPI.md and point pyproject at it only for this build.
export POETRY_PYPI_TOKEN_PYPI=${PYPI_TOKEN}

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export POETRY_PYPI_TOKEN_PYPI=${PYPI_TOKEN} is unquoted and does not guard against an unset token. If PYPI_TOKEN is empty/unset, the script will attempt to publish without credentials (and may be confusing to debug). Consider using a safer pattern that errors when the token is missing and preserves any special characters in the token value.

Suggested change
export POETRY_PYPI_TOKEN_PYPI=${PYPI_TOKEN}
: "${PYPI_TOKEN:?PYPI_TOKEN environment variable must be set}"
export POETRY_PYPI_TOKEN_PYPI="${PYPI_TOKEN}"

Copilot uses AI. Check for mistakes.

poetry run python scripts/prepare_readme.py

# Point pyproject at the link-rewritten readme for the publish build
sed -i.bak 's/readme = "README.md"/readme = "README-PYPI.md"/' pyproject.toml

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed replacement assumes the pyproject line is exactly readme = "README.md". If the generated/edited TOML uses different whitespace/quotes or already has README-PYPI.md, this command will silently do nothing and the publish build may use the wrong README. Consider making this replacement resilient (match the readme key regardless of current value/spacing) and fail fast if no change was applied.

Suggested change
sed -i.bak 's/readme = "README.md"/readme = "README-PYPI.md"/' pyproject.toml
sed -i.bak -E 's/^[[:space:]]*readme[[:space:]]*=[[:space:]]*".*"/readme = "README-PYPI.md"/' pyproject.toml
if cmp -s pyproject.toml pyproject.toml.bak; then
echo "Error: failed to update readme in pyproject.toml" >&2
exit 1
fi

Copilot uses AI. Check for mistakes.
poetry publish --build --skip-existing
rm -f pyproject.toml.bak
Comment on lines 6 to +10

Copilot AI Feb 11, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

publish.sh edits pyproject.toml to point at README-PYPI.md but never restores it back to README.md. After a local publish (or a failed publish), the working tree will be left in a state where normal builds/tests may fail unless README-PYPI.md is present. Consider restoring pyproject.toml from the backup on exit (e.g., via a trap) and/or explicitly switching it back to README.md after poetry publish completes.

Copilot uses AI. Check for mistakes.
Loading