kgcss 1.0.0__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.
- kgcss-1.0.0/LICENSE +28 -0
- kgcss-1.0.0/MANIFEST.in +3 -0
- kgcss-1.0.0/PKG-INFO +55 -0
- kgcss-1.0.0/README.md +33 -0
- kgcss-1.0.0/csrc/color.c +1103 -0
- kgcss-1.0.0/csrc/kgcss.h +99 -0
- kgcss-1.0.0/csrc/module.c +155 -0
- kgcss-1.0.0/csrc/objects.h +165 -0
- kgcss-1.0.0/csrc/properties.c +194 -0
- kgcss-1.0.0/csrc/select.c +1485 -0
- kgcss-1.0.0/csrc/selectors.c +1020 -0
- kgcss-1.0.0/csrc/selectors.h +55 -0
- kgcss-1.0.0/csrc/serialize.c +148 -0
- kgcss-1.0.0/csrc/syntax.c +833 -0
- kgcss-1.0.0/csrc/tokenizer.c +158 -0
- kgcss-1.0.0/csrc/tokenizer_impl.h +512 -0
- kgcss-1.0.0/csrc/tokens.h +167 -0
- kgcss-1.0.0/csrc/types.c +657 -0
- kgcss-1.0.0/csrc/urls.c +193 -0
- kgcss-1.0.0/csrc/values.c +376 -0
- kgcss-1.0.0/csrc/writer.c +983 -0
- kgcss-1.0.0/pyproject.toml +144 -0
- kgcss-1.0.0/setup.cfg +4 -0
- kgcss-1.0.0/setup.py +73 -0
- kgcss-1.0.0/src/kgcss/__init__.py +161 -0
- kgcss-1.0.0/src/kgcss/_encodings.py +411 -0
- kgcss-1.0.0/src/kgcss/_kgcss.pyi +284 -0
- kgcss-1.0.0/src/kgcss/_version.py +3 -0
- kgcss-1.0.0/src/kgcss/colors.py +133 -0
- kgcss-1.0.0/src/kgcss/compat.py +924 -0
- kgcss-1.0.0/src/kgcss/cssom/__init__.py +103 -0
- kgcss-1.0.0/src/kgcss/cssom/build.py +389 -0
- kgcss-1.0.0/src/kgcss/cssom/declarations.py +610 -0
- kgcss-1.0.0/src/kgcss/cssom/exceptions.py +29 -0
- kgcss-1.0.0/src/kgcss/cssom/imports.py +255 -0
- kgcss-1.0.0/src/kgcss/cssom/rules.py +1081 -0
- kgcss-1.0.0/src/kgcss/cssom/selector_list.py +402 -0
- kgcss-1.0.0/src/kgcss/cssom/serializer.py +871 -0
- kgcss-1.0.0/src/kgcss/cssom/state.py +149 -0
- kgcss-1.0.0/src/kgcss/cssom/stylesheet.py +358 -0
- kgcss-1.0.0/src/kgcss/cssom/urls.py +290 -0
- kgcss-1.0.0/src/kgcss/cssom/values.py +381 -0
- kgcss-1.0.0/src/kgcss/decode.py +121 -0
- kgcss-1.0.0/src/kgcss/enums.py +40 -0
- kgcss-1.0.0/src/kgcss/escaping.py +18 -0
- kgcss-1.0.0/src/kgcss/fonts.py +242 -0
- kgcss-1.0.0/src/kgcss/grammar.py +282 -0
- kgcss-1.0.0/src/kgcss/matching.py +127 -0
- kgcss-1.0.0/src/kgcss/media.py +461 -0
- kgcss-1.0.0/src/kgcss/py.typed +0 -0
- kgcss-1.0.0/src/kgcss/selectors.py +528 -0
- kgcss-1.0.0/src/kgcss/shorthands.py +296 -0
- kgcss-1.0.0/src/kgcss/syntax.py +86 -0
- kgcss-1.0.0/src/kgcss/tokenizer.py +14 -0
- kgcss-1.0.0/src/kgcss.egg-info/PKG-INFO +55 -0
- kgcss-1.0.0/src/kgcss.egg-info/SOURCES.txt +117 -0
- kgcss-1.0.0/src/kgcss.egg-info/dependency_links.txt +1 -0
- kgcss-1.0.0/src/kgcss.egg-info/top_level.txt +1 -0
- kgcss-1.0.0/tests/__init__.py +0 -0
- kgcss-1.0.0/tests/conftest.py +28 -0
- kgcss-1.0.0/tests/css-parsing-tests/An+B.json +158 -0
- kgcss-1.0.0/tests/css-parsing-tests/LICENSE +8 -0
- kgcss-1.0.0/tests/css-parsing-tests/README.rst +296 -0
- kgcss-1.0.0/tests/css-parsing-tests/VENDORED +1 -0
- kgcss-1.0.0/tests/css-parsing-tests/blocks_contents.json +63 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_function_4.json +221 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_functions_5.json +22 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_hexadecimal_3.json +83 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_hexadecimal_4.json +326 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_hsl_3.json +258 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_hsl_4.json +502 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_hwb_4.json +502 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_keywords_3.json +162 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_keywords_4.json +3 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_lab_4.json +1502 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_lch_4.json +1502 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_oklab_4.json +1502 -0
- kgcss-1.0.0/tests/css-parsing-tests/color_oklch_4.json +1502 -0
- kgcss-1.0.0/tests/css-parsing-tests/component_value_list.json +443 -0
- kgcss-1.0.0/tests/css-parsing-tests/declaration_list.json +44 -0
- kgcss-1.0.0/tests/css-parsing-tests/one_component_value.json +27 -0
- kgcss-1.0.0/tests/css-parsing-tests/one_declaration.json +40 -0
- kgcss-1.0.0/tests/css-parsing-tests/one_rule.json +36 -0
- kgcss-1.0.0/tests/css-parsing-tests/rule_list.json +48 -0
- kgcss-1.0.0/tests/css-parsing-tests/stylesheet.json +44 -0
- kgcss-1.0.0/tests/css-parsing-tests/stylesheet_bytes.json +146 -0
- kgcss-1.0.0/tests/data/css_selectors_shakespeare.html +309 -0
- kgcss-1.0.0/tests/selector_oracle.py +330 -0
- kgcss-1.0.0/tests/strategies.py +67 -0
- kgcss-1.0.0/tests/suite.py +186 -0
- kgcss-1.0.0/tests/test_colors.py +669 -0
- kgcss-1.0.0/tests/test_compat.py +252 -0
- kgcss-1.0.0/tests/test_css_parsing_suite.py +170 -0
- kgcss-1.0.0/tests/test_cssom_declarations.py +404 -0
- kgcss-1.0.0/tests/test_cssom_imports.py +404 -0
- kgcss-1.0.0/tests/test_cssom_mutation.py +430 -0
- kgcss-1.0.0/tests/test_cssom_properties.py +359 -0
- kgcss-1.0.0/tests/test_cssom_rules.py +443 -0
- kgcss-1.0.0/tests/test_cssom_serialize.py +431 -0
- kgcss-1.0.0/tests/test_cssom_urls.py +154 -0
- kgcss-1.0.0/tests/test_cssom_values.py +212 -0
- kgcss-1.0.0/tests/test_decode.py +150 -0
- kgcss-1.0.0/tests/test_fonts.py +260 -0
- kgcss-1.0.0/tests/test_grammar.py +167 -0
- kgcss-1.0.0/tests/test_media.py +397 -0
- kgcss-1.0.0/tests/test_native.py +26 -0
- kgcss-1.0.0/tests/test_properties.py +231 -0
- kgcss-1.0.0/tests/test_readme.py +14 -0
- kgcss-1.0.0/tests/test_safety.py +144 -0
- kgcss-1.0.0/tests/test_select.py +792 -0
- kgcss-1.0.0/tests/test_select_vs_css_selectors.py +168 -0
- kgcss-1.0.0/tests/test_selectors.py +969 -0
- kgcss-1.0.0/tests/test_serialize.py +55 -0
- kgcss-1.0.0/tests/test_shorthands.py +412 -0
- kgcss-1.0.0/tests/test_syntax.py +355 -0
- kgcss-1.0.0/tests/test_threads.py +549 -0
- kgcss-1.0.0/tests/test_tokenizer.py +361 -0
- kgcss-1.0.0/tests/test_values.py +222 -0
- kgcss-1.0.0/tests/test_writer.py +218 -0
kgcss-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Kovid Goyal <kovid at kovidgoyal.net>
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
kgcss-1.0.0/MANIFEST.in
ADDED
kgcss-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kgcss
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Fast and comprehensive CSS handling: tokenizing, parsing, a mutable object model, serialization, selector matching, media queries, colors, fonts and shorthands, with a C99 backend
|
|
5
|
+
Author-email: Kovid Goyal <kovid@kovidgoyal.net>
|
|
6
|
+
License-Expression: BSD-3-Clause
|
|
7
|
+
Project-URL: Documentation, https://kgcss.readthedocs.io
|
|
8
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
9
|
+
Classifier: Programming Language :: C
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
14
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
15
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
16
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.14
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# kgcss
|
|
24
|
+
|
|
25
|
+
[](https://github.com/kovidgoyal/kgcss/actions/workflows/ci.yml)
|
|
26
|
+
[](https://kgcss.readthedocs.io/en/latest/)
|
|
27
|
+
[](https://pypi.org/project/kgcss/)
|
|
28
|
+
[](https://pypi.org/project/kgcss/)
|
|
29
|
+
|
|
30
|
+
A fast and comprehensive CSS library for Python, with a C99 backend. It
|
|
31
|
+
parses CSS as browsers do, gives a mutable object model of sheets, rules,
|
|
32
|
+
selectors, declarations and values, and writes it back, reformatted or
|
|
33
|
+
byte for byte. It also rewrites URLs and handles `@import`, matches
|
|
34
|
+
Selectors Level 4 against lxml and ElementTree trees, and covers media
|
|
35
|
+
queries, colors, fonts and shorthand properties. It runs on regular and
|
|
36
|
+
free-threaded Python 3.14 and later.
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
>>> import kgcss
|
|
40
|
+
>>> sheet = kgcss.parse_stylesheet('a { color: #ff0000; margin: 0px }')
|
|
41
|
+
>>> print(sheet.css_text)
|
|
42
|
+
a {
|
|
43
|
+
color: #f00;
|
|
44
|
+
margin: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Documentation: <https://kgcss.readthedocs.io>**: installation, a guide to
|
|
50
|
+
every part, the API reference, migrating from css_parser, tinycss and
|
|
51
|
+
css_selectors, and development.
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
BSD 3-Clause. See [LICENSE](LICENSE).
|
kgcss-1.0.0/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# kgcss
|
|
2
|
+
|
|
3
|
+
[](https://github.com/kovidgoyal/kgcss/actions/workflows/ci.yml)
|
|
4
|
+
[](https://kgcss.readthedocs.io/en/latest/)
|
|
5
|
+
[](https://pypi.org/project/kgcss/)
|
|
6
|
+
[](https://pypi.org/project/kgcss/)
|
|
7
|
+
|
|
8
|
+
A fast and comprehensive CSS library for Python, with a C99 backend. It
|
|
9
|
+
parses CSS as browsers do, gives a mutable object model of sheets, rules,
|
|
10
|
+
selectors, declarations and values, and writes it back, reformatted or
|
|
11
|
+
byte for byte. It also rewrites URLs and handles `@import`, matches
|
|
12
|
+
Selectors Level 4 against lxml and ElementTree trees, and covers media
|
|
13
|
+
queries, colors, fonts and shorthand properties. It runs on regular and
|
|
14
|
+
free-threaded Python 3.14 and later.
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
>>> import kgcss
|
|
18
|
+
>>> sheet = kgcss.parse_stylesheet('a { color: #ff0000; margin: 0px }')
|
|
19
|
+
>>> print(sheet.css_text)
|
|
20
|
+
a {
|
|
21
|
+
color: #f00;
|
|
22
|
+
margin: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Documentation: <https://kgcss.readthedocs.io>**: installation, a guide to
|
|
28
|
+
every part, the API reference, migrating from css_parser, tinycss and
|
|
29
|
+
css_selectors, and development.
|
|
30
|
+
|
|
31
|
+
## License
|
|
32
|
+
|
|
33
|
+
BSD 3-Clause. See [LICENSE](LICENSE).
|