https://github.com/adriamontoto/developing-tools

The Developing Tools project is a Python 🐍 package designed to enhance the development process by providing a collection of tools/utilities ⚒️ aimed at improving debugging, performance measurement, error handling, ...

https://github.com/adriamontoto/developing-tools

Science Score: 26.0%

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

  • 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 (13.4%) to scientific vocabulary

Keywords

decorator development python python3 python311 python312 python313 tools utilities
Last synced: 5 months ago · JSON representation

Repository

The Developing Tools project is a Python 🐍 package designed to enhance the development process by providing a collection of tools/utilities ⚒️ aimed at improving debugging, performance measurement, error handling, ...

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 6
  • Releases: 2
Archived
Topics
decorator development python python3 python311 python312 python313 tools utilities
Created over 1 year ago · Last pushed 8 months ago
Metadata Files
Readme License Security

README.md

🐣💻 Developing Tools

Test Pipeline Lint Pipeline Coverage Pipeline Package Version Supported Python Versions

The Developing Tools project is a Python 🐍 package designed to enhance the development process by providing a collection of tools/utilities aimed at improving debugging, performance measurement, error handling, ...

These tools ⚒️ are intended to assist developers in identifying performance bottlenecks, handling transient errors, and gaining insights into function behavior during runtime. The package is easy to install and use, making it a good addition to any Python developer's toolkit 🚀.

Table of Contents

🔼 Back to top



## 📥 Installation You can install **Developing Tools** using `pip`: ```bash pip install developing-tools ```

🔼 Back to top



## 💻 Utilization ### Execution Time The [`execution_time`](https://github.com/adriamontoto/developing-tools/blob/master/developing_tools/functions/execution_time.py) decorator allows you to measure the execution time of a function. The decorator has one parameter: - `output_decimals`: Number of decimal places to display in the output. Default is 10. ```python from time import sleep from developing_tools.functions import execution_time @execution_time(output_decimals=2) def too_slow_function() -> None: sleep(2) too_slow_function() # >>> Function "too_slow_function" took 2.00 seconds to execute. ```

🔼 Back to top

Retry It

The retryit decorator allows you to retry a function multiple times in case of failure. The decorator has two parameters:

  • attempts: The number of attempts to execute the function, if None the function will be executed indefinitely. Default is None.
  • delay: The delay between attempts in seconds, if a tuple is provided the delay will be randomized between the two values. Default is 5 seconds.
  • raise_exception: If True the decorator will raise the last caught exception if the function fails all attempts. Default is True.
  • valid_exceptions: A tuple of exceptions that the decorator should catch and retry the function, if None the decorator will catch all exceptions. Default is None.

```python from developing_tools.functions import retryit

@retryit(attempts=3, delay=0.5, raiseexception=True, validexceptions=(ValueError,)) def failing_function() -> None: raise ValueError('This function always fails!')

failing_function()

>>> Function failed with error: "This function always fails!". Retrying in 0.50 seconds ...

>>> Attempt [2/3] to execute function "failing_function".

>>> Function failed with error: "This function always fails!". Retrying in 0.50 seconds ...

>>> Attempt [3/3] to execute function "failing_function".

>>> Function failed with error: "This function always fails!". No more attempts.

Traceback (most recent call last):

File "/main.py", line 7, in

failing_function()

File "/developing_tools/functions/retryit.py", line 132, in wrapper

raise exception

File "/developing_tools/functions/retryit.py", line 124, in wrapper

return function(args, *kwargs)

^^^^^^^^^^^^^^^^^^^^^^^^^

File "/main.py", line 5, in failing_function

raise ValueError('This function always fails!')

ValueError: This function always fails!

```

🔼 Back to top

Print Parameters

The print_parameters decorator allows you to print the parameters of a function. The decorator has two parameters:

  • show_types: If True the decorator will print the types of the parameters. Default is False.
  • include_return: If True the decorator will print the return value of the function. Default is True.

```python from developingtools.functions import printparameters

@printparameters(showtypes=True, includereturn=True) def normalfunction(a: int, b: str, c: int, d) -> str: return a

normal_function(1, 'Hello', c=3, d=4)

>>> Positional arguments:

>>> Argument 1: value "1", type int

>>> Argument 2: value "Hello", type str

>>>

>>> Keyword arguments:

>>> Argument c: value "3", supposed type int, real type int

>>> Argument d: value "4", supposed type Any, real type int

>>>

>>> Return value:

>>> "1", supposed type str, real type int

```

🔼 Back to top

Timeout

The timeout decorator allows you to set a maximum execution time for a function. The decorator has one parameter:

  • seconds: The maximum number of seconds the function is allowed to execute before raising a TimeoutError. Default is 10 seconds.

```python from time import sleep from developing_tools.functions import timeout

@timeout(seconds=2) def tooslowfunction() -> None: sleep(5)

tooslowfunction()

>>> TimeoutError: Function tooslowfunction exceeded the 2 seconds timeout.

```

🤝 Contributing

We welcome contributions to Developing Tools! To ensure a smooth collaboration process, please follow the guidelines below.

How to Contribute

1. Fork the Repository: Click the "Fork" button at the top right of the repository page.

2. Clone Your Fork:

bash git clone git+ssh://git@github.com/<your-username>/developing-tools.git

3. Create a Branch:

bash git checkout -b feature/your-feature-name

4. Make Your Changes: Implement your new feature or fix a bug.

5. Run Tests: Ensure all the following tests pass before submitting your changes.

  • Run tests:

bash make test

  • Run tests with coverage:

bash make coverage

  • Run linter:

bash make lint

  • Run formatter:

bash make format

6. Commit Your Changes:

bash git commit -m "✨ feature: your feature description"

7. Push to Your Fork:

bash git push origin feature/your-feature-name

8. Create a Pull Request: Navigate to the original repository and create a pull request from your fork.

9. Wait for Review: Your pull request will be reviewed by the maintainers. Make any necessary changes based on their feedback.

🔼 Back to top



## 🔑 License This project is licensed under the terms of the [`MIT license`](https://github.com/adriamontoto/developing-tools/blob/master/LICENSE.md).

🔼 Back to top

Owner

  • Login: adriamontoto
  • Kind: user
  • Location: /dev/null
  • Company: Amazon

Software Development Engineer @ Amazon

GitHub Events

Total
  • Release event: 1
  • Delete event: 38
  • Issue comment event: 24
  • Push event: 34
  • Pull request review event: 18
  • Pull request event: 82
  • Create event: 42
Last Year
  • Release event: 1
  • Delete event: 38
  • Issue comment event: 24
  • Push event: 34
  • Pull request review event: 18
  • Pull request event: 82
  • Create event: 42

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 68
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 days
  • Total issue authors: 0
  • Total pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.53
  • Merged pull requests: 19
  • Bot issues: 0
  • Bot pull requests: 66
Past Year
  • Issues: 0
  • Pull requests: 67
  • Average time to close issues: N/A
  • Average time to close pull requests: 9 days
  • Issue authors: 0
  • Pull request authors: 2
  • Average comments per issue: 0
  • Average comments per pull request: 0.54
  • Merged pull requests: 18
  • Bot issues: 0
  • Bot pull requests: 66
Top Authors
Issue Authors
  • adriamontoto (1)
Pull Request Authors
  • dependabot[bot] (80)
  • adriamontoto (4)
Top Labels
Issue Labels
bug (1) pending (1)
Pull Request Labels
dependencies (80) github_actions (78) python (2)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 21 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
pypi.org: developing-tools

Package designed to enhance the development process by providing a collection of tools/utilities

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 21 Last month
Rankings
Dependent packages count: 10.7%
Average: 35.6%
Dependent repos count: 60.5%
Maintainers (1)
Last synced: 6 months ago