A tiny compatibility module for cross-Python2/3 code
Project description
darlog-py23
A tiny compatibility module for cross-Python2/3 code.
It's not a replacement for neither six
nor __future__
modules but is more of an extension to them.
Currently, defines only a few functions:
Contents
to_least_str
Converts the given value to a string:
- Python 2: tries to turn to a
str
,unicode
if fails. - Python 3: just an alias for
str()
.
@dataclass
decorator
Tries to use the built-in decorator from Py3.10, falls back to 3.7 implementation and, finally, to attr.s
if available.
If none of those is found, applies a dummy decorator (which does nothing) - just to avoid exceptions.
@attrs
decorator
Similarly, tries to use attr.s
and falls back to built-in dataclass
(if available) or just a dummy decorator as a last resort.
Installation
python -m pip install -U darlog-py23
Development
You can clone the git repo and add the contents of src/
directory to your python installation by running this command in the repo root:
python -m pip install -e .[dev]
The version is specified in the main __init__.py
file. To update the binary distribution (wheel), run:
python setup.py bdist_wheel sdist
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for darlog_py23-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4f830840be7dacf8cb57841dbfee542cb629edd3f4a62a6714aaa1063e2321f |
|
MD5 | 875e603cb1993faaf93edea52e4558b8 |
|
BLAKE2b-256 | 364af83f4a464a4cb254d0816c0418813f9f0f0afec8160161abc6ed6d6ca183 |