group of common things we use across different python packages
Project description
spice_rack
A collection of building blocks for doing standard things that I use in other projects. A lot of this is just personal preference, and serves merely to prevent me from rewriting common pieces of functionality.
Fully typed and heavily reliant on pydantic v2.
Some of the subpackages
See their individual docs for more info.
bases
Extensions on pydantic's BaseModel for common use-cases such as an immutable class, or a class that is meant to be dispatched, so we can easily build polymorphic families of classes and hook into pydantic's validation framework.
Also contains a base class extending the stdlib str class that hooks into pydantic's validation framework. Helpful or improving type annotations and ensuring things like keys have standardized formatting.
fs_ops
File and directory objects that aim to abstract away the underlying file-system, which means you can do the same stuff with a FilePath instance regardless of if the path is on s3, gcs or local. Some other stuff there too regarding deferred file paths which means you can set a path as relative to an environment variable and evaluate it to a real FilePath or DirPath at some point in your control flow. Right now we only support local, gcs, and sftp, but s3 soon.
logging
Wrapper around loguru with some opinionated formatting. There are pydantic models for configuring the sinks, and custom logger class that does some formatting for you and helps with structured data.
polars service
Polars DataFrame and LazyFrame type annotations meant to integrate with pydantic's validation system, meaning I can set them as attributes on pydantic models without pydantic seeing them as 'arbitrary types'
ts service
Simplifies date-related functionality. The primary class is a subclass of int that represents epoch milliseconds. Main concept is to help with common gotchas and annoyances with dates, but this is a tough area. Likely not that useful at the moment.
gcp_auth
Helps with indicating the credentials for different gcp services. There's a lot of different ways to authenticate to GCP, and they are very helpful in getting creds from the environment, but this can make it even more confusing. I use to be declarative in how I'm authenticating and which creds I am using, without losing the convenience of Google's helpers.
Installation
pip install spice_rack[all]
there are no optional/extra dependencies, so pip install spice_rack[all] is the same pip install spice_rack at the moment
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spice_rack-0.4.1.tar.gz.
File metadata
- Download URL: spice_rack-0.4.1.tar.gz
- Upload date:
- Size: 54.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ac4636a1cd4cc03e1e757428d0eb0457de6db00f05ae8345109f6e46726f4e3
|
|
| MD5 |
eac195b5e35ac5cdc8a75f38c7ff452e
|
|
| BLAKE2b-256 |
20e035eaac6d2416d76bb4f1232a3cc08dae31e753e7e5d5382148b9cfde7fca
|
File details
Details for the file spice_rack-0.4.1-py3-none-any.whl.
File metadata
- Download URL: spice_rack-0.4.1-py3-none-any.whl
- Upload date:
- Size: 90.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4a8670d39f74a9b765358330dfece6acaaf4211e02836889e18ee9240f41194
|
|
| MD5 |
c412efdde8c281a5e66aabb25dad064f
|
|
| BLAKE2b-256 |
22aac9b6427d94d085bc88be7d71fe396907e36355623ea55306a424082a3525
|