-
Notifications
You must be signed in to change notification settings - Fork 0
feat(pypi): add tywrap-ir PyPI publishing #134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Update tywrap_ir/pyproject.toml with proper PyPI metadata - Add tywrap-ir version to tywrap_ir/__init__.py - Create publish-pypi.yml workflow for automated releases - Update README.md with PyPI badge and installation instructions - Update tywrap_ir/README.md with proper documentation The Python package can now be published to PyPI using the tag format: tywrap-ir-v0.1.2 Users will be able to install with: pip install tywrap-ir Closes #130 Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthroughAdds PyPI publishing for tywrap-ir: a GitHub Actions workflow to validate, test (Python 3.10–3.12), build, and optionally publish artifacts; updates packaging metadata and version; exposes package version; and updates documentation with PyPI installation/badges. Changes
Sequence Diagram(s)sequenceDiagram
actor Developer
participant GitHubActions as "GitHub Actions\nWorkflow"
participant Runner as "Workflow Runner"
participant ArtifactStore as "Artifact Storage"
participant PyPI as "PyPI (pypa)"
Developer->>GitHubActions: push tag / manual dispatch
GitHubActions->>Runner: start publish-pypi job
Runner->>Runner: Validate tag/version and pyproject
Runner->>Runner: Test matrix (Py3.10-3.12)
Runner->>Runner: Build distributions (sdist + wheels)
Runner->>ArtifactStore: upload build artifacts
alt dry_run = true
Runner->>Developer: report artifacts (no publish)
else dry_run = false
Runner->>PyPI: publish artifacts via pypa/gh-action-pypi-publish
PyPI-->>Runner: publish response
end
Runner->>GitHubActions: finalize workflow (success/failure)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2026-01-19T21:48:57.782ZApplied to files:
🔇 Additional comments (9)
✏️ Tip: You can disable this entire section by setting Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65eb877afa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In @.github/workflows/publish-pypi.yml:
- Around line 29-36: The current VERSION extraction using grep/sed is fragile;
replace the grep/sed block that sets VERSION (the branch checking around
GITHUB_REF and the else branch) with a robust Python-based parse of
tywrap_ir/pyproject.toml (using tomllib for Python 3.11+ or tomli for older
runtimes) so VERSION is derived from the parsed ['project']['version'] field;
ensure the existing tag handling that extracts VERSION from GITHUB_REF (the
refs/tags/tywrap-ir-v* branch) remains unchanged and only the fallback else
branch (where VERSION is set from pyproject.toml) is updated to call the Python
parser and write the resulting value to GITHUB_OUTPUT.
- Around line 82-84: Add a quick assertion in the CI step that imports and
prints the package __version__ alongside IR_VERSION to ensure the new attribute
is exported; update the command that currently imports extract_module_ir and
IR_VERSION to also import __version__ (e.g., "from tywrap_ir import __version__,
IR_VERSION") and print or validate both values so the workflow verifies the new
__version__ symbol is present and non-empty.
In `@README.md`:
- Around line 22-25: Add a blank line before the fenced code block that follows
the "Python 3.10+ with `tywrap-ir`:" line so the code fence is surrounded by
blank lines per MD031; locate the fenced block (the triple-backtick bash block
containing pip install tywrap-ir) and insert a single empty line immediately
above the opening ``` to ensure proper Markdown rendering.
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/publish-pypi.ymlREADME.mdtywrap_ir/README.mdtywrap_ir/pyproject.tomltywrap_ir/tywrap_ir/__init__.py
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-01-19T21:48:57.782Z
Learnt from: bbopen
Repo: bbopen/tywrap PR: 127
File: runtime/python_bridge.py:99-123
Timestamp: 2026-01-19T21:48:57.782Z
Learning: In the tywrap repository, TYWRAP_REQUEST_MAX_BYTES uses strict integer parsing that rejects values with trailing characters (e.g., "1024abc"). This differs from TYWRAP_CODEC_MAX_BYTES, which uses tolerant/best-effort parsing that accepts numeric prefixes. The strict policy for REQUEST_MAX_BYTES ensures explicit integer values and consistent parse behavior across Node/Python implementations.
Applied to files:
README.md
🪛 markdownlint-cli2 (0.18.1)
README.md
23-23: Fenced code blocks should be surrounded by blank lines
(MD031, blanks-around-fences)
🔇 Additional comments (9)
tywrap_ir/tywrap_ir/__init__.py (1)
4-8: LGTM! Version exposure follows standard Python packaging conventions.The dual versioning strategy is appropriate:
__version__tracks the package version (aligned withpyproject.toml), whileIR_VERSIONtracks the schema/IR format version independently. This allows the package to evolve without necessarily changing the IR format.README.md (2)
30-34: LGTM! Quick Start instructions are clear and accurate.The installation flow correctly separates npm and pip dependencies, making the dual-runtime nature of tywrap clear to users.
4-4: LGTM! PyPI badge and link added correctly.Badge and link URLs are consistent and point to the correct PyPI project page.
Also applies to: 157-157
tywrap_ir/README.md (1)
1-45: LGTM! Comprehensive README with proper naming conventions.The documentation correctly distinguishes between:
- Package name:
tywrap-ir(forpip install)- Module name:
tywrap_ir(forpython -m)- CLI command:
tywrap-ir(as defined inpyproject.toml)The "What is this?" section helpfully clarifies that users typically don't need to interact with this package directly.
.github/workflows/publish-pypi.yml (2)
117-141: LGTM! Publish job uses trusted publishing correctly.The workflow:
- Uses
pypa/gh-action-pypi-publish@release/v1with OIDC trusted publishing- Correctly gates publishing with the
pypienvironment- Dry run logic properly handles both tag-triggered and manual dispatch scenarios
56-84: LGTM! Test matrix covers supported Python versions.Testing across Python 3.10, 3.11, and 3.12 with
fail-fast: trueensures compatibility while failing quickly on issues.tywrap_ir/pyproject.toml (3)
6-7: LGTM! Package naming and versioning are correct.
- Package name
tywrap-irfollows PEP 503 normalization conventions- Version
0.1.2is consistent with__version__in__init__.py
20-32: LGTM! Classifiers are well-chosen and consistent.The Python version classifiers (3.10, 3.11, 3.12) align with the CI test matrix and
requires-pythonconstraint. Development Status "3 - Alpha" appropriately reflects the experimental nature mentioned in documentation.
43-45: LGTM! Package discovery configuration is correct.The
where=["."]andinclude=["tywrap_ir*"]settings correctly locate thetywrap_irpackage within the project's directory structure.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
- Add blank line before fenced code block in README (MD031) - Test __version__ alongside IR_VERSION in CI Co-Authored-By: Claude Opus 4.5 <[email protected]>
Addressed review feedback in commit 529c001
Summary
Sets up the Python package
tywrap-irfor PyPI publishing, addressing user feedback that the current git-based installation is a significant friction point.Changes
__version__attributepip install tywrap-irinstructionsHow to Release
After merging, create a tag to trigger the publish workflow:
Before First Publish
You'll need to set up PyPI trusted publishing:
bbopentywrappublish-pypi.ymlpypiOr add a
PYPI_API_TOKENsecret to the repository.Test plan
python -m build)Closes #130
🤖 Generated with Claude Code