Common utilities to ease development of Python packages
Project description
- documentation:
- contributions:
Please join https://github.com/cokelaer/easydev
- source:
Please use https://github.com/cokelaer/easydev
- issues:
Please use https://github.com/cokelaer/easydev/issues
- Python version supported:
3.9, 3.10, 3.11, 3.12, 3.13, 3.14
Overview
The easydev package provides miscellaneous utility functions and classes that are repeatedly useful during the development of Python packages. The goal is to help developers speed up their work by providing ready-to-use tools for common tasks such as parameter validation, logging, progress bars, configuration files, multiprocessing, and more.
It has been used as an incubator for other packages (e.g., colormap) and is used in projects such as bioservices, sequana, and GDSCTools.
Installation
Install the latest release from PyPI:
pip install easydev
Features
Parameter validation – check_param_in_list, check_range
Dictionary utilities – swapdict, AttrDict (access dict keys as attributes, supports nested dicts)
Logging – coloured logging via Logging class
Progress bar – Progress works in Python, IPython, and Jupyter notebooks
Timer – measure elapsed time with the Timer context manager
Profiling – do_profile decorator using line_profiler
Configuration files – CustomConfig and DynamicConfigParser for INI-style config management
Shell commands – shellcmd and execute wrappers around subprocess/pexpect
File utilities – touch, mkdirs, md5
Multiprocessing – MultiProcessing class for easy parallel job execution
Codecs – to_list, list2string and other conversion helpers
URL utilities – isurl_reachable and related helpers
Sphinx integration – bundled Sphinx theme and copybutton extension
Quick Start
Parameter validation:
from easydev import check_param_in_list, check_range
check_param_in_list("on", ["on", "off"]) # passes silently
check_range(0.5, 0, 1) # passes silently
AttrDict – access nested dictionary keys as attributes:
from easydev import AttrDict
d = AttrDict(**{"server": {"host": "localhost", "port": 8080}})
print(d.server.host) # localhost
d.server.port = 9090
Coloured logging:
from easydev import Logging
logger = Logging("myapp", "WARNING")
logger.warning("something went wrong")
logger.debug("not shown at WARNING level")
logger.level = "DEBUG"
logger.debug("now it is shown")
Progress bar:
from easydev import Progress
pb = Progress(100)
for i in range(100):
# do work here
pb.animate(i + 1)
Timer:
from easydev import Timer
import time
times = []
with Timer(times):
time.sleep(0.1)
print(f"elapsed: {times[0]:.2f}s")
Multiprocessing:
from easydev.multicore import MultiProcessing
def square(n):
return n * n
t = MultiProcessing(maxcpu=4)
for i in range(10):
t.add_job(square, i)
t.run()
print(t.results)
Changelog
Version |
Description |
|---|---|
0.13.3 |
|
0.13.2 |
|
0.13.1 |
|
0.13.0 |
|
0.12.2 |
|
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 easydev-0.14.0.tar.gz.
File metadata
- Download URL: easydev-0.14.0.tar.gz
- Upload date:
- Size: 36.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.10.14 Linux/6.14.5-100.fc40.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da3c82b89debe71c13d946a6514a85bdc3034fa878aeaf9d361721f07ac42f44
|
|
| MD5 |
767b521a08ba0409a83a26b195feb905
|
|
| BLAKE2b-256 |
f8bda73fd1828ab7e152d9c71123396b581c529f3b01f37a1e845339f476e18d
|
File details
Details for the file easydev-0.14.0-py3-none-any.whl.
File metadata
- Download URL: easydev-0.14.0-py3-none-any.whl
- Upload date:
- Size: 57.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.0.1 CPython/3.10.14 Linux/6.14.5-100.fc40.x86_64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
774cce412ad543ef707fc3f437eff200422bee4ca2b1b7e063fa5ca40b48d942
|
|
| MD5 |
8a82c3a3cdfe181e9dac8949afeb363a
|
|
| BLAKE2b-256 |
0f4d1f697261368745b5d6cdfc952bb91cfa9fb72c74bf1c5d120039571922fe
|