Wonderful Wrappers: unobtrusive wrappers improving Python builtins and more
Compatibility: CPython 2.7+/3.3+ and the last stable versions of pypy2.
Platform: Agnostic. But only tested on GNU/Linux for now.
Version: 0.2
Install with:
pip install ww
Ever wish you could…
lazily slice generators?
>>> from ww import g >>> gen = g(x * x for x in range(100)) >>> gen <IterableWrapper generator> >>> for element in g(x * x for x in range(100))[3: 6]: ... print(element) ... 9 16 25
add dictionaries?
>>> from ww import d
>>> dic = d({'a': 1})
>>> dic
{'a': 1}
>>> dic + {'b': 2}
{'b': 2, 'a': 1}
have a len attribute on lists?
>>> from ww import l >>> lst = l([1, 2, 3]) >>> lst [1, 2, 3] >>> lst.len 3
join() from tuple?
>>> from ww import t
>>> tpl = t((1, 2, 3))
>>> tpl
(1, 2, 3)
>>> tpl.join(',') # oh, it also autocasts to string. And its configurable.
u'1,2,3'
replace() multiple caracters at once in a string?
>>> from ww import s
>>> string = s('fizz buzz')
>>> string # strings try very hard to be consistent on Python 2 and 3
u'fizz buzz'
>>> string.replace(('i', 'u'), 'o') # the original signature is ok too
u'fozz bozz'
And there are many, many, more goodies.
WARNING
The software is currently in early stage. Only s() and g() are considered well documented and tested, and even them deserve some more love. You’ll also meet some empty files for future ideas.
We choose to make an early release under the pressing request of colleagues eager to try it but it’s not the final product. Quality is on the way.
Also, we WILL break the API until we reach 1.0, from which we’ll switch to semver and secure the API.
Development
You can offer PR with your contributions to ww. They should include unit tests, docstrings, type definitions and a new entry in the documentation. And follow the style conventions:
Python: PEP8
Docstrings: Google style
Get the full repository:
git clone https://github.com/Tygs/ww.git
And move inside the ww directory.
Install ww and the dependancies for dev:
python setup.py develop pip install -r dev-requirements.txt
Deactivate dev mode:
python setup.py develop –uninstall
Running unit tests on your current Python:
python setup.py test
Run tests coverage with your current Python:
# cmd only coverage py.test --cov ww tests # dump an HTML report in htmlcov dir py.test --cov-report html --cov ww tests
We have many test environements to build the doc, validate the code against various checkers and linters or run unit tests on several Python interpreters.
You can list them all with:
tox -l
E.G:
$ tox -l flake8 py35 py34 py33 py27 pypy2 doc coverage mypy bandit
You can run them individually with:
tox -e env_name
E.G:
tox -e doc # builds the documentation
All envs with a name starting with “py” requires that you have the matching Python interpreter installed on your system to be ran.
- E.G: py33 requires you to have CPython 3.3 installed on your machine, and pypy2
supposes you have PyPy2 on your machine.
The mypy, bandit and doc env require you to have Python3.5 installed.
Running all the tests in all envs can be done with:
tox
Before you do a PR, it’s better if you can do this, since it will run the the most tests. But remember if you don’t have the matching interpreters they will be skipped.
In any case, running the checkers and linters is strongly advised, as any PR failing them will be rejected.
Versioning scheme
Versioning follow SemVer, althoug we won’t commit to stability before version 1.0.
Release with X.Y.Z will be of 2 kinds:
if Y is odd, the release will add features.
if Y is even or Z > 0, the release will be dedicated to bug fixing, documentation, API improvment and performances.
E.G.:
0.2.1: 1 > 0 so no new features.
1.4.1: 4 is even, so no new features.
2.1.0: 1 is odd, you may see new feature in this release.
Metadata
Release files for ww 0.2.1
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 |
|---|---|---|---|---|
| ww-0.2.1.tar.gz | 28.8 kB | Without provenance | Details for ww-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ww-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for ww-0.2.1-py3-none-any.whl |
Total release size: 73.7 kB
Release files / ww-0.2.1.tar.gz
| Download URL | ww-0.2.1.tar.gz |
|---|---|
| Size | 28.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3664f1f91bf927fe597ab153e8df73c8954927258b3737220efd1cb9912ebd7e
|
|
BLAKE2b-256 checksum How to use checksums |
aa90522658f7a9707395a00a98f82389fc006989c5ed68c72aa043b9289c447a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / ww-0.2.1-py3-none-any.whl
| Download URL | ww-0.2.1-py3-none-any.whl |
|---|---|
| Size | 44.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02d2b9ea134317901c889fc844958630f478b5d1a98d5938ce787cf92d02b8ed
|
|
BLAKE2b-256 checksum How to use checksums |
54f25a43036cb61ce29a49b99a53c7d0fb68a4274467064ff77c5feafca03177
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for ww 0.2.1
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.