Skip to main content

easydev

https://badge.fury.io/py/easydev.svg https://github.com/cokelaer/easydev/actions/workflows/main.yml/badge.svg https://coveralls.io/repos/cokelaer/easydev/badge.svg?branch=main https://static.pepy.tech/personalized-badge/easydev?period=total&units=INTERNATIONAL_SYSTEM&left_color=BLACK&right_color=GREEN&left_text=downloads
documentation:

http://easydev-python.readthedocs.io/en/latest/

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)

Moving away from easydev

easydev dates from a time when Python lacked many small conveniences. Most of its tools now have a standard-library or well-maintained third-party replacement, and new projects should not depend on easydev. The full module-by-module guide is in the documentation (doc/source/migration.rst). Main replacements:

easydev

Use instead

CustomConfig, AppDirs

platformdirs

DynamicConfigParser

configparser

AttrDict

types.SimpleNamespace / dataclasses

Logging

logging (+ colorlog)

Progress

tqdm

MultiProcessing

concurrent.futures.ProcessPoolExecutor

shellcmd, execute

subprocess.run

mkdirs, touch, get_home

pathlib / os.makedirs(exist_ok=True)

cmd_exists

shutil.which

md5

hashlib.file_digest (Python 3.11+)

browse

webbrowser.open

get_dependencies

importlib.metadata.requires

get_share_file

importlib.resources.files

For example, replacing CustomConfig:

# before
from easydev import CustomConfig
config_dir = CustomConfig("myapp").user_config_dir

# after
from pathlib import Path
from platformdirs import user_config_dir

config_dir = Path(user_config_dir("myapp"))
config_dir.mkdir(parents=True, exist_ok=True)

Changelog

Version

Description

0.15.0

  • fix is_mac (always returned False)

  • assert_list_almost_equal now warns (FutureWarning) when called without places/deltas (nothing is compared); raises ListMismatchError (both ValueError and AssertionError)

  • add a migration guide (README and documentation) explaining how to replace easydev tools with the standard library, platformdirs, etc.

  • require Python >= 3.9

0.13.3

  • update pyproject with contribs from @s-t-e-v-e-n-k see PR37

0.13.2

0.13.1

  • fix get_dependencies

0.13.0

  • fix requirements (line_profiler) and CI

0.12.2

  • For developers: move to pyproject. add precommit

  • replace pkg_resources (deprecated) with importlib

  • replace appdirs with more generic platformdirs

Metadata

Release files for easydev 0.15.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 easydev 0.15.0
File Size Uploaded
easydev-0.15.0.tar.gz 38.8 kB Details

Built distribution (wheel)

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

Total release size: 97.7 kB

Release files / easydev-0.15.0.tar.gz

Download URL easydev-0.15.0.tar.gz
Size 38.8 kB
Tags Source
SHA-256 checksum
How to use checksums
40eed6bfa254bab47fdead8a444733f1aeac4dc158fc0670532a63d821045b79
BLAKE2b-256 checksum
How to use checksums
178d1506e25254a1cca3508bc45f09f8f36c1f37e3bdd358075d23df1c4b7b46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.11.15 Linux/6.14.5-100.fc40.x86_64

Release files / easydev-0.15.0-py3-none-any.whl

Download URL easydev-0.15.0-py3-none-any.whl
Size 58.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c26d8e39c8cda8ea504c391b45c9c7a3a7abc834a4dfecd2faebd17cb5b6cb43
BLAKE2b-256 checksum
How to use checksums
4339caefc1fbf5a80a03093d0e9dbe42cac5179b516cc8a89e7016e0913bd161
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.4 CPython/3.11.15 Linux/6.14.5-100.fc40.x86_64

Release history Release notifications | RSS feed

This release

0.15.0 This release

2 release files

0.13.3

2 release files

0.13.2

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.2

2 release files

0.12.1

1 release file

0.12.0

1 release file

0.11.2

1 release file

0.11.1

1 release file

0.11.0

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.38

1 release file

0.9.37

1 release file

0.9.36

1 release file

0.9.35

1 release file

0.9.34

1 release file

0.9.33

1 release file

0.9.32

1 release file

0.9.31

1 release file

0.9.30

1 release file

0.9.29

1 release file

0.9.28

1 release file

0.9.27

1 release file

0.9.26

1 release file

0.9.25

1 release file

0.9.23

1 release file

0.9.22

1 release file

0.9.21

1 release file

0.9.20

1 release file

0.9.19

1 release file

0.9.18

1 release file

0.9.17

1 release file

0.9.16

0.9.15

1 release file

0.9.14

1 release file

0.9.13

1 release file

0.9.12

1 release file

0.9.11

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.8.9

1 release file

0.8.8

1 release file

0.8.7

1 release file

0.8.6

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.13

1 release file

0.6.12

1 release file

0.6.11

1 release file

0.6.10

1 release file

0.6.9

1 release file

0.6.8

1 release file

0.6.7

1 release file

0.6.6

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.3

1 release file

0.6.2

1 release file

0.6.1

0.6.0

1 release file

0.5.9

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

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