highlighter
Easy to use PEP 508 markers. These are the strings in requirements after a
semicolon, such as enum34; python_version < '3.5' means the package enum34
but only on some versions of python.
from packaging.markers import Marker
from packaging.requirements import Requirement
from highlighter import EnvironmentMarkers
req = Requirement("enum34; python_version < '3.5'")
env = EnvironmentMarkers.for_python("3.7.5", "win32")
env.match(req.marker) # False
# Lower-level interface, you can use Marker directly
m = Marker("python_version < '3.5'")
env.match(m) # False
# What about extras?
req = Requirement("somepackage[foo,bar]")
m = Marker("extra == 'foo'")
env.match(m, extras=req.extras) # True
Egg-info Extras
This also includes a function that can convert a requires.txt (as found in egg-info dirs, the only kind we have in sdists) into an equivalent list of requirements.txt lines using PEP 508 markers.
from highlighter.sdist import convert_sdist_requires
convert_sdist_requires("""\
[socks]
PySocks!=1.5.7,>=1.5.6
[socks:sys_platform == "win32" and python_version == "2.7"]
win_inet_pton
""") == """\
PySocks!=1.5.7,>=1.5.6; extra == 'socks'
win_inet_pton; (sys_platform == "win32" and python_version == "2.7") and extra == 'socks'
"""
License
highlighter is copyright Tim Hatch, and licensed under
the MIT license. I am providing code in this repository to you under an open
source license. This is my personal repository; the license you receive to
my code is from me and not from my employer. See the LICENSE file for details.
Metadata
Release files for highlighter 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| highlighter-0.2.0.tar.gz | 7.2 kB | Without provenance | Details for highlighter-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| highlighter-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for highlighter-0.2.0-py3-none-any.whl |
Total release size: 13.7 kB
Release files / highlighter-0.2.0.tar.gz
| Download URL | highlighter-0.2.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c32c8636e4e862d9415f665b4cba108418a5649485183f61da2de96d5d9734b
|
|
BLAKE2b-256 checksum How to use checksums |
d5fcd5d1e8b1fb9468efab7ca0f1955376448ca135d6c0b78259288f751ab1a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / highlighter-0.2.0-py3-none-any.whl
| Download URL | highlighter-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08206ab8c0e0b6c8f77e9184df743bc7189a22e7ea062cc084d5f05a139d6a7f
|
|
BLAKE2b-256 checksum How to use checksums |
b14898b0951b8250bf82c73859299fddf2f94c4f0faced1eef583caea64a16c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for highlighter 0.2.0
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.