Skip to main content

*("yoots")*: imports and utilities for easy wildcard-importing + boilerplate-reduction

Project description

utz

("yoots"): imports and utilities for easy wildcard-importing + boilerplate-reduction

Install

pip install utz

Use

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).

Features

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: intstr 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

auto-setup.py

utz/setup.py provides defaults for various setuptools.setup() params:

  • name: use parent directory name
  • version: parse from git tag (otherwise from git describe --tags)
  • author_{name,email}: infer from last commit
  • long_description: parse README.md (and set `long_description_content_type)
  • description: parse first <p> under opening <h1> from README.md
  • license: parse from LICENSE 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]

Project details


Release history Release notifications | RSS feed

This version

0.8.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

utz-0.8.1.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

utz-0.8.1-py3-none-any.whl (49.6 kB view details)

Uploaded Python 3

File details

Details for the file utz-0.8.1.tar.gz.

File metadata

  • Download URL: utz-0.8.1.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for utz-0.8.1.tar.gz
Algorithm Hash digest
SHA256 57c6403f7689ae1bc5b1e84efd32039a32f863d79c0646f569224b4e02ec476b
MD5 4c90bc8540b870225c97c9c19fb4c1d6
BLAKE2b-256 cc853d89c0ab4ed60f4ebe1d179c951b0debb8a44f52365187cb837172ea6755

See more details on using hashes here.

File details

Details for the file utz-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: utz-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 49.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for utz-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a415c8dc6a9d6ae96a4b20c5b98fef7317c11f0a07e2e8c21235446ce92709f
MD5 41f3aceb22c9e3f3b0c55f2c364be6ac
BLAKE2b-256 d73de16c35223545650573f80d758cecca87333cea72e6a70ed0232a72f38cd0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page