-
Notifications
You must be signed in to change notification settings - Fork 0
feat: scaffold publishable sdk foundation #7
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .pytest_cache/ | ||
| .venv/ | ||
| __pycache__/ | ||
| dist/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.13 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ## convert-python-sdk | ||
|
|
||
| This repository currently contains the Story 1.1 scaffold for Convert's Python SDK. | ||
|
|
||
| Canonical package decisions frozen in this story: | ||
|
|
||
| - Distribution name: `convert-python-sdk` | ||
| - Import package: `convert_sdk` | ||
| - Stable public imports: `Core`, `Context`, and `__version__` | ||
|
|
||
| The scaffold is intentionally minimal. Feature initialization, configuration loading, local evaluation, and tracking behavior will land in later stories. | ||
|
|
||
| ### Local Development | ||
|
|
||
| ```bash | ||
| UV_CACHE_DIR=/tmp/uv-cache uv sync --group dev | ||
| UV_CACHE_DIR=/tmp/uv-cache uv run pytest | ||
| UV_CACHE_DIR=/tmp/uv-cache uv build | ||
| ``` | ||
|
|
||
| ### Public Import Boundary | ||
|
|
||
| ```python | ||
| from convert_sdk import Context, Core, __version__ | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,36 @@ | ||||||||||||||||
| [project] | ||||||||||||||||
| name = "convert-python-sdk" | ||||||||||||||||
| version = "0.1.0" | ||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The package version is currently hardcoded in both
Suggested change
|
||||||||||||||||
| description = "Framework-agnostic Python SDK scaffold for Convert." | ||||||||||||||||
| readme = "README.md" | ||||||||||||||||
| authors = [ | ||||||||||||||||
| { name = "Usman Abbas", email = "usman.abbas7@gmail.com" } | ||||||||||||||||
| ] | ||||||||||||||||
| requires-python = ">=3.9" | ||||||||||||||||
| dependencies = [] | ||||||||||||||||
|
|
||||||||||||||||
| [dependency-groups] | ||||||||||||||||
| dev = [ | ||||||||||||||||
| "pytest>=8.4,<9", | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| [build-system] | ||||||||||||||||
| requires = ["hatchling>=1.29,<2"] | ||||||||||||||||
| build-backend = "hatchling.build" | ||||||||||||||||
|
|
||||||||||||||||
| [tool.hatch.build.targets.wheel] | ||||||||||||||||
| packages = ["src/convert_sdk"] | ||||||||||||||||
|
|
||||||||||||||||
| [tool.hatch.build.targets.wheel.force-include] | ||||||||||||||||
| "src/convert_sdk/py.typed" = "convert_sdk/py.typed" | ||||||||||||||||
|
Comment on lines
+24
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||
|
|
||||||||||||||||
| [tool.hatch.build.targets.sdist] | ||||||||||||||||
| include = [ | ||||||||||||||||
| "README.md", | ||||||||||||||||
| "src/convert_sdk/**/*.py", | ||||||||||||||||
| "src/convert_sdk/py.typed", | ||||||||||||||||
| "tests/**/*.py", | ||||||||||||||||
| ] | ||||||||||||||||
|
|
||||||||||||||||
| [tool.pytest.ini_options] | ||||||||||||||||
| testpaths = ["tests"] | ||||||||||||||||
|
Comment on lines
+35
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When using dynamic versioning, you need to specify the source of the version metadata for Hatch. This ensures that the version defined in
Suggested change
|
||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| """Stable public import boundary for the Convert Python SDK.""" | ||
|
|
||
| from .context import Context | ||
| from .core import Core | ||
| from .version import __version__ | ||
|
|
||
| __all__ = ["Context", "Core", "__version__"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| """Per-visitor context placeholder reserved for later stories.""" | ||
|
|
||
|
|
||
| class Context: | ||
| """Stable root export for visitor-scoped SDK behavior.""" | ||
|
|
||
| def __repr__(self) -> str: | ||
| return "Context()" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| """Public SDK entry point placeholder for future initialization work.""" | ||
|
|
||
|
|
||
| class Core: | ||
| """Stable root export reserved for SDK initialization and context creation.""" | ||
|
|
||
| def __repr__(self) -> str: | ||
| return "Core()" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| """Version metadata for the public SDK package.""" | ||
|
|
||
| __version__ = "0.1.0" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| from importlib.metadata import distribution | ||
| from pathlib import Path | ||
|
|
||
|
|
||
| PROJECT_ROOT = Path(__file__).resolve().parents[1] | ||
|
|
||
|
|
||
| def test_distribution_metadata_matches_story_contract() -> None: | ||
| dist = distribution("convert-python-sdk") | ||
|
|
||
| assert dist.metadata["Name"] == "convert-python-sdk" | ||
| assert dist.metadata["Requires-Python"] == ">=3.9" | ||
| assert dist.requires in (None, []) | ||
|
|
||
|
|
||
| def test_pyproject_freezes_convert_sdk_package_boundary() -> None: | ||
| pyproject = (PROJECT_ROOT / "pyproject.toml").read_text(encoding="utf-8") | ||
|
|
||
| assert 'packages = ["src/convert_sdk"]' in pyproject | ||
| assert '"src/convert_sdk/py.typed" = "convert_sdk/py.typed"' in pyproject |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,14 @@ | ||||||||||||||||||||||||||||||||||||||
| from importlib import resources | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| from convert_sdk import Context, Core, __version__ | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def test_public_import_boundary_is_stable() -> None: | ||||||||||||||||||||||||||||||||||||||
| assert Core.__module__ == "convert_sdk.core" | ||||||||||||||||||||||||||||||||||||||
| assert Context.__module__ == "convert_sdk.context" | ||||||||||||||||||||||||||||||||||||||
| assert __version__ == "0.1.0" | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid hardcoding the version string in tests. It is more robust to compare the exported
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def test_py_typed_marker_is_available() -> None: | ||||||||||||||||||||||||||||||||||||||
| marker = resources.files("convert_sdk").joinpath("py.typed") | ||||||||||||||||||||||||||||||||||||||
| assert marker.is_file() | ||||||||||||||||||||||||||||||||||||||
Large diffs are not rendered by default.
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.
Hardcoding
UV_CACHE_DIR=/tmp/uv-cacheis not portable across different operating systems (e.g., Windows) and may fail if the directory is not writable.uvautomatically manages its cache in a platform-appropriate location, so this override is generally unnecessary for local development instructions.