Skip to main content

A CLI and utility package with decorators and tools to accelerate development.

Project description

Codewright 🛠️

A CLI and utility package by Srajan with decorators and tools to accelerate Python development.

Build Status PyPI version

Installation

Once published to PyPI, you can install it via pip:

pip install codewright

For local development, clone this repository and run:

pip install -e .

Features

1. Utility Decorators

Simply import the decorators you need from codewright.

@timer

Measures and prints the execution time of any function.

from codewright import timer
import time

@timer
def some_task():
    time.sleep(1)

# Prints: Finished 'some_task' in 1.0007 secs
some_task()

@retry

Retries a function if it throws an exception.

from codewright import retry

@retry(tries=3, delay=1)
def connect_to_flaky_service():
    print("Attempting to connect...")
    raise ConnectionError("Connection failed!")

# This will attempt to run 3 times before failing.
connect_to_flaky_service()

@cache

Caches the results of function calls to avoid re-computation (memoization).

from codewright import cache

@cache
def expensive_fibonacci(n):
    if n < 2: return n
    return expensive_fibonacci(n - 1) + expensive_fibonacci(n - 2)

# The first call is slow.
expensive_fibonacci(35) 

# This second call is instantaneous.
expensive_fibonacci(35)

2. CLI Scaffolding Tool

codewright includes a command-line tool to quickly set up new projects.

setup

Run this command in your terminal to create a standard project structure.

codewright setup my_new_project

This will generate a ready-to-use folder structure for my_new_project.

Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request at https://github.com/Srajan04/codewright.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

codewright-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

codewright-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file codewright-0.1.0.tar.gz.

File metadata

  • Download URL: codewright-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for codewright-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf9d2be5a3ea4cfde4407469c28897eb23381c35abd703d87ed04bc397943f2c
MD5 7604c430857f1cc469d00934cbd3f2de
BLAKE2b-256 d66a88c57f49fa44c428068189f70ca39bbc9392370719040c9fb227a559d775

See more details on using hashes here.

File details

Details for the file codewright-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: codewright-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for codewright-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 843949dbfa748b2fe3e54581b411802b3ecafa7ec16ee48dfb8366a74fa467fb
MD5 471c6dbefca94955155d1b2661c011b1
BLAKE2b-256 f5ceb850a1943a5e6d818b33ac113a2216dff0dbbf0f2cfd883d04971f2c811d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page