diff --git a/SLS_Python/MANIFEST.in b/SLS_Python/MANIFEST.in deleted file mode 100644 index 2fe37bd..0000000 --- a/SLS_Python/MANIFEST.in +++ /dev/null @@ -1,2 +0,0 @@ -include scripts/*.py -include scripts/*.in \ No newline at end of file diff --git a/SLS_Python/README.md b/SLS_Python/README.md index 019c290..99c59c7 100644 --- a/SLS_Python/README.md +++ b/SLS_Python/README.md @@ -1,42 +1,17 @@ # SLS Python -This directory contains a minimal Python project skeleton intended to reimplement -functionality from the C `SLS` project found at the repository root. - -Layout -- `src/sls/` — Python package with module skeletons: `lexer`, `parser`, `interpreter`, `builtin`, `repl`, and `cli`. -- `tests/` — pytest tests (start with `test_import.py`). -- `pyproject.toml` — project metadata and `sls` console script entrypoint. -- `requirements-dev.txt` — developer/test tools. - -Quick start - -Create a venv and install editable package + dev requirements: +## Building ```bash +cd SLS_Python python -m venv .venv source .venv/bin/activate -pip install -e SLS_Python -pip install -r SLS_Python/requirements-dev.txt + +pip install build wheel "setuptools>=61.0" + +# Install the backend (one-time setup) +pip install -e sls_build_backend + +# Build with --no-isolation (required because backend is local) +python -m build --no-isolation ``` - -Run tests: - -```bash -pytest -q -``` - -Run the REPL: - -```bash -sls repl -``` - -Next steps (suggested) -- Port `lexer.c` to `src/sls/lexer.py` and add comprehensive tokenization tests. -- Port `parser` and `interpreter` incrementally, keeping tests for parity. -- Add CI (GitHub Actions) and type checking (`mypy`). - -If you want, I can now: -- Run the tests in this environment (if you want me to configure the Python env), or -- Start porting a specific module from the C implementation (lexer is a good first target). diff --git a/SLS_Python/pyproject.toml b/SLS_Python/pyproject.toml index 4082f2d..1e2b130 100644 --- a/SLS_Python/pyproject.toml +++ b/SLS_Python/pyproject.toml @@ -1,7 +1,7 @@ # Build this file using 'python -m build' (from 'build' package) [build-system] -requires = ["setuptools>=61.0", "wheel"] -build-backend = "sls.build_hooks" +requires = ["setuptools>=61.0", "wheel", "sls_build_backend"] +build-backend = "sls_build_backend" [project] name = "sls_python" diff --git a/SLS_Python/sls_build_backend/__init__.py b/SLS_Python/sls_build_backend/__init__.py new file mode 100644 index 0000000..421c2f8 --- /dev/null +++ b/SLS_Python/sls_build_backend/__init__.py @@ -0,0 +1,5 @@ +"""Build backend for sls_python package.""" + +from .build_hooks import build_wheel, build_sdist + +__all__ = ["build_wheel", "build_sdist"] diff --git a/SLS_Python/scripts/_version.py.in b/SLS_Python/sls_build_backend/_version.py.in similarity index 100% rename from SLS_Python/scripts/_version.py.in rename to SLS_Python/sls_build_backend/_version.py.in diff --git a/SLS_Python/sls/build_hooks.py b/SLS_Python/sls_build_backend/build_hooks.py similarity index 80% rename from SLS_Python/sls/build_hooks.py rename to SLS_Python/sls_build_backend/build_hooks.py index 4c984de..a39cb3d 100644 --- a/SLS_Python/sls/build_hooks.py +++ b/SLS_Python/sls_build_backend/build_hooks.py @@ -1,10 +1,9 @@ -import subprocess from setuptools.build_meta import build_wheel as _build_wheel from setuptools.build_meta import build_sdist as _build_sdist def _generate_version(): - subprocess.check_call(["python", "scripts/write_version.py"]) - + from .write_version import main + main() def build_wheel(*args, **kwargs): _generate_version() diff --git a/SLS_Python/sls_build_backend/pyproject.toml b/SLS_Python/sls_build_backend/pyproject.toml new file mode 100644 index 0000000..f60e18b --- /dev/null +++ b/SLS_Python/sls_build_backend/pyproject.toml @@ -0,0 +1,14 @@ +[build-system] +requires = ["setuptools>=61.0", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "sls-build-backend" +version = "0.1.0" +description = "Build backend for sls_python" +authors = [{name = "Kyler Olsen"}] +requires-python = ">=3.10" + +[tool.setuptools] +packages = ["sls_build_backend"] +package-dir = {"" = ".."} diff --git a/SLS_Python/scripts/write_version.py b/SLS_Python/sls_build_backend/write_version.py similarity index 94% rename from SLS_Python/scripts/write_version.py rename to SLS_Python/sls_build_backend/write_version.py index 300894c..c0c8e8b 100644 --- a/SLS_Python/scripts/write_version.py +++ b/SLS_Python/sls_build_backend/write_version.py @@ -3,7 +3,7 @@ import datetime import pathlib root = pathlib.Path(__file__).resolve().parents[1] -template = root / "scripts" / "_version.py.in" +template = root / "sls_build_backend" / "_version.py.in" output = root / "sls" / "_version.py" def get_commit():