Flashback
You've probably already implemented it.
Flashback is a collection of python utilities: it contains classes, metaclasses, decorators, functions, constants, etc. that you might have written a couple times already.
Installing
Flashback supports python 3.12+.
Pip:
pip install flashback
Uv:
uv pip install flashback
Build from sources:
git clone git@github.com:PaulRenvoise/flashback.git
cd flashback
uv build
Contents
Flashback's helpers are currently organised within 7 modules, and global helpers:
accessing/dig()recursively fetch keys and indices in a nested mapping or sequencevalues_at()retrieves values from each given keys in dictionarypick()fetches key/value pairs with given keys from a dictionary
caching/Cachesupports several cache stores: in-memory, disk, Redis, and Memcached@cachedcaches a callable's return value based on its arguments
debugging/xp()prints debug information about its given arguments@profiledcollects and dumps profiling stats over a callable's executioncaller()allows a developer to print debug information about a callable's callerget_callable()extracts a callable instance from a frameget_call_context()finds and returning the code context around a call made in a frameget_frameinfo()implements a fasterinspect.stack()[x]
formatting/oxford_join()joins strings in a human-readable waytransliterate()represents unicode text in ASCII (using Unidecode)camelize()transforms any case to camelCasepascalize()transforms any case to PascalCasesnakeize()transforms any case to snake_casekebabize()transforms any case to kebab-caseparameterize()formats a given string to be used in URLsordinalize()represents numbers in their ordinal representationsadverbize()represents numbers in their numeral adverb representationstruncate()truncates long sentences at a given limit and append a suffix if neededsingularize()returns the singular form of a given wordpluralize()returns the plural form of a given word
iterating/renumerate()enumerates an iterable starting from its endchunks()splits an iterable into smaller chunks, padding them if requestedpartition()splits an iterable into items validating a predicate and the ones that don'tuniq()removes duplicates from an iterable while keeping the items' orderuniq_by()removes duplicates defined via a user-supplied callable from an iterable while keeping the items' ordercompact()removes None values from an iterableflatten()unpacks nested iterable into the given iterableflat_map()applies a function to every item and nested item of the given iterable
i16g/Localedynamically loads localization files from a package path
importing/import_class_from_path()fetches a class from a package path and returns itimport_module_from_path()exposes the contents of a module as globals from a package path
logging/DEFAULT_CONSOLE_CONFIGURATIONlogs to stderr with a sensible set of informationDJANGO_CONSOLE_CONFIGURATIONlogs to stderr with the same formatting as Django's loggerFLASK_CONSOLE_CONFIGURATIONlogs to stderr with the same formatting as Flask's loggerPYRAMID_CONSOLE_CONFIGURATIONlogs to stderr with the same formatting as Pyramid's loggerRAILS_CONSOLE_CONFIGURATIONlogs to stderr with the same formatting as RoR's loggerAffixedStreamHandlerallows custom affixes to log records@mutedsilences all (or selected) loggers during a callable's execution
EncryptedFileexposes a mechanism to read and write encrypted contents to a fileBorgexposes a class useful to produce a singleton behaviour across multiple instancesSentinelexposes a class that can be used to implement the Sentinel design patternSingletonexposes a metaclass useful to implement the Singleton design pattern@classpropertycombines @classmethod and @property (with support for @attr.setter)@deprecateddocuments deprecated callables with a explicit message@retryableretries failing executing of a callable@sampledimplements sampling strategies to filter calls made to a callable@timedmeasures and prints the execution time of a callable@timeoutablestops the execution of a callable if its run time is too long
Contributing
The Pull Request template has a checklist containing everything you need to submit a new PR.
Run the tests with:
uv run pytest tests
Run the typechecker with:
uv run pyrefly check flashback tests
Run the lint with:
uv run ruff check flashback tests
Run the formatter with:
uv run ruff format flashback tests
License
Flashback is released under the MIT License.
Metadata
Release files for flashback 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| flashback-4.1.0.tar.gz | 54.4 kB | Without provenance | Details for flashback-4.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flashback-4.1.0-py3-none-any.whl | Python 3 | none | any | Details for flashback-4.1.0-py3-none-any.whl |
Total release size: 137.9 kB
Release files / flashback-4.1.0.tar.gz
| Download URL | flashback-4.1.0.tar.gz |
|---|---|
| Size | 54.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a4390d3cf58b9e045cf122f558b9eb010468192ada71cee1d24709b84de9bf9
|
|
BLAKE2b-256 checksum How to use checksums |
2926bc133c057a8391ca8849e94ef7233d8d8ae7f5ed171a6640e2bc9c481228
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / flashback-4.1.0-py3-none-any.whl
| Download URL | flashback-4.1.0-py3-none-any.whl |
|---|---|
| Size | 83.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03091af98d80bfb09764e5b33e0ed6d425d331febef23a00a84651d27a161e65
|
|
BLAKE2b-256 checksum How to use checksums |
cd4e05ca2e604eb30ac0eea14ca96a834f1ff553ec0e22bca52e4b872636c916
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for flashback 4.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.