Skip to main content

yakutils

Yakutils is yet another toolbox of Python helper functions.

This package is available on PyPi, but its primary purpose is to allow one (me) to copy these into projects or to prevent one (me as well) from needing to Google how to write them (I'm looking at you csv.DictReader and csv.DictWriter).

This project is a continuous work-in-progress, and while its contents are specific to stuff that I use, pull requests are certainly welcome.

Installation

To download using pip via PyPi:

$ pip install yakutils

Usage Examples:

>>> from yakutils import read_csv
>>> read_csv('/path/to/data.csv')
[
  {
    'name': 'Tomatillo',
    'age': 27
  },
  # ...
]

>>> import datetime as dt
>>> from yakutils import date_to_iso8601
>>> date_to_iso8601(dt.date.today())
'2020-01-26T00:00:00Z'

>>> from yakutils import datetime_to_iso8601
>>> datetime_to_iso8601(dt.datetime.utcnow())
'2020-01-26T19:04:40.219668Z'

>>> from yakutils import datetime_to_unixtimestamp
>>> datetime_to_unixtimestamp(dt.datetime.utcnow())
1580065524

>>> from yakutils import iso8601_to_datetime
>>> iso8601_to_datetime('2020-01-26T19:04:40.219668Z')
datetime.datetime(2020, 1, 26, 19, 4, 40, 219668)

>>> import json
>>> from decimal import Decimal
>>> from yakutils import json_defaults
>>> json.dumps({
...   'now': dt.datetime.utcnow(),
...   'today': dt.date.today(),
...   'time': dt.time(1,2,3),
...   'num': Decimal(2.777),
...}, default=json_defaults)
'{"now": "2020-01-28T01:10:37.599281Z", "today": "2020-01-27", "time": "01:02:03", "num": 2.777}'

>>> from yakutils import random_string
>>> random_string(20)
'k4a9ue7TDjOC3p3oN0dl'

>>> from yakutils import update_qs
>>> update_qs('https://nickficano.com.com/?q=asdf&pi=3.14', pi=6.28)
'https://nickficano.com.com/?q=asdf&pi=6.28'

For complete list of utility functions, see: https://yakutils.readthedocs.io/en/latest/.

Metadata

Release files for yakutils 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yakutils 2.0.0
File Size Uploaded
yakutils-2.0.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yakutils 2.0.0
File Interpreter ABI Platform
yakutils-2.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.9 kB

Release files / yakutils-2.0.0.tar.gz

Download URL yakutils-2.0.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1a666fddd59e5243d86e6c4132587f1339e722c7624cbb7ac43ca26fdef00e41
BLAKE2b-256 checksum
How to use checksums
118807a00f06da63cb9b62ab7d3c2d033af11be42c818752861c44985692aeb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2

Release files / yakutils-2.0.0-py3-none-any.whl

Download URL yakutils-2.0.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
438783abc3191d2017df98af05faf816c06bcae3eb5f5224139c58d03c9e953e
BLAKE2b-256 checksum
How to use checksums
0f2a144c9c7c38030a0cee484878475c8db29c158d7ab2e105299953e1672824
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.10.2

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files

1.7.0

1 release file

1.6.0

1 release file

1.5.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.9

1 release file

1.1.8

1 release file

1.1.7

1 release file

1.1.6

1 release file

1.1.5

1 release file

1.1.4

1 release file

1.1.3

1 release file

1.1.2

1 release file

1.1.1

1 release file

1.1.0

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page