lightningcss 0.1.0__tar.gz → 0.1.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lightningcss-0.1.0 → lightningcss-0.1.1}/Cargo.lock +1 -1
- {lightningcss-0.1.0 → lightningcss-0.1.1}/Cargo.toml +1 -1
- {lightningcss-0.1.0 → lightningcss-0.1.1}/PKG-INFO +15 -1
- {lightningcss-0.1.0 → lightningcss-0.1.1}/README.md +13 -0
- lightningcss-0.1.1/lightningcss.pyi +48 -0
- {lightningcss-0.1.0 → lightningcss-0.1.1}/pyproject.toml +1 -0
- {lightningcss-0.1.0 → lightningcss-0.1.1}/.github/workflows/CI.yml +0 -0
- {lightningcss-0.1.0 → lightningcss-0.1.1}/.gitignore +0 -0
- {lightningcss-0.1.0 → lightningcss-0.1.1}/LICENSE +0 -0
- {lightningcss-0.1.0 → lightningcss-0.1.1}/src/lib.rs +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: lightningcss
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Classifier: Development Status :: 3 - Alpha
|
|
5
5
|
Classifier: Intended Audience :: Developers
|
|
6
6
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
18
|
Classifier: Topic :: Internet :: WWW/HTTP
|
|
18
19
|
Classifier: Topic :: Software Development :: Pre-processors
|
|
19
20
|
License-File: LICENSE
|
|
@@ -25,6 +26,10 @@ Requires-Python: >=3.7
|
|
|
25
26
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
26
27
|
Project-URL: Source, https://github.com/pydsigner/python-lightningcss
|
|
27
28
|
|
|
29
|
+
[](https://pypi.org/project/lightningcss)
|
|
30
|
+
[](https://pypi.org/project/anchovy)
|
|
31
|
+
[](https://github.com/pydsigner/python-lightningcss)
|
|
32
|
+
|
|
28
33
|
# python-lightningcss
|
|
29
34
|
|
|
30
35
|
python-lightningcss offers PyO3 bindings to the lightningcss library. Presently
|
|
@@ -33,6 +38,15 @@ Python-centric web application rather than a JavaScript-based workflow. If the
|
|
|
33
38
|
latter is needed, consider using the [official npm lightningcss module, parcel,
|
|
34
39
|
or webpack](https://lightningcss.dev/docs.html) instead.
|
|
35
40
|
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
python-lightningcss includes wheels which can be installed for most platforms
|
|
44
|
+
using pip: `pip install lightningcss`.
|
|
45
|
+
|
|
46
|
+
Alternatively, python-lightningcss may be installed directly from source:
|
|
47
|
+
`pip install git+https://github.com/pydsigner/python-lightningcss`. This will
|
|
48
|
+
require that the Rust toolchain be installed.
|
|
49
|
+
|
|
36
50
|
## Usage
|
|
37
51
|
|
|
38
52
|
```py
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
[](https://pypi.org/project/lightningcss)
|
|
2
|
+
[](https://pypi.org/project/anchovy)
|
|
3
|
+
[](https://github.com/pydsigner/python-lightningcss)
|
|
4
|
+
|
|
1
5
|
# python-lightningcss
|
|
2
6
|
|
|
3
7
|
python-lightningcss offers PyO3 bindings to the lightningcss library. Presently
|
|
@@ -6,6 +10,15 @@ Python-centric web application rather than a JavaScript-based workflow. If the
|
|
|
6
10
|
latter is needed, consider using the [official npm lightningcss module, parcel,
|
|
7
11
|
or webpack](https://lightningcss.dev/docs.html) instead.
|
|
8
12
|
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
python-lightningcss includes wheels which can be installed for most platforms
|
|
16
|
+
using pip: `pip install lightningcss`.
|
|
17
|
+
|
|
18
|
+
Alternatively, python-lightningcss may be installed directly from source:
|
|
19
|
+
`pip install git+https://github.com/pydsigner/python-lightningcss`. This will
|
|
20
|
+
require that the Rust toolchain be installed.
|
|
21
|
+
|
|
9
22
|
## Usage
|
|
10
23
|
|
|
11
24
|
```py
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""
|
|
2
|
+
A python wrapper for the core CSS transformation functionality of lightningcss.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from typing import NewType
|
|
6
|
+
|
|
7
|
+
ParserFlags = NewType('ParserFlags', int)
|
|
8
|
+
|
|
9
|
+
def calc_parser_flags(
|
|
10
|
+
nesting: bool = False,
|
|
11
|
+
custom_media: bool = False,
|
|
12
|
+
deep_selector_combinator: bool = False
|
|
13
|
+
) -> ParserFlags:
|
|
14
|
+
"""
|
|
15
|
+
Calculates the `parser_flags` argument of `process_stylesheet()`.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
def process_stylesheet(
|
|
19
|
+
code: str,
|
|
20
|
+
/,
|
|
21
|
+
filename: str = "",
|
|
22
|
+
error_recovery: bool = False,
|
|
23
|
+
parser_flags: ParserFlags = ParserFlags(0),
|
|
24
|
+
unused_symbols: set[str] | None = None,
|
|
25
|
+
browsers_list: list[str] | None = None,
|
|
26
|
+
minify: bool = True
|
|
27
|
+
) -> str:
|
|
28
|
+
"""
|
|
29
|
+
Processes the supplied CSS stylesheet and returns as a string.
|
|
30
|
+
|
|
31
|
+
:param code: A string containing a CSS stylesheet.
|
|
32
|
+
:param filename: Optional filename to be used in parser error messages.
|
|
33
|
+
:param error_recovery: Whether or not to omit broken CSS rather than
|
|
34
|
+
producing a parse error. Enable with caution!
|
|
35
|
+
:param parser_flags: An optional flag created by `calc_parser_flags()`.
|
|
36
|
+
See that function for more details.
|
|
37
|
+
:param unused_symbols: An optional set of known unused symbols, like
|
|
38
|
+
classnames, ids, or keyframe names, to be removed from the output.
|
|
39
|
+
Note that symbols should be specified in bare form, i.e.
|
|
40
|
+
`unused_symbols={'a', 'b'}`, not `unused_symbols={'.a', '#b'}`, and
|
|
41
|
+
will remove both ids and classes if they share a name. Use with caution!
|
|
42
|
+
:param browsers_list: An optional list of browserslist targets to be used
|
|
43
|
+
to determine automatic prefixing and transpilation. If it is not
|
|
44
|
+
specified, no prefixing/transpilation will occur.
|
|
45
|
+
:param minify: Is True, the final output will be minified. Otherwise, it
|
|
46
|
+
will be pretty-printed.
|
|
47
|
+
:return: A string containing a processed CSS stylesheet.
|
|
48
|
+
"""
|
|
@@ -26,6 +26,7 @@ classifiers = [
|
|
|
26
26
|
"Programming Language :: Python :: 3.9",
|
|
27
27
|
"Programming Language :: Python :: 3.10",
|
|
28
28
|
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
29
30
|
"Topic :: Internet :: WWW/HTTP",
|
|
30
31
|
"Topic :: Software Development :: Pre-processors",
|
|
31
32
|
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|