Skip to content

Conversation

@bbopen
Copy link
Owner

@bbopen bbopen commented Jan 19, 2026

Summary

Sets up the Python package tywrap-ir for PyPI publishing, addressing user feedback that the current git-based installation is a significant friction point.

Changes

  • tywrap_ir/pyproject.toml: Added proper PyPI metadata (keywords, classifiers, URLs)
  • tywrap_ir/init.py: Added __version__ attribute
  • tywrap_ir/README.md: Updated with PyPI badges and installation docs
  • README.md: Added PyPI badge and pip install tywrap-ir instructions
  • .github/workflows/publish-pypi.yml: New workflow for PyPI releases

How to Release

After merging, create a tag to trigger the publish workflow:

git tag tywrap-ir-v0.1.2
git push origin tywrap-ir-v0.1.2

Before First Publish

You'll need to set up PyPI trusted publishing:

  1. Go to PyPI → Your projects → Add a new project
  2. Configure trusted publisher:
    • Owner: bbopen
    • Repository: tywrap
    • Workflow: publish-pypi.yml
    • Environment: pypi

Or add a PYPI_API_TOKEN secret to the repository.

Test plan

  • Package builds locally (python -m build)
  • CI tests pass
  • Workflow dry-run succeeds

Closes #130

🤖 Generated with Claude Code

- 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]>
@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

Note

Other AI code review bot(s) detected

CodeRabbit 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.

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
CI/CD Publishing Workflow
​.github/workflows/publish-pypi.yml
New workflow "Publish tywrap-ir to PyPI": triggers on tywrap-ir-v* tags or manual dispatch; validates semantic version and tag/pyproject match; runs tests across Python 3.10–3.12; builds distributions; stores artifacts; supports dry-run and real publish to PyPI.
Package Metadata
tywrap_ir/pyproject.toml
Rename package to tywrap-ir, version bumped to 0.1.2, author → "tywrap contributors", added maintainers, keywords, classifiers, project URLs, and tool.setuptools.packages.find configuration.
Documentation
README.md, tywrap_ir/README.md
Added PyPI badge and pip install instructions, updated Quick Start with Python installation notes, added usage examples and metadata/links in package README.
Package Version Export
tywrap_ir/tywrap_ir/__init__.py
Exported public __version__ = "0.1.2" and included it in __all__ alongside existing symbols.

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)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped from tags to tidy PyPI light,
Artifacts bundled, tests running bright,
A pip install now skips the git fight—
tywrap‑ir bounds forward, badges alight! 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change—adding PyPI publishing setup for tywrap-ir package.
Description check ✅ Passed The description clearly explains the purpose, lists all changes made, and provides release and setup instructions, all directly related to the changeset.
Linked Issues check ✅ Passed All coding requirements from issue #130 are met: PyPI publishing workflow added, pyproject.toml enriched with metadata, version added, READMEs updated with badges and installation instructions.
Out of Scope Changes check ✅ Passed All changes directly support the objective of publishing tywrap-ir to PyPI; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


📜 Recent review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65eb877 and 529c001.

📒 Files selected for processing (2)
  • .github/workflows/publish-pypi.yml
  • README.md
🧰 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
🔇 Additional comments (9)
README.md (5)

4-4: LGTM! PyPI badge properly formatted.

The badge follows the same pattern as the npm badge and correctly links to the PyPI project page.


22-26: LGTM! MD031 issue resolved.

The blank line before the fenced code block is now present (line 23), addressing the previous linting issue. The Requirements section clearly specifies Python 3.10+ and provides the correct installation command.


32-32: LGTM! Clear installation instruction with helpful context.

The inline comment clarifies that tywrap-ir is the Python component needed for code generation, which helps users understand why both npm and pip installs are required.


33-34: LGTM! Commands correctly documented.

The npx commands remain accurate with helpful inline comments.


158-158: LGTM! PyPI link properly added.

The link is correctly formatted and consistent with the PyPI badge at the top of the README.

.github/workflows/publish-pypi.yml (4)

3-16: Well-structured trigger and permissions configuration.

The OIDC id-token: write permission enables trusted PyPI publishing, and the tag pattern correctly scopes releases. The minimal contents: read follows least-privilege principles.


38-54: Good version validation and consistency check.

The semver regex correctly validates the format, and the tag-to-pyproject.toml consistency check prevents version drift. This ensures release integrity.


56-85: Comprehensive test coverage across Python versions.

The test matrix covers Python 3.10–3.12 with both CLI and API validation. The __version__ import test (line 84) properly verifies the new attribute is exported.


86-116: Build job follows PyPI packaging best practices.

Using python -m build and validating with twine check ensures proper sdist/wheel generation and metadata compliance before publishing.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

coderabbitai[bot]
coderabbitai bot previously requested changes Jan 19, 2026
Copy link

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 13ef2d8 and 65eb877.

📒 Files selected for processing (5)
  • .github/workflows/publish-pypi.yml
  • README.md
  • tywrap_ir/README.md
  • tywrap_ir/pyproject.toml
  • tywrap_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 with pyproject.toml), while IR_VERSION tracks 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 (for pip install)
  • Module name: tywrap_ir (for python -m)
  • CLI command: tywrap-ir (as defined in pyproject.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/v1 with OIDC trusted publishing
  • Correctly gates publishing with the pypi environment
  • 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: true ensures compatibility while failing quickly on issues.

tywrap_ir/pyproject.toml (3)

6-7: LGTM! Package naming and versioning are correct.

  • Package name tywrap-ir follows PEP 503 normalization conventions
  • Version 0.1.2 is 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-python constraint. Development Status "3 - Alpha" appropriately reflects the experimental nature mentioned in documentation.


43-45: LGTM! Package discovery configuration is correct.

The where=["."] and include=["tywrap_ir*"] settings correctly locate the tywrap_ir package 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]>
@bbopen bbopen dismissed coderabbitai[bot]’s stale review January 19, 2026 23:54

Addressed review feedback in commit 529c001

@bbopen bbopen merged commit b045fc8 into main Jan 19, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish tywrap_ir to PyPI

2 participants