{"id":51152520,"url":"https://github.com/momiji-rs/sasso-python","last_synced_at":"2026-06-26T07:03:09.061Z","repository":{"id":365113177,"uuid":"1270546535","full_name":"momiji-rs/sasso-python","owner":"momiji-rs","description":"Python bindings for sasso — a pure-Rust SCSS→CSS compiler (a dart-sass alternative), via its C ABI. In-process, no Node, no Dart VM.","archived":false,"fork":false,"pushed_at":"2026-06-15T23:26:38.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-16T00:16:48.609Z","etag":null,"topics":["compiler","css","css-preprocessor","ctypes","dart-sass","ffi","python","python-bindings","rust","sass","sass-compiler","scss"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/momiji-rs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-15T20:25:05.000Z","updated_at":"2026-06-15T23:26:41.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/momiji-rs/sasso-python","commit_stats":null,"previous_names":["momiji-rs/sasso-python"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/momiji-rs/sasso-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momiji-rs%2Fsasso-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momiji-rs%2Fsasso-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momiji-rs%2Fsasso-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momiji-rs%2Fsasso-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/momiji-rs","download_url":"https://codeload.github.com/momiji-rs/sasso-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/momiji-rs%2Fsasso-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34806448,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","css","css-preprocessor","ctypes","dart-sass","ffi","python","python-bindings","rust","sass","sass-compiler","scss"],"created_at":"2026-06-26T07:03:08.116Z","updated_at":"2026-06-26T07:03:09.047Z","avatar_url":"https://github.com/momiji-rs.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sasso\n\n[![PyPI](https://img.shields.io/pypi/v/sasso.svg)](https://pypi.org/project/sasso/)\n\nPython bindings for [**sasso**](https://github.com/momiji-rs/sasso) — a fast,\npure-Rust SCSS/Sass → CSS compiler — over its `libsasso` C ABI.\n\n`sasso` runs **in-process** (no Node, no subprocess, no system `sass` binary)\nvia a small `ctypes` layer over a prebuilt native library. Each wheel bundles\nthe compiled `libsasso` for its platform, so `pip install sasso` is all you\nneed.\n\n```bash\npip install sasso\n```\n\n## Usage\n\n```python\nimport sasso\n\ncss = sasso.compile(\n    \"\"\"\n    $brand: #336699;\n    .card {\n        color: $brand;\n        .title { font-weight: bold; }\n    }\n    \"\"\"\n)\nprint(css)\n```\n\n```python\n# Compressed output, .sass (indented) syntax, filesystem load paths:\nsasso.compile(src, style=\"compressed\")\nsasso.compile(indented_src, syntax=\"sass\")\nsasso.compile(src, load_paths=[\"styles\", \"vendor\"])\n```\n\n### Errors\n\nA compile failure raises `sasso.SassoError`, carrying the diagnostic message\nplus the 1-based source location:\n\n```python\ntry:\n    sasso.compile(\".broken { color: ; }\")\nexcept sasso.SassoError as e:\n    print(e.message, e.line, e.column)\n```\n\n### Custom importers\n\nResolve `@use` / `@forward` / `@import` yourself (from a database, a bundler's\nvirtual filesystem, HTTP, …) by subclassing `sasso.Importer`. It mirrors\ndart-sass's two-phase model:\n\n```python\nclass DictImporter(sasso.Importer):\n    def __init__(self, files):\n        self.files = files\n\n    def canonicalize(self, url, *, from_import, containing_url):\n        # Map a (possibly relative) URL to a stable canonical key, or None.\n        return url if url in self.files else None\n\n    def load(self, canonical):\n        # Fetch the source for a canonical key, or None.\n        return sasso.LoadResult(contents=self.files[canonical], syntax=\"scss\")\n\ncss = sasso.compile('@use \"theme\";', importer=DictImporter({\"theme\": \"$c: red;\"}))\n```\n\nAn exception raised inside an importer aborts the compile and surfaces as a\n`SassoError` with the original exception chained as `__cause__`.\n\n## API\n\n| Symbol | Description |\n| --- | --- |\n| `compile(source, *, style=\"expanded\", syntax=\"scss\", load_paths=None, url=None, importer=None) -\u003e str` | Compile a stylesheet string to CSS. |\n| `SassoError` | Raised on failure; has `.message: str`, `.line: int \\| None`, `.column: int \\| None`. |\n| `Importer` | ABC for custom resolution: `canonicalize(url, *, from_import, containing_url)` + `load(canonical) -\u003e LoadResult \\| None`. |\n| `LoadResult(contents, syntax=\"scss\", source_map_url=None)` | Return value of `Importer.load`. |\n| `compiler_version() -\u003e str` | Version of the bundled native `sasso` compiler. |\n| `__version__` | Version of this Python package (independent of the compiler version). |\n\n`style` is `\"expanded\"` or `\"compressed\"`; `syntax` is `\"scss\"`, `\"sass\"`, or\n`\"css\"`.\n\n## Performance\n\n`sasso` compiles in-process, so it avoids the per-call process-spawn overhead of\nshelling out to the `sass` CLI. Compiling a non-trivial stylesheet 200× on an\nApple-silicon Mac (`benchmark.py`, vs. spawning the dart-sass binary per\ncompile):\n\n```\noutput parity (sasso vs dart-sass): IDENTICAL\n\n  sasso (in-process)        :   0.0068 s total  (0.034 ms/compile)\n  dart-sass (subprocess/ea) :   4.7381 s total  (23.691 ms/compile)\n\n  speedup: sasso is 701.0x faster for 200 compiles in this workload\n```\n\nMost of that gap is process-startup cost that an in-process binding removes\nentirely; the comparison reflects the realistic \"shell out to `sass`\" path a\nPython app would otherwise take.\n\n## Versioning — which compiler is bundled?\n\nThe **package** version (`sasso.__version__`) floats independently of the\n**compiler** version it bundles (`sasso.compiler_version()`):\n\n| sasso (PyPI) | bundles core `sasso` crate |\n| --- | --- |\n| 0.1.0 | 0.6.0 |\n\nEach release notes its bundled core version in the [CHANGELOG](CHANGELOG.md).\n\n## How it works\n\nThe package is a `ctypes` binding — **not** a CPython C-extension — over the\n[`libsasso` C ABI](https://github.com/momiji-rs/sasso/tree/master/ffi). Because\nit has no Python-ABI linkage, a single native library per `(OS, arch)` serves\nevery CPython 3.x (and PyPy), so each release ships one platform wheel per\ntarget rather than one per Python version.\n\nThe native crate is vendored from `momiji-rs/sasso` `ffi/` and builds against\nthe **published** `sasso` crate from crates.io.\n\n## License\n\nMIT OR Apache-2.0, at your option. See [LICENSE-MIT](LICENSE-MIT) and\n[LICENSE-APACHE](LICENSE-APACHE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomiji-rs%2Fsasso-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomiji-rs%2Fsasso-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomiji-rs%2Fsasso-python/lists"}