Skip to main content

Some cute utilties for my other projects

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Warawara

A swiss-knife-like library that collects cute utilities for my other projects.

This library only depends on Python standard library and Python itself. It's functionalities will not depend on any third-party packages in a foreseeable future.

Examples:

# color strings
import warawara
warawara.orange('TEXT')   # \033[38;5;214mTEXT\033[m

# Invoke external command and retrieve the result.
p = warawara.run(['seq', '5'])
p.stdout.lines  # ['1', '2', '3', '4', '5']

# Invoke external command and retrieve the result in a non-blocking manner.
# Functions could be used as command, so they could be mixed in pipe line.
p1 = warawara.command(['seq', '5'])

def func(streams, *args):
    for line in streams[0]:
        streams[1].writeline('wara: {}'.format(line))

p2 = warawara.command(func, stdin=True)

warawara.pipe(p1.stdout, p2.stdin)
p1.run()
p2.run()
p2.stdout.lines   # ['wara: 1', 'wara: 2', 'wara: 3', 'wara: 4', 'wara: 5']

From my own perspective, Python's subprocess interface is not friendly enough for simple uses.

For more detailed API usage, see doc/warawara.md

Installation

sh$ pip3 install warawara

Or just copy the whole folder to your machine, and add the path to sys.path:

import sys
sys.path.insert(0, '/some/path/to/place/warawara')
import warawara

Test

Testing:

sh$ python3 -m unittest

With pytest-cov:

sh$ pipx install pytest-cov --include-deps

or

sh$ pipx install pytest
sh$ pipx runpip pytest install pytest-cov

sh$ pytest --cov=warawara --cov-report=html

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

warawara-0.1.0.tar.gz (52.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

warawara-0.1.0-py3-none-any.whl (44.7 kB view details)

Uploaded Python 3

File details

Details for the file warawara-0.1.0.tar.gz.

File metadata

  • Download URL: warawara-0.1.0.tar.gz
  • Upload date:
  • Size: 52.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for warawara-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a1fcd518c6ab32ab982f58f48910249bed7d967279b12dc28fb3ca3fea2ed725
MD5 120e0810b68f35aa5d3bd635a326e788
BLAKE2b-256 775a8324988785518bc110778aa69456ff72c89822ffa1c38cfb7c5891f2f5fc

See more details on using hashes here.

File details

Details for the file warawara-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: warawara-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for warawara-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f33330a02f4eca8a1f1446f227246cb465c42046424eb799357c26795a3fd58
MD5 ed03d1e28511b354ff3fa30308920ef9
BLAKE2b-256 746b7a382ca74cf19ad365f6f44d1e7aaebbccdb0bda05ff5b632eeb213397ee

See more details on using hashes here.

Supported by

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