pythonwrench

Set of tools for Python that could be in the standard library.

https://github.com/labbeti/pythonwrench

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

python tools utilities
Last synced: 6 months ago · JSON representation ·

Repository

Set of tools for Python that could be in the standard library.

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 4
Topics
python tools utilities
Created 8 months ago · Last pushed 6 months ago
Metadata Files
Readme Changelog License Citation

README.md

pythonwrench

Python Build Documentation Status Set of tools for Python that could be in the standard library.

Installation

With pip: bash pip install pythonwrench

With uv: bash uv add pythonwrench

This library has been tested on all Python versions 3.8 - 3.13, requires only typing_extensions>=4.10.0, and runs on Linux, Mac and Windows systems.

Examples

Collections

Provides functions to facilitate iterables processing, like unzip :

```python

import pythonwrench as pw

listoftuples = [(1, "a"), (2, "b"), (3, "c"), (4, "d")] pw.unzip(listoftuples) ... [1, 2, 3, 4], ["a", "b", "c", "d"] pw.flatten(listoftuples) ... [1, "a", 2, "b", 3, "c", 4, "d"] ```

... or mathematical functions like prod or argmax :

```python

import pythonwrench as pw

values = [3, 1, 6, 4] pw.prod(values) ... 72 pw.argmax(values) ... 2 pw.is_sorted(values) ... False ```

Easely converts common python structures like list of dicts to dict of lists :

```python

import pythonwrench as pw

listofdicts = [{"a": 1, "b": 2}, {"a": 3, "b": 4}] pw.listdicttodictlist(listofdicts) ... {"a": [1, 3], "b": [2, 4]} ```

... or dict of dicts : ```python

import pythonwrench as pw

dictofdicts = {"a": {"x": 1, "y": 2}, "b": {"x": 3, "y": 4}} pw.flatdictofdict(dictof_dicts) ... {"a.x": 1, "a.y": 2, "b.x": 3, "b.y": 4} ```

Typing

Check generic types with ìsinstance_generic` :

```python

import pythonwrench as pw

Behaves like builtin isinstance() :

pw.isinstance_generic({"a": 1, "b": 2}, dict) ... True

But works with generic types !

pw.isinstancegeneric({"a": 1, "b": 2}, dict[str, int]) ... True pw.isinstancegeneric({"a": 1, "b": 2}, dict[str, str]) ... False ```

... or check specific methods with protocols classes beginning with Supports ```python

import pythonwrench as pw

Combines Iterable and Sized !

isinstance({"a": 1, "b": 2}, pw.SupportsGetitemLen) ... True isinstance({"a": 1, "b": 2}, pw.SupportsIterLen) ... True ```

Finally, you can also force argument type checking with check_args_types function :

```python

import pythonwrench as pw

@pw.checkargstypes def f(a: int, b: str) -> str: return a * b

f(1, "a") # pass check f(1, 2) # raises TypeError from decorator ```

Disk caching (memoize)

```python

import pythonwrench as pw

@pw.diskcachedecorator def heavy_processing(): # Lot of stuff here ...

data1 = heavyprocessing() # first call function is called and the result is stored on disk data2 = heavyprocessing() # second call result is loaded from disk directly ```

Semantic versionning parsing

```python

import pythonwrench as pw version = pw.Version("1.12.2") version.totuple() ... (1, 12, 2) version = pw.Version("0.5.1-beta+linux") version.totuple() ... (0, 5, 1, "beta", "linux")

Version("1.3.1") < Version("1.4.0") ... True ```

Serialization

```python

import pythonwrench as pw

listofdicts = [{"a": 1, "b": 2}, {"a": 3, "b": 4}] pw.dumpcsv(listofdicts, "data.csv") pw.dumpjson(listofdicts, "data.json") pw.loadjson("data.json") == listof_dicts ... True ```

Contact

Maintainer: - Étienne Labbé "Labbeti": labbeti.pub@gmail.com

Owner

  • Name: Labbeti
  • Login: Labbeti
  • Kind: user
  • Location: Toulouse, France
  • Company: IRIT

PhD student at IRIT (Institut de Recherche en Informatique de Toulouse), working mainly on Automated Audio Captioning.

Citation (CITATION.cff)

# -*- coding: utf-8 -*-

cff-version: 1.2.0
title: pythonwrench
message: 'If you use this software, please cite it as below.'
type: software
authors:
  - given-names: Étienne
    family-names: Labbé
    email: labbeti.pub@gmail.com
    affiliation: IRIT
    orcid: 'https://orcid.org/0000-0002-7219-5463'
repository-code: 'https://github.com/Labbeti/pythonwrench/'
abstract: Set of tools for Python that could be in the standard library.
keywords:
  - python
  - tools
  - utilities
license: MIT
version: 0.4.0
date-released: '2025-07-18'

GitHub Events

Total
  • Release event: 3
  • Delete event: 1
  • Public event: 1
  • Push event: 63
  • Pull request event: 9
  • Create event: 6
Last Year
  • Release event: 3
  • Delete event: 1
  • Public event: 1
  • Push event: 63
  • Pull request event: 9
  • Create event: 6

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 minutes
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 5
  • Average time to close issues: N/A
  • Average time to close pull requests: 2 minutes
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • Labbeti (9)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,423 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 4
  • Total maintainers: 1
pypi.org: pythonwrench

Set of tools for Python that could be in the standard library.

  • Homepage: https://pypi.org/project/pythonwrench/
  • Documentation: https://pythonwrench.readthedocs.io/
  • License: MIT License Copyright (c) 2025 Labbeti Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  • Latest release: 0.4.0
    published 7 months ago
  • Versions: 4
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 1,423 Last month
Rankings
Dependent packages count: 9.0%
Average: 29.7%
Dependent repos count: 50.5%
Maintainers (1)
Last synced: 6 months ago