Skip to main content

PyPI - Project Version PyPI - Python Version GitHub - Project License

python-lightningcss

python-lightningcss offers PyO3 bindings to the lightningcss library. Presently only a subset of functionality is exposed, intended for integration into a Python-centric web application rather than a JavaScript-based workflow. If the latter is needed, consider using the official npm lightningcss module, parcel, or webpack instead.

Installation

python-lightningcss includes wheels which can be installed for most platforms using pip:

$ pip install lightningcss

Alternatively, python-lightningcss may be installed directly from source:

$ pip install git+https://github.com/pydsigner/python-lightningcss

This will require that the Rust toolchain be installed.

Usage

import lightningcss

parser_flags = lightningcss.calc_parser_flags(nesting=True)

input_css = """
.navbar {
    margin: 0;

    a {
        padding-left: 0;
        padding-right: 0;
        padding-top: 5px;
        padding-bottom: 5px;
    }
}
"""

output_css = lightningcss.process_stylesheet(
    input_css,
    filename="abc.css",
    parser_flags = parser_flags,
    browsers_list = ['defaults'],
    minify = True,
)

The filename keyword parameter is only used for displaying error messages from the parser. When using browsers_list, lightningcss will try to transpile the code to be compatible with the specified browserslist target.

This package also supports creating a CSS bundle where all @import rules are resolved into a single stylesheet:

bundled_css = lightningcss.bundle_css(
    "main.css",
    browsers_list = ["defaults"],
    minify = False,
)

All resources referenced via @import are resolved relative to the main file.

Metadata

Release files for lightningcss 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lightningcss 0.3.2
File Size Uploaded Provenance Actions
lightningcss-0.3.2.tar.gz 20.2 kB Without provenance Details for lightningcss-0.3.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for lightningcss 0.3.2
File Actions
lightningcss-0.3.2-cp37-abi3-win_amd64.whl CPython 3.7 abi3 Windows x86-64 Details for lightningcss-0.3.2-cp37-abi3-win_amd64.whl
lightningcss-0.3.2-cp37-abi3-win32.whl CPython 3.7 abi3 Windows x86-32 Details for lightningcss-0.3.2-cp37-abi3-win32.whl
lightningcss-0.3.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 abi3 Linux glibc 2.17+ x86-64 Details for lightningcss-0.3.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
lightningcss-0.3.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl CPython 3.7 abi3 Linux glibc 2.17+ IBM System/390x Details for lightningcss-0.3.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
lightningcss-0.3.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl CPython 3.7 abi3 Linux glibc 2.17+ PowerPC 64-le Details for lightningcss-0.3.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
lightningcss-0.3.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl CPython 3.7 abi3 Linux glibc 2.17+ x86-32 Details for lightningcss-0.3.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
lightningcss-0.3.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl CPython 3.7 abi3 Linux glibc 2.17+ ARMv7l Details for lightningcss-0.3.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
lightningcss-0.3.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl CPython 3.7 abi3 Linux glibc 2.17+ ARM64 Details for lightningcss-0.3.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
lightningcss-0.3.2-cp37-abi3-macosx_11_0_arm64.whl CPython 3.7 abi3 macOS 11.0+ ARM64 Details for lightningcss-0.3.2-cp37-abi3-macosx_11_0_arm64.whl
lightningcss-0.3.2-cp37-abi3-macosx_10_12_x86_64.whl CPython 3.7 abi3 macOS 10.12+ x86-64 Details for lightningcss-0.3.2-cp37-abi3-macosx_10_12_x86_64.whl

Total release size: 33.0 MB

Release files / lightningcss-0.3.2.tar.gz

Download URL lightningcss-0.3.2.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
239cc184f25e29d3683340e57f7607ef687bf4522896f10fe9acd317007edf18
BLAKE2b-256 checksum
How to use checksums
a8118f698855540865f22b45f9adbf7399430392fcc5838d958933e2d10937f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-win_amd64.whl

Download URL lightningcss-0.3.2-cp37-abi3-win_amd64.whl
Size 3.0 MB
Tags CPython 3.7 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
67867320f3f365cfb63d8a8625db186e3ee9b3d16720ee528f78da20072336e8
BLAKE2b-256 checksum
How to use checksums
01bb4012db75f38894a3787bd3ada4251af9cea92f99581c6c05e06413e5d9b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-win32.whl

Download URL lightningcss-0.3.2-cp37-abi3-win32.whl
Size 2.5 MB
Tags CPython 3.7 Windows x86-32 abi3
SHA-256 checksum
How to use checksums
a1c36e4b35bcc6d3fd5d6b13976789fb86f54af4c1a0250d427bf66251e83423
BLAKE2b-256 checksum
How to use checksums
e5454b4860ea7afa9ffbf889bf293962fc301924a50c3ed83c926d2777595272
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL lightningcss-0.3.2-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 3.4 MB
Tags CPython 3.7 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
a4c394c405ffa2476ed0ef5083fc1790e87a1f2b34d637abe6c496aea6463fc2
BLAKE2b-256 checksum
How to use checksums
178194c55cb25163b2033089a12085e4478a2634416961210fe7f8b7bae5f7ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl

Download URL lightningcss-0.3.2-cp37-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
Size 3.5 MB
Tags CPython 3.7 Linux glibc 2.17+ IBM System/390x abi3
SHA-256 checksum
How to use checksums
b6cdc241c9374b215ab85f0e4f4649998779b50af25bc62d17577e4c66d93c1b
BLAKE2b-256 checksum
How to use checksums
4de9046fd61e9a2abbde4def2de1d04f93b54de0d425941d0c4cf6b73422d374
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl

Download URL lightningcss-0.3.2-cp37-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
Size 3.7 MB
Tags CPython 3.7 Linux glibc 2.17+ PowerPC 64-le abi3
SHA-256 checksum
How to use checksums
a3d4f884696ebf4118853b749fd632c35df476fa8b6a42bd22d6b69d488712f6
BLAKE2b-256 checksum
How to use checksums
df86240766f0ad4d46d0e601f675e77713c4060416a59301eac82029ba73bad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl

Download URL lightningcss-0.3.2-cp37-abi3-manylinux_2_17_i686.manylinux2014_i686.whl
Size 3.7 MB
Tags CPython 3.7 Linux glibc 2.17+ x86-32 abi3
SHA-256 checksum
How to use checksums
d3f0ce25ef379aab8afcd6116e8a8c810fcc02c1d196d803a102851b008abd23
BLAKE2b-256 checksum
How to use checksums
5c24f9c9672c5ee5b10211b6e6837ad206c7a603cccf1fdb6ee5c357a0c8baf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl

Download URL lightningcss-0.3.2-cp37-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
Size 3.3 MB
Tags CPython 3.7 Linux glibc 2.17+ ARMv7l abi3
SHA-256 checksum
How to use checksums
ca1581cbdaea419aff20b736086d29fe1e73560f57912a347a1e6997123d85dc
BLAKE2b-256 checksum
How to use checksums
3bb71a0b635ba19426345a2d904523322e31d7489e77165858c251995b346bb3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL lightningcss-0.3.2-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 3.3 MB
Tags CPython 3.7 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
2dd0c83ff274423375efc6608b0d272441cf435e03db6bacb71853c23c736f00
BLAKE2b-256 checksum
How to use checksums
e0fe38045b63e3474ee659fb3f15eac884a23186752d9312c36b98add21bbde0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-macosx_11_0_arm64.whl

Download URL lightningcss-0.3.2-cp37-abi3-macosx_11_0_arm64.whl
Size 3.1 MB
Tags CPython 3.7 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
37ae0a05b10ed754f690e0f3669003a0d7c19a8affd63970f2c40d7bf8b34464
BLAKE2b-256 checksum
How to use checksums
a8db635391586622a70412fd7b1addb2b28da2f52c1dcc7687ba064f7fe726fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Release files / lightningcss-0.3.2-cp37-abi3-macosx_10_12_x86_64.whl

Download URL lightningcss-0.3.2-cp37-abi3-macosx_10_12_x86_64.whl
Size 3.3 MB
Tags CPython 3.7 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b4aba6e33e7b21e3f8b06b64f503f965e7a8ddada84da08da902b356582048b8
BLAKE2b-256 checksum
How to use checksums
8538b3917844d08d7e321d4a6ab3e9f22f2f443ab43f8611658524e10be5c941
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.15.0

Security for lightningcss 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page