Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the Python bindings under python/ to a standard src/ layout and introduces initial PyPI packaging scaffolding for the decimo package, aligning the repo with common Python packaging conventions while keeping the native Mojo extension workflow.
Changes:
- Restructures the Python package into
python/src/decimo/(including__init__.py,_decimo.pyi, andpy.typed). - Adds
python/pyproject.tomlandpython/README.mdto support wheel builds / PyPI metadata (placeholder wheel). - Updates pixi tasks and ignores to reflect the new extension output path and wheel build artifacts.
Reviewed changes
Copilot reviewed 6 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tests/test_decimo.py | Updates test import path to the new python/src layout. |
| python/src/decimo/py.typed | Adds PEP 561 marker for typed package support. |
| python/src/decimo/_decimo.pyi | Adds type stubs for the native _decimo extension module. |
| python/src/decimo/init.py | Implements package entrypoint and wraps native _decimo import with a user-facing error. |
| python/pyproject.toml | Adds Hatchling-based PyPI build configuration and metadata. |
| python/README.md | Adds PyPI landing-page documentation and build-from-source instructions. |
| pixi.toml | Updates buildpy output path and adds a wheel build task + dependencies. |
| pixi.lock | Locks new dependencies (python-build, twine, transitive deps). |
| docs/plans/mojo4py.md | Updates parts of the plan doc for the new packaging/layout. |
| .gitignore | Ignores python/dist/ wheel output directory. |
Comments suppressed due to low confidence (2)
python/src/decimo/init.py:12
__version__is hardcoded here while the package version is also declared inpython/pyproject.toml. This is likely to drift and produce incorrect runtime version reporting; consider deriving the version from package metadata (e.g.,importlib.metadata.version("decimo")) or using a single source of truth.
python/src/decimo/init.py:24- The broad
except ImportErrorre-raises a new ImportError message, which can obscure the underlying loader error when_decimoexists but fails to load (e.g., missing shared library / ABI mismatch). Consider including the original exception text in the message (or only wrapping the specific “module not found” case) so users can diagnose the real failure.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # decimo | ||
|
|
||
| **Arbitrary-precision decimal and integer arithmetic for Python, powered by Mojo.** | ||
|
|
There was a problem hiding this comment.
The README tagline claims “decimal and integer arithmetic for Python”, but this Python package currently only exposes BigDecimal bindings (with BigInt/Decimal128 listed as planned later). Consider tightening the wording to avoid misleading PyPI readers about current functionality.
| [project] | ||
| name = "decimo" | ||
| version = "0.1.0.dev0" | ||
| description = "Arbitrary-precision decimal and integer arithmetic for Python, powered by Mojo" |
There was a problem hiding this comment.
description mentions “decimal and integer arithmetic for Python”, but the current Python bindings exposed in this package are for BigDecimal only. Consider adjusting the metadata description to reflect the current surface area to avoid confusing PyPI consumers.
| description = "Arbitrary-precision decimal and integer arithmetic for Python, powered by Mojo" | |
| description = "Arbitrary-precision decimal arithmetic for Python (BigDecimal bindings), powered by Mojo" |
|
|
||
| ```txt | ||
| python/ | ||
| ├── decimo_module.mojo ← Mojo binding source (builds to _decimo.so) | ||
| ├── _decimo.so ← compiled extension (gitignored) | ||
| ├── decimo.py ← Python wrapper: Decimal class + BigDecimal alias | ||
| ├── pyproject.toml ← PyPI package config (hatchling, src layout) | ||
| ├── README.md ← PyPI landing page | ||
| ├── decimo_module.mojo ← Mojo binding source (builds to src/decimo/_decimo.so) | ||
| ├── src/ | ||
| │ └── decimo/ | ||
| │ ├── __init__.py ← Python wrapper: Decimal class + BigDecimal alias | ||
| │ ├── _decimo.pyi ← Type stub for Pylance/mypy | ||
| │ ├── _decimo.so ← compiled extension (gitignored) | ||
| │ └── py.typed ← PEP 561 marker |
There was a problem hiding this comment.
The updated file-structure section conflicts with later parts of this document that still describe the old layout (decimo.py, python/_decimo.so, and pixi run pybuild/pytest). To keep the plan consistent, update the remaining sections to reflect the new python/src/decimo/ wrapper + buildpy/testpy task names and the new _decimo.so location.
Restructures the `python/` directory to a standard `src` layout and adds PyPI packaging scaffolding (reserving the `decimo` package name). ## Changes ### PyPI packaging (`python/pyproject.toml`, `python/README.md`) - Add `pyproject.toml` with `hatchling` build backend and `src` layout. - Add `python/README.md` as the PyPI landing page. - Add `python/src/decimo/py.typed` (PEP 561 marker for type checkers). - Placeholder wheel `0.1.0.dev0` published to PyPI — name `decimo` is now reserved. - `pixi run wheel` task builds the wheel; `python-build` and `twine` added to pixi dependencies. ### `src` layout restructure - `python/decimo.py` → `python/src/decimo/__init__.py` - `python/_decimo.pyi` → `python/src/decimo/_decimo.pyi` - `python/tests/test_decimo.py` — updated `sys.path` for new layout. - `pixi run buildpy` — output path updated to `python/src/decimo/_decimo.so`. - `.vscode/settings.json` — `extraPaths` updated to `["python/src"]`.
Restructures the
python/directory to a standardsrclayout and adds PyPIpackaging scaffolding (reserving the
decimopackage name).Changes
PyPI packaging (
python/pyproject.toml,python/README.md)pyproject.tomlwithhatchlingbuild backend andsrclayout.python/README.mdas the PyPI landing page.python/src/decimo/py.typed(PEP 561 marker for type checkers).0.1.0.dev0published to PyPI — namedecimois now reserved.pixi run wheeltask builds the wheel;python-buildandtwineadded to pixi dependencies.srclayout restructurepython/decimo.py→python/src/decimo/__init__.pypython/_decimo.pyi→python/src/decimo/_decimo.pyipython/tests/test_decimo.py— updatedsys.pathfor new layout.pixi run buildpy— output path updated topython/src/decimo/_decimo.so..vscode/settings.json—extraPathsupdated to["python/src"].