("yoots"): imports and utilities for easy wildcard-importing + boilerplate-reduction
pip install utz
Import everything:
from utz import *
See __init__.py
, which imports many of the modules below, as well as many standard-library methods and objects (via the stdlb
package).
Some noteworthy modules:
- cd: "change directory" contextmanager
- o:
dict
wrapper exposing keys as attrs (e.g.:o({'a':1}).a == 1
) - process:
subprocess
wrappers; shell out to commands, parse output - docker: DSL for programmatically creating Dockerfiles (and building images from them)
- ssh: SSH tunnel wrapped in a context manager
- time:
now()
/today()
helpers with convenient / no-nonsense ISO string serialization and UTC bias - bases:
int
⟺str
codecs with improvements over standard base64 et al. - tmpdir: make temporary directories with a specific basename
- context: contextmanager helpers, including
ctxs
for composing multiple context managers - escape: escaping split/join helpers
- backoff: exponential-backoff utility
- git: Git helpers, wrappers around GitPython
- pnds: pandas imports and helpers
- collections: collection/list helpers
- plots: plotly helpers
utz/setup.py
provides defaults for various setuptools.setup()
params:
name
: use parent directory nameversion
: parse from git tag (otherwise fromgit describe --tags
)author_{name,email}
: infer from last commitlong_description
: parseREADME.md
(and set `long_description_content_type)description
: parse first<p>
under opening<h1>
fromREADME.md
license
: parse fromLICENSE
file (MIT and Apache v2 supported)
For an example, see gsmo==0.0.1
(and corresponding release).
This library also "self-hosts" using its own setup
helper; see pyproject.toml:
[build-system]
requires = ["setuptools", "utz[setup]==0.4.2", "wheel"]
build-backend = "setuptools.build_meta"
and setup.py:
from utz.setup import setup
extras_require = {
# …
}
# Various fields auto-populated from git, README.md, requirements.txt, …
setup(
name="utz",
version="0.8.0",
extras_require=extras_require,
url="https://github.com/runsascoded/utz",
python_requires=">=3.10",
)
The setup
helper can be installed via a pip "extra":
pip install utz[setup]