puffy


Namepuffy JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/nicolasdao/pypuffy
SummaryA collection of modules with zero-dependencies to help manage common programming tasks.
upload_time2023-05-16 11:13:16
maintainer
docs_urlNone
authorNicolas Dao
requires_python>=3.7
licenseBSD-3-Clause
keywords util
VCS
bugtrack_url
requirements attrs black bleach build certifi charset-normalizer click docutils easypipinstall exceptiongroup flake8 idna importlib-metadata iniconfig jaraco.classes keyring markdown-it-py mccabe mdurl more-itertools mypy-extensions packaging pathspec pkginfo platformdirs pluggy pycodestyle pyflakes Pygments pyproject_hooks pytest readme-renderer requests requests-toolbelt rfc3986 rich six tomli twine typing_extensions urllib3 webencodings zipp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PUFFY

A collection of modules with zero-dependencies to help manage common programming tasks.

```
pip install puffy
```

Usage examples:

```python
from puffy.error import catch_errors

# This function will never fail. Instead, the error is safely caught.
@catch_errors
def fail():
    raise Exception("Failed")
    return "yes"

err, resp = fail() # `err` and `resp` are respectively None and Object when the function is successull. Otherwise, they are respectively StackedException and None.
```

```python
from puffy.object import JSON as js

obj = js({ 'hello':'world' })
obj['person']['name'] = 'Nic' # Notice it does not fail.
obj.s('address.line1', 'Magic street') # Sets obj.address.line1 to 'Magic street' and return 'Magic street'
```

# Table of contents

> * [APIs](#apis)
>	- [`error`](#error)
>		- [Basic `error` APIs - Getting in control of your errors](#basic-error-apis---getting-in-control-of-your-errors)
>		- [Nested errors and error stack](#nested-errors-and-error-stack)
>		- [Managing errors in `async/await` corountines](#managing-errors-in-asyncawait-corountines)
>   - [`log`](#log)
>       - [Basic `log` APIs](#basic-log-apis)
>       - [Logging errors](#logging-errors)
>       - [Environment variables](#environment-variables)
>       - [Global context](#global-context)
>	- [`object`](#object)
>		- [`JSON` API](#json-api)
> * [Dev](#dev)
>	- [Getting started](#dev---getting-started)
>	- [CLI commands](#cli-commands)
>	- [Install dependencies with `easypipinstall`](#install-dependencies-with-easypipinstall)
>	- [Linting, formatting and testing](#linting-formatting-and-testing)
>		- [Ignoring `flake8` errors](#ignoring-flake8-errors)
>		- [Skipping tests](#skipping-tests)
>		- [Executing a specific test only](#executing-a-specific-test-only)
>	- [Building and distributing this package](#building-and-distributing-this-package)
> * [FAQ](#faq)
> * [References](#references)
> * [License](#license)

# APIs
## `error`

The `error` module exposes the following APIs:
- `catch_errors`: A higher-order function that returns a function that always return a tuple `(error, response)`. If the `error` is `None`, then the function did not fail. Otherwise, it did and the `error` object can be used to build an error stack.
- `StackedException`: A class that inherits from `Exception`. Use it to stack errors.

### Basic `error` APIs - Getting in control of your errors

```python
from puffy.error import catch_errors

# This function will never fail. Instead, the error is safely caught.
@catch_errors
def fail():
    raise Exception("Failed")
    return "yes"

err, resp = fail() 

print(resp) # None
print(type(err)) # <class 'src.puffy.error.StackedException'> which inherits from Exception
print(str(err)) # Failed
print(len(err.stack)) # 1
print(str(err.stack[0])) # Failed
print(err.stack[0].__traceback__) # <traceback object at 0x7fc69066bf00>

# Use the `strinfigy` method to extract the full error stack details.
print(err.strinfigy()) 
# error: Failed
#   File "blablabla.py", line 72, in safe_exec
#     data = ffn(*args, **named_args)
#   File "blablabla.py", line 28, in fail
#     raise Exception("Failed")
```

### Nested errors and error stack

```python
from puffy.error import catch_errors, StackedException

# This function will never fail. Instead, the error is safely caught.
@catch_errors("Should fail")
def fail():
    err, resp = fail_again()
    if err:
        raise StackedException("As expected, it failed!", err) 
        # StackedException accepts an arbitrary number of inputs of type str or Exception:
        # 	- raise StackedException(err) 
        # 	- raise StackedException('This', 'is', 'a new error') 
    return "yes"

@catch_errors("Should fail again")
def fail_again():
    raise Exception("Failed again")
    return "yes"

err, resp = fail()

print(len(err.stack)) # 4
print(str(err.stack[0])) # Should fail
print(str(err.stack[1])) # As expected, it failed!
print(str(err.stack[2])) # Should fail again
print(str(err.stack[3])) # Failed again

# Use the `strinfigy` method to extract the full error stack details.
print(err.strinfigy()) 
# error: Should fail
#   File "blablabla.py", line 72, in fail
# error: As expected, it failed!
#   File "blablabla.py", line 72, in fail
# error: Should fail again
#   File "blablabla.py", line 72, in fail
# error: Failed again
#   File "blablabla.py", line 72, in safe_exec
#     data = ffn(*args, **named_args)
#   File "blablabla.py", line 28, in fail_again
#     raise Exception("Failed")
```

### Managing errors in `async/await` corountines

```python
from puffy.error import async_catch_errors
import asyncio

# This function will never fail. Instead, the error is safely caught.
@async_catch_errors
async def fail():
    await asyncio.sleep(0.01)
    raise Exception("Failed")
    return "yes"

loop = asyncio.get_event_loop()
err, resp = loop.run_until_complete(fail())

print(resp) # None
print(type(err)) # <class 'src.puffy.error.StackedException'> which inherits from Exception
print(str(err)) # Failed
print(len(err.stack)) # 1
print(str(err.stack[0])) # Failed
print(err.stack[0].__traceback__) # <traceback object at 0x7fc69066bf00>

# Use the `strinfigy` method to extract the full error stack details.
print(err.strinfigy()) 
# error: Failed
#   File "blablabla.py", line 72, in safe_exec
#     data = ffn(*args, **named_args)
#   File "blablabla.py", line 28, in fail
#     raise Exception("Failed")
```

## `log`
### Basic `log` APIs

This method prints a structured log to stdout. That structured log is a standard Python `dict` which is then serialized to `str` using `json.dumps`. This method is designed to never fail. It was originally designed to log messages to AWS CloudWatch.

```python
from puffy.log import log

log() # '{ "level":"INFO" }'

log(
    level="WARN", # Supported values: "INFO" (default), "WARN" (or "WARNING"), "ERROR", "CRITICAL"
    message="Seems drunk",
    code="drunky_drunky",
    metric=23,
    unit="beers", # Default is "ms" (i.e., milliseconds)
    data= {
        "name": "Dave",
        "age": 45
    },
    op_id= 12345,
    test=True
) # '{"level": "WARN", "message": "Seems drunk", "code": "drunky_drunky", "test": true, "metric": 23, "unit": "beers", "op_id": 12345, "data": {"name": "Dave", "age": 45}}'

# Logging time:
log(
    level="WARN", # Supported values: "INFO" (default), "WARN" (or "WARNING"), "ERROR", "CRITICAL"
    message="Seems drunk",
    code="drunky_drunky",
    time=34 # This is converted to the "metric" input with "unit" set to "ms" (cannot be overwritten)
) # '{"level": "WARN", "message": "Seems drunk", "code": "drunky_drunky", "metric": 34, "unit": "ms"}'
```

### Logging errors

The `log` API is designed to support puffy's `StackedException` errors. The advantage of using `StackedException` is that you can have confidence that the stacked errors are properly serialized (i.e., including message and traceback).

```python
from puffy.log import log
from puffy.error import catch_errors, StackedException as e

@catch_errors("Should fail")
def fail():
    err, resp = fail_again()
    if err:
        raise e(err)
    return "yes"

@catch_errors("Should fail again")
def fail_again():
    raise Exception("Failed again")
    return "yes"

err, *_ = fail()

# Supports `StackedException`
log(
    level="ERROR",
    errors=err) 
# '{"level": "INFO", "errors": "error: Should fail\n  File \"/Users/.../ur_code.py\", line 153, in fail\nerror: Should fail again\n  File \"/Users/.../ur_code.py\", line 153, in fail\nerror: Failed again\n  File \"/Users/.../ur_code.py\", line 112, in safe_exec\n    data = ffn(*args, **named_args)\n  File \"/Users/.../ur_code.py\", line 162, in fail_again\n    raise Exception(\"Failed again\")\n"}'

# Supports standard errors
log(
    level="ERROR",
    errors=Exception("Bim bam boom")) # '{"level": "ERROR", "errors": "Bim bam boom"}'

# Supports strings
log(
    level="ERROR",
    errors="Bim bam boom") # '{"level": "ERROR", "errors": "Bim bam boom"}'

# Supports list of errors
log(
    level="ERROR",
    errors=["Bim bam boom", Exception("Booom"), err]) # '{"level": "ERROR", "errors": "Bim bam boom\nBooom\nerror: Should fail\n  File \"/Users/.../ur_code.py\", line 153, in fail\nerror: Should fail again\n  File \"/Users/.../ur_code.py\", line 153, in fail\nerror: Failed again\n  File \"/Users/.../ur_code.py\", line 112, in safe_exec\n    data = ffn(*args, **named_args)\n  File \"/Users/.../ur_code.py\", line 162, in fail_again\n    raise Exception(\"Failed again\")\n"}'
```

### Environment variables

Often, specific common metadata must be added to all logs (e.g., server's details, api name, ...). For this purpose, use the `LOG_META` environment variable. This environment variable expects a stringified JSON object:

```python
from puffy.log import log

os.environ["LOG_META"] = json.dumps({"api_name": "hello"})

log(level="INFO", message="hello world") # '{"api_name": "hello", "level": "INFO", "message": "hello world"}'
```

### Global context

puffy supports setting up a context globally. That context is a dictionary global to the current execution thread. By default, that context contains no keys (i.e., `{}`). If that context is set as follow:

```python
{ "hello": "world" }
```

Then, all logs include that keyvalue pair.

This global context can be accessed as follow:

```python
from puffy.log import log, set_context, get_context, reset_context

log(level="INFO", message="hello world") # '{"level": "INFO", "message": "hello world"}'

print(get_context()) # {}

set_context(hello="world", whatever="you want")

log(level="INFO", message="hello world") # '{"hello":"world", "whatever":"you want", "level": "INFO", "message": "hello world"}'

print(get_context()) # {"hello":"world", "whatever":"you want"}

reset_context()

log(level="INFO", message="hello world") # '{"level": "INFO", "message": "hello world"}'

print(get_context()) # {}
```

## `object`
### `JSON` API

```python
from puffy.object import JSON as js

obj = js({ 'hello':'world' })
obj['person']['name'] = 'Nic' # Notice it does not fail.
obj.s('address.line1', 'Magic street') # Sets obj.address.line1 to 'Magic street' and return 'Magic street'

print(obj['person']['name']) # Nic
print(obj) # { 'hello':'world', 'person': { 'name': 'Nic' } }
print(obj.g('address.line1')) # Magic street
print(obj) # { 'hello':'world', 'person': { 'name': None }, 'address': { 'line1': 'Magic street' } }
print(obj.g('address.line2')) # Nonce
print(obj) # { 'hello':'world', 'person': { 'name': None }, 'address': { 'line1': 'Magic street', line2: None } }
```

# Dev
## Dev - Getting started

1. Clone this project:
```shell
git clone https://github.com/nicolasdao/pypuffy.git
```
2. Browse to the root folder:
```shell
cd pypuffy
```
3. Create a new virtual environment:
```shell
python3 -m venv .venv
```
4. Activate this virtual environment:
```shell
source .venv/bin/activate
```

To deactivate that virtual environment:
```shell
deactivate
```

## CLI commands

`make` commands:

| Command | Description |
|:--------|:------------|
| `python3 -m venv .venv` | Create a new virtual environment. |
| `source .venv/bin/activate` | Activate the virtual environment |
| `deactivate` | Deactivate the virtual environment |
| `make b` | Builds the package. |
| `make p` | Publish the package to https://pypi.org. |
| `make bp` | Builds the package and then publish it to https://pypi.org. |
| `make bi` | Builds the package and install it locally (`pip install -e .`). |
| `make install` | Install the dependencies defined in the `requirements.txt`. This file contains all the dependencies (i.e., both prod and dev). |
| `make install-prod` | Install the dependencies defined in the `prod-requirements.txt`. This file only contains the production dependencies. |
| `make n` | Starts a Jupyter notebook for this project. |
| `make t` | Formats, lints and then unit tests the project. |
| `make t testpath=<FULLY QUALIFIED TEST PATH>` | Foccuses the unit test on a specific test. For a concrete example, please refer to the [Executing a specific test only](#executing-a-specific-test-only) section. |
| `easyi numpy` | Instals `numpy` and update `setup.cfg`, `prod-requirements.txt` and `requirements.txt`. |
| `easyi flake8 -D` | Instals `flake8` and update `setup.cfg` and `requirements.txt`. |
| `easyu numpy` | Uninstals `numpy` and update `setup.cfg`, `prod-requirements.txt` and `requirements.txt`. |
| `easyv` | Returns the version defined in `setup.cfg`. |
| `easyv bump` | Bumps the patch version defined in `setup.cfg` (1).|
| `easyv bump minor` | Bumps the minor version defined in `setup.cfg` (1).|
| `easyv bump major` | Bumps the major version defined in `setup.cfg` (1).|
| `easyv bump x.x.x` | Sets the version defined in `setup.cfg` to x.x.x (1).|

> __(1):__ Bumping a version using `easyv` can apply up to three updates:
>1. Updates the version property in the `setup.cfg` file.
>2. If the project is under source control with git and git is installed:
>   1. Updates the `CHANGELOG.md` file using the commit messages between the current branch and the last version tag. If the `CHANGELOG.md` file does not exist, it is automatically created.
>   2. git commit and tag (using the version number prefixed with `v`) the project.

## Install dependencies with `easypipinstall`

`easypipinstall` adds three new CLI utilities: `easyi` (install) `easyu` (uninstall) and `easyv` (manages package's version). To learn the full details about `easypipinstall`, please refer to https://github.com/nicolasdao/easypipinstall.

Examples:
```
easyi numpy
```

This installs `numpy` (via `pip install`) then automatically updates the following files:
- `setup.cfg` (WARNING: this file must already exists):
	```
	[options]
	install_requires = 
		numpy
	```
- `requirements.txt` and `prod-requirements.txt`

```
easyi flake8 black -D
```

This installs `flake8` and `black` (via `pip install`) then automatically updates the following files:
- `setup.cfg` (WARNING: this file must already exists):
	```
	[options.extras_require]
	dev = 
		black
		flake8
	```
- `requirements.txt` only, as those dependencies are installed for development purposes only.

```
easyu flake8
```

This uninstalls `flake8` as well as all its dependencies. Those dependencies are uninstalled only if they are not used by other project dependencies. The `setup.cfg` and `requirements.txt` are automatically updated accordingly.

## Linting, formatting and testing

```
make t
```

This command runs the following three python executables:

```
black ./
flake8 ./
pytest --capture=no --verbose $(testpath)
```

- `black` formats all the `.py` files, while `flake8` lints them. 
- `black` is configured in the `pyproject.toml` file under the `[tool.black]` section.
- `flake8` is configured in the `setup.cfg` file under the `[flake8]` section.
- `pytest` runs all the `.py` files located under the `tests` folder. The meaning of each option is as follow:
	- `--capture=no` allows the `print` function to send outputs to the terminal. 
	- `--verbose` displays each test. Without it, the terminal would only display the count of how many passed and failed.
	- `$(testpath)` references the `testpath` variable. This variable is set to `tests` (i.e., the `tests` folder) by default. This allows to override this default variable with something else (e.g., a specific test to only run that one).

### Ignoring `flake8` errors

This project is pre-configured to ignore certain `flake8` errors. To add or remove `flake8` errors, update the `extend-ignore` property under the `[flake8]` section in the `setup.cfg` file.

### Skipping tests

In your test file, add the `@pytest.mark.skip()` decorator. For example:

```python
import pytest

@pytest.mark.skip()
def test_self_describing_another_test_name():
	# ... your test here
```

### Executing a specific test only

One of the output of the `make t` command is list of all the test that were run (PASSED and FAILED). For example:

```
tests/error/test_catch_errors.py::test_catch_errors_basic PASSED
tests/error/test_catch_errors.py::test_catch_errors_wrapped PASSED
tests/error/test_catch_errors.py::test_catch_errors_nested_errors PASSED
tests/error/test_catch_errors.py::test_catch_errors_StackedException_arbitrary_inputs FAILED
```

To execute a specific test only, add the `testpath` option with the test path. For example, to execute the only FAILED test in the example above, run this command:

```
make t testpath=tests/error/test_catch_errors.py::test_catch_errors_StackedException_arbitrary_inputs
```

## Building and distributing this package

1. Make sure the test and lint operations have not produced errors:
```shell
make t
```
2. Version and tag this package using one of the following commands (1):
    - `easyv bump`: Use this to bump the patch version.
    - `easyv bump minor`: Use this to bump the minor version.
    - `easyv bump major`: Use this to bump the major version.
    - `easyv bump x.x.x`: Use this to bump the version to a specific value.
3. Push those latest changes to your source control repository (incl. tags). For example:
```shell
git push origin master --follow-tags
```
4. Build this package:
```shell
make b
```
> This command is a wrapper around `python3 -m build`.
5. Publish this package to https://pypi.org:
```shell
make p
```
> This command is a wrapper around the following commands: `python3 -m build; twine upload dist/*`


To test your package locally before deploying it to https://pypi.org, you can run build and install it locally with this command:

```shell
make bi
```

This command buils the package and follows with `pip install -e .`.

> (1): This step applies three updates:
> 1. Updates the version property in the `setup.cfg` file.
> 2. Updates the `CHANGELOG.md` file using the commit messages between the current branch and the last version tag.
> 3. git commit and tag (using the version number prefixed with `v`) the project.

# FAQ

# References

# License

BSD 3-Clause License

```
Copyright (c) 2019-2023, Cloudless Consulting Pty Ltd
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
   contributors may be used to endorse or promote products derived from
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/nicolasdao/pypuffy",
    "name": "puffy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "util",
    "author": "Nicolas Dao",
    "author_email": "nicolas.dao@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4f/5c/57194f5d17887abfc9d2f432cc217ac07d6d3a7a831d5cbe789fd7b2ce8d/puffy-0.4.0.tar.gz",
    "platform": null,
    "description": "# PUFFY\n\nA collection of modules with zero-dependencies to help manage common programming tasks.\n\n```\npip install puffy\n```\n\nUsage examples:\n\n```python\nfrom puffy.error import catch_errors\n\n# This function will never fail. Instead, the error is safely caught.\n@catch_errors\ndef fail():\n    raise Exception(\"Failed\")\n    return \"yes\"\n\nerr, resp = fail() # `err` and `resp` are respectively None and Object when the function is successull. Otherwise, they are respectively StackedException and None.\n```\n\n```python\nfrom puffy.object import JSON as js\n\nobj = js({ 'hello':'world' })\nobj['person']['name'] = 'Nic' # Notice it does not fail.\nobj.s('address.line1', 'Magic street') # Sets obj.address.line1 to 'Magic street' and return 'Magic street'\n```\n\n# Table of contents\n\n> * [APIs](#apis)\n>\t- [`error`](#error)\n>\t\t- [Basic `error` APIs - Getting in control of your errors](#basic-error-apis---getting-in-control-of-your-errors)\n>\t\t- [Nested errors and error stack](#nested-errors-and-error-stack)\n>\t\t- [Managing errors in `async/await` corountines](#managing-errors-in-asyncawait-corountines)\n>   - [`log`](#log)\n>       - [Basic `log` APIs](#basic-log-apis)\n>       - [Logging errors](#logging-errors)\n>       - [Environment variables](#environment-variables)\n>       - [Global context](#global-context)\n>\t- [`object`](#object)\n>\t\t- [`JSON` API](#json-api)\n> * [Dev](#dev)\n>\t- [Getting started](#dev---getting-started)\n>\t- [CLI commands](#cli-commands)\n>\t- [Install dependencies with `easypipinstall`](#install-dependencies-with-easypipinstall)\n>\t- [Linting, formatting and testing](#linting-formatting-and-testing)\n>\t\t- [Ignoring `flake8` errors](#ignoring-flake8-errors)\n>\t\t- [Skipping tests](#skipping-tests)\n>\t\t- [Executing a specific test only](#executing-a-specific-test-only)\n>\t- [Building and distributing this package](#building-and-distributing-this-package)\n> * [FAQ](#faq)\n> * [References](#references)\n> * [License](#license)\n\n# APIs\n## `error`\n\nThe `error` module exposes the following APIs:\n- `catch_errors`: A higher-order function that returns a function that always return a tuple `(error, response)`. If the `error` is `None`, then the function did not fail. Otherwise, it did and the `error` object can be used to build an error stack.\n- `StackedException`: A class that inherits from `Exception`. Use it to stack errors.\n\n### Basic `error` APIs - Getting in control of your errors\n\n```python\nfrom puffy.error import catch_errors\n\n# This function will never fail. Instead, the error is safely caught.\n@catch_errors\ndef fail():\n    raise Exception(\"Failed\")\n    return \"yes\"\n\nerr, resp = fail() \n\nprint(resp) # None\nprint(type(err)) # <class 'src.puffy.error.StackedException'> which inherits from Exception\nprint(str(err)) # Failed\nprint(len(err.stack)) # 1\nprint(str(err.stack[0])) # Failed\nprint(err.stack[0].__traceback__) # <traceback object at 0x7fc69066bf00>\n\n# Use the `strinfigy` method to extract the full error stack details.\nprint(err.strinfigy()) \n# error: Failed\n#   File \"blablabla.py\", line 72, in safe_exec\n#     data = ffn(*args, **named_args)\n#   File \"blablabla.py\", line 28, in fail\n#     raise Exception(\"Failed\")\n```\n\n### Nested errors and error stack\n\n```python\nfrom puffy.error import catch_errors, StackedException\n\n# This function will never fail. Instead, the error is safely caught.\n@catch_errors(\"Should fail\")\ndef fail():\n    err, resp = fail_again()\n    if err:\n        raise StackedException(\"As expected, it failed!\", err) \n        # StackedException accepts an arbitrary number of inputs of type str or Exception:\n        # \t- raise StackedException(err) \n        # \t- raise StackedException('This', 'is', 'a new error') \n    return \"yes\"\n\n@catch_errors(\"Should fail again\")\ndef fail_again():\n    raise Exception(\"Failed again\")\n    return \"yes\"\n\nerr, resp = fail()\n\nprint(len(err.stack)) # 4\nprint(str(err.stack[0])) # Should fail\nprint(str(err.stack[1])) # As expected, it failed!\nprint(str(err.stack[2])) # Should fail again\nprint(str(err.stack[3])) # Failed again\n\n# Use the `strinfigy` method to extract the full error stack details.\nprint(err.strinfigy()) \n# error: Should fail\n#   File \"blablabla.py\", line 72, in fail\n# error: As expected, it failed!\n#   File \"blablabla.py\", line 72, in fail\n# error: Should fail again\n#   File \"blablabla.py\", line 72, in fail\n# error: Failed again\n#   File \"blablabla.py\", line 72, in safe_exec\n#     data = ffn(*args, **named_args)\n#   File \"blablabla.py\", line 28, in fail_again\n#     raise Exception(\"Failed\")\n```\n\n### Managing errors in `async/await` corountines\n\n```python\nfrom puffy.error import async_catch_errors\nimport asyncio\n\n# This function will never fail. Instead, the error is safely caught.\n@async_catch_errors\nasync def fail():\n    await asyncio.sleep(0.01)\n    raise Exception(\"Failed\")\n    return \"yes\"\n\nloop = asyncio.get_event_loop()\nerr, resp = loop.run_until_complete(fail())\n\nprint(resp) # None\nprint(type(err)) # <class 'src.puffy.error.StackedException'> which inherits from Exception\nprint(str(err)) # Failed\nprint(len(err.stack)) # 1\nprint(str(err.stack[0])) # Failed\nprint(err.stack[0].__traceback__) # <traceback object at 0x7fc69066bf00>\n\n# Use the `strinfigy` method to extract the full error stack details.\nprint(err.strinfigy()) \n# error: Failed\n#   File \"blablabla.py\", line 72, in safe_exec\n#     data = ffn(*args, **named_args)\n#   File \"blablabla.py\", line 28, in fail\n#     raise Exception(\"Failed\")\n```\n\n## `log`\n### Basic `log` APIs\n\nThis method prints a structured log to stdout. That structured log is a standard Python `dict` which is then serialized to `str` using `json.dumps`. This method is designed to never fail. It was originally designed to log messages to AWS CloudWatch.\n\n```python\nfrom puffy.log import log\n\nlog() # '{ \"level\":\"INFO\" }'\n\nlog(\n    level=\"WARN\", # Supported values: \"INFO\" (default), \"WARN\" (or \"WARNING\"), \"ERROR\", \"CRITICAL\"\n    message=\"Seems drunk\",\n    code=\"drunky_drunky\",\n    metric=23,\n    unit=\"beers\", # Default is \"ms\" (i.e., milliseconds)\n    data= {\n        \"name\": \"Dave\",\n        \"age\": 45\n    },\n    op_id= 12345,\n    test=True\n) # '{\"level\": \"WARN\", \"message\": \"Seems drunk\", \"code\": \"drunky_drunky\", \"test\": true, \"metric\": 23, \"unit\": \"beers\", \"op_id\": 12345, \"data\": {\"name\": \"Dave\", \"age\": 45}}'\n\n# Logging time:\nlog(\n    level=\"WARN\", # Supported values: \"INFO\" (default), \"WARN\" (or \"WARNING\"), \"ERROR\", \"CRITICAL\"\n    message=\"Seems drunk\",\n    code=\"drunky_drunky\",\n    time=34 # This is converted to the \"metric\" input with \"unit\" set to \"ms\" (cannot be overwritten)\n) # '{\"level\": \"WARN\", \"message\": \"Seems drunk\", \"code\": \"drunky_drunky\", \"metric\": 34, \"unit\": \"ms\"}'\n```\n\n### Logging errors\n\nThe `log` API is designed to support puffy's `StackedException` errors. The advantage of using `StackedException` is that you can have confidence that the stacked errors are properly serialized (i.e., including message and traceback).\n\n```python\nfrom puffy.log import log\nfrom puffy.error import catch_errors, StackedException as e\n\n@catch_errors(\"Should fail\")\ndef fail():\n    err, resp = fail_again()\n    if err:\n        raise e(err)\n    return \"yes\"\n\n@catch_errors(\"Should fail again\")\ndef fail_again():\n    raise Exception(\"Failed again\")\n    return \"yes\"\n\nerr, *_ = fail()\n\n# Supports `StackedException`\nlog(\n    level=\"ERROR\",\n    errors=err) \n# '{\"level\": \"INFO\", \"errors\": \"error: Should fail\\n  File \\\"/Users/.../ur_code.py\\\", line 153, in fail\\nerror: Should fail again\\n  File \\\"/Users/.../ur_code.py\\\", line 153, in fail\\nerror: Failed again\\n  File \\\"/Users/.../ur_code.py\\\", line 112, in safe_exec\\n    data = ffn(*args, **named_args)\\n  File \\\"/Users/.../ur_code.py\\\", line 162, in fail_again\\n    raise Exception(\\\"Failed again\\\")\\n\"}'\n\n# Supports standard errors\nlog(\n    level=\"ERROR\",\n    errors=Exception(\"Bim bam boom\")) # '{\"level\": \"ERROR\", \"errors\": \"Bim bam boom\"}'\n\n# Supports strings\nlog(\n    level=\"ERROR\",\n    errors=\"Bim bam boom\") # '{\"level\": \"ERROR\", \"errors\": \"Bim bam boom\"}'\n\n# Supports list of errors\nlog(\n    level=\"ERROR\",\n    errors=[\"Bim bam boom\", Exception(\"Booom\"), err]) # '{\"level\": \"ERROR\", \"errors\": \"Bim bam boom\\nBooom\\nerror: Should fail\\n  File \\\"/Users/.../ur_code.py\\\", line 153, in fail\\nerror: Should fail again\\n  File \\\"/Users/.../ur_code.py\\\", line 153, in fail\\nerror: Failed again\\n  File \\\"/Users/.../ur_code.py\\\", line 112, in safe_exec\\n    data = ffn(*args, **named_args)\\n  File \\\"/Users/.../ur_code.py\\\", line 162, in fail_again\\n    raise Exception(\\\"Failed again\\\")\\n\"}'\n```\n\n### Environment variables\n\nOften, specific common metadata must be added to all logs (e.g., server's details, api name, ...). For this purpose, use the `LOG_META` environment variable. This environment variable expects a stringified JSON object:\n\n```python\nfrom puffy.log import log\n\nos.environ[\"LOG_META\"] = json.dumps({\"api_name\": \"hello\"})\n\nlog(level=\"INFO\", message=\"hello world\") # '{\"api_name\": \"hello\", \"level\": \"INFO\", \"message\": \"hello world\"}'\n```\n\n### Global context\n\npuffy supports setting up a context globally. That context is a dictionary global to the current execution thread. By default, that context contains no keys (i.e., `{}`). If that context is set as follow:\n\n```python\n{ \"hello\": \"world\" }\n```\n\nThen, all logs include that keyvalue pair.\n\nThis global context can be accessed as follow:\n\n```python\nfrom puffy.log import log, set_context, get_context, reset_context\n\nlog(level=\"INFO\", message=\"hello world\") # '{\"level\": \"INFO\", \"message\": \"hello world\"}'\n\nprint(get_context()) # {}\n\nset_context(hello=\"world\", whatever=\"you want\")\n\nlog(level=\"INFO\", message=\"hello world\") # '{\"hello\":\"world\", \"whatever\":\"you want\", \"level\": \"INFO\", \"message\": \"hello world\"}'\n\nprint(get_context()) # {\"hello\":\"world\", \"whatever\":\"you want\"}\n\nreset_context()\n\nlog(level=\"INFO\", message=\"hello world\") # '{\"level\": \"INFO\", \"message\": \"hello world\"}'\n\nprint(get_context()) # {}\n```\n\n## `object`\n### `JSON` API\n\n```python\nfrom puffy.object import JSON as js\n\nobj = js({ 'hello':'world' })\nobj['person']['name'] = 'Nic' # Notice it does not fail.\nobj.s('address.line1', 'Magic street') # Sets obj.address.line1 to 'Magic street' and return 'Magic street'\n\nprint(obj['person']['name']) # Nic\nprint(obj) # { 'hello':'world', 'person': { 'name': 'Nic' } }\nprint(obj.g('address.line1')) # Magic street\nprint(obj) # { 'hello':'world', 'person': { 'name': None }, 'address': { 'line1': 'Magic street' } }\nprint(obj.g('address.line2')) # Nonce\nprint(obj) # { 'hello':'world', 'person': { 'name': None }, 'address': { 'line1': 'Magic street', line2: None } }\n```\n\n# Dev\n## Dev - Getting started\n\n1. Clone this project:\n```shell\ngit clone https://github.com/nicolasdao/pypuffy.git\n```\n2. Browse to the root folder:\n```shell\ncd pypuffy\n```\n3. Create a new virtual environment:\n```shell\npython3 -m venv .venv\n```\n4. Activate this virtual environment:\n```shell\nsource .venv/bin/activate\n```\n\nTo deactivate that virtual environment:\n```shell\ndeactivate\n```\n\n## CLI commands\n\n`make` commands:\n\n| Command | Description |\n|:--------|:------------|\n| `python3 -m venv .venv` | Create a new virtual environment. |\n| `source .venv/bin/activate` | Activate the virtual environment |\n| `deactivate` | Deactivate the virtual environment |\n| `make b` | Builds the package. |\n| `make p` | Publish the package to https://pypi.org. |\n| `make bp` | Builds the package and then publish it to https://pypi.org. |\n| `make bi` | Builds the package and install it locally (`pip install -e .`). |\n| `make install` | Install the dependencies defined in the `requirements.txt`. This file contains all the dependencies (i.e., both prod and dev). |\n| `make install-prod` | Install the dependencies defined in the `prod-requirements.txt`. This file only contains the production dependencies. |\n| `make n` | Starts a Jupyter notebook for this project. |\n| `make t` | Formats, lints and then unit tests the project. |\n| `make t testpath=<FULLY QUALIFIED TEST PATH>` | Foccuses the unit test on a specific test. For a concrete example, please refer to the [Executing a specific test only](#executing-a-specific-test-only) section. |\n| `easyi numpy` | Instals `numpy` and update `setup.cfg`, `prod-requirements.txt` and `requirements.txt`. |\n| `easyi flake8 -D` | Instals `flake8` and update `setup.cfg` and `requirements.txt`. |\n| `easyu numpy` | Uninstals `numpy` and update `setup.cfg`, `prod-requirements.txt` and `requirements.txt`. |\n| `easyv` | Returns the version defined in `setup.cfg`. |\n| `easyv bump` | Bumps the patch version defined in `setup.cfg` (1).|\n| `easyv bump minor` | Bumps the minor version defined in `setup.cfg` (1).|\n| `easyv bump major` | Bumps the major version defined in `setup.cfg` (1).|\n| `easyv bump x.x.x` | Sets the version defined in `setup.cfg` to x.x.x (1).|\n\n> __(1):__ Bumping a version using `easyv` can apply up to three updates:\n>1. Updates the version property in the `setup.cfg` file.\n>2. If the project is under source control with git and git is installed:\n>   1. Updates the `CHANGELOG.md` file using the commit messages between the current branch and the last version tag. If the `CHANGELOG.md` file does not exist, it is automatically created.\n>   2. git commit and tag (using the version number prefixed with `v`) the project.\n\n## Install dependencies with `easypipinstall`\n\n`easypipinstall` adds three new CLI utilities: `easyi` (install) `easyu` (uninstall) and `easyv` (manages package's version). To learn the full details about `easypipinstall`, please refer to https://github.com/nicolasdao/easypipinstall.\n\nExamples:\n```\neasyi numpy\n```\n\nThis installs `numpy` (via `pip install`) then automatically updates the following files:\n- `setup.cfg` (WARNING: this file must already exists):\n\t```\n\t[options]\n\tinstall_requires = \n\t\tnumpy\n\t```\n- `requirements.txt` and `prod-requirements.txt`\n\n```\neasyi flake8 black -D\n```\n\nThis installs `flake8` and `black` (via `pip install`) then automatically updates the following files:\n- `setup.cfg` (WARNING: this file must already exists):\n\t```\n\t[options.extras_require]\n\tdev = \n\t\tblack\n\t\tflake8\n\t```\n- `requirements.txt` only, as those dependencies are installed for development purposes only.\n\n```\neasyu flake8\n```\n\nThis uninstalls `flake8` as well as all its dependencies. Those dependencies are uninstalled only if they are not used by other project dependencies. The `setup.cfg` and `requirements.txt` are automatically updated accordingly.\n\n## Linting, formatting and testing\n\n```\nmake t\n```\n\nThis command runs the following three python executables:\n\n```\nblack ./\nflake8 ./\npytest --capture=no --verbose $(testpath)\n```\n\n- `black` formats all the `.py` files, while `flake8` lints them. \n- `black` is configured in the `pyproject.toml` file under the `[tool.black]` section.\n- `flake8` is configured in the `setup.cfg` file under the `[flake8]` section.\n- `pytest` runs all the `.py` files located under the `tests` folder. The meaning of each option is as follow:\n\t- `--capture=no` allows the `print` function to send outputs to the terminal. \n\t- `--verbose` displays each test. Without it, the terminal would only display the count of how many passed and failed.\n\t- `$(testpath)` references the `testpath` variable. This variable is set to `tests` (i.e., the `tests` folder) by default. This allows to override this default variable with something else (e.g., a specific test to only run that one).\n\n### Ignoring `flake8` errors\n\nThis project is pre-configured to ignore certain `flake8` errors. To add or remove `flake8` errors, update the `extend-ignore` property under the `[flake8]` section in the `setup.cfg` file.\n\n### Skipping tests\n\nIn your test file, add the `@pytest.mark.skip()` decorator. For example:\n\n```python\nimport pytest\n\n@pytest.mark.skip()\ndef test_self_describing_another_test_name():\n\t# ... your test here\n```\n\n### Executing a specific test only\n\nOne of the output of the `make t` command is list of all the test that were run (PASSED and FAILED). For example:\n\n```\ntests/error/test_catch_errors.py::test_catch_errors_basic PASSED\ntests/error/test_catch_errors.py::test_catch_errors_wrapped PASSED\ntests/error/test_catch_errors.py::test_catch_errors_nested_errors PASSED\ntests/error/test_catch_errors.py::test_catch_errors_StackedException_arbitrary_inputs FAILED\n```\n\nTo execute a specific test only, add the `testpath` option with the test path. For example, to execute the only FAILED test in the example above, run this command:\n\n```\nmake t testpath=tests/error/test_catch_errors.py::test_catch_errors_StackedException_arbitrary_inputs\n```\n\n## Building and distributing this package\n\n1. Make sure the test and lint operations have not produced errors:\n```shell\nmake t\n```\n2. Version and tag this package using one of the following commands (1):\n    - `easyv bump`: Use this to bump the patch version.\n    - `easyv bump minor`: Use this to bump the minor version.\n    - `easyv bump major`: Use this to bump the major version.\n    - `easyv bump x.x.x`: Use this to bump the version to a specific value.\n3. Push those latest changes to your source control repository (incl. tags). For example:\n```shell\ngit push origin master --follow-tags\n```\n4. Build this package:\n```shell\nmake b\n```\n> This command is a wrapper around `python3 -m build`.\n5. Publish this package to https://pypi.org:\n```shell\nmake p\n```\n> This command is a wrapper around the following commands: `python3 -m build; twine upload dist/*`\n\n\nTo test your package locally before deploying it to https://pypi.org, you can run build and install it locally with this command:\n\n```shell\nmake bi\n```\n\nThis command buils the package and follows with `pip install -e .`.\n\n> (1): This step applies three updates:\n> 1. Updates the version property in the `setup.cfg` file.\n> 2. Updates the `CHANGELOG.md` file using the commit messages between the current branch and the last version tag.\n> 3. git commit and tag (using the version number prefixed with `v`) the project.\n\n# FAQ\n\n# References\n\n# License\n\nBSD 3-Clause License\n\n```\nCopyright (c) 2019-2023, Cloudless Consulting Pty Ltd\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n   list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n   this list of conditions and the following disclaimer in the documentation\n   and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n   contributors may be used to endorse or promote products derived from\n   this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n```\n\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A collection of modules with zero-dependencies to help manage common programming tasks.",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/nicolasdao/pypuffy"
    },
    "split_keywords": [
        "util"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb3eb5b71d5b648f8e55fc4adaeed1cd143f613420ef546ea9fc8f37407163c1",
                "md5": "c899d8d64f41410ea2c5407abf60d2c7",
                "sha256": "3dceca5d006a5a0f914fac14ceb3912ad9ba3bdd7463ee9a0f73753615049d9f"
            },
            "downloads": -1,
            "filename": "puffy-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c899d8d64f41410ea2c5407abf60d2c7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 11962,
            "upload_time": "2023-05-16T11:13:13",
            "upload_time_iso_8601": "2023-05-16T11:13:13.681643Z",
            "url": "https://files.pythonhosted.org/packages/eb/3e/b5b71d5b648f8e55fc4adaeed1cd143f613420ef546ea9fc8f37407163c1/puffy-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f5c57194f5d17887abfc9d2f432cc217ac07d6d3a7a831d5cbe789fd7b2ce8d",
                "md5": "a2867c5fdac4e5eb9fa26e3fd022dc51",
                "sha256": "7480c05128f44939c324bd46494a588c26ee931e857ece88314d9778786dd86c"
            },
            "downloads": -1,
            "filename": "puffy-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a2867c5fdac4e5eb9fa26e3fd022dc51",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 16430,
            "upload_time": "2023-05-16T11:13:16",
            "upload_time_iso_8601": "2023-05-16T11:13:16.665505Z",
            "url": "https://files.pythonhosted.org/packages/4f/5c/57194f5d17887abfc9d2f432cc217ac07d6d3a7a831d5cbe789fd7b2ce8d/puffy-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-16 11:13:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "nicolasdao",
    "github_project": "pypuffy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "attrs",
            "specs": [
                [
                    "==",
                    "22.2.0"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    "==",
                    "23.1.0"
                ]
            ]
        },
        {
            "name": "bleach",
            "specs": [
                [
                    "==",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "build",
            "specs": [
                [
                    "==",
                    "0.10.0"
                ]
            ]
        },
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2022.12.7"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.0.1"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.3"
                ]
            ]
        },
        {
            "name": "docutils",
            "specs": [
                [
                    "==",
                    "0.19"
                ]
            ]
        },
        {
            "name": "easypipinstall",
            "specs": [
                [
                    "==",
                    "0.2.1"
                ]
            ]
        },
        {
            "name": "exceptiongroup",
            "specs": [
                [
                    "==",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "flake8",
            "specs": [
                [
                    "==",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.4"
                ]
            ]
        },
        {
            "name": "importlib-metadata",
            "specs": [
                [
                    "==",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "iniconfig",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "jaraco.classes",
            "specs": [
                [
                    "==",
                    "3.2.3"
                ]
            ]
        },
        {
            "name": "keyring",
            "specs": [
                [
                    "==",
                    "23.13.1"
                ]
            ]
        },
        {
            "name": "markdown-it-py",
            "specs": [
                [
                    "==",
                    "2.1.0"
                ]
            ]
        },
        {
            "name": "mccabe",
            "specs": [
                [
                    "==",
                    "0.7.0"
                ]
            ]
        },
        {
            "name": "mdurl",
            "specs": [
                [
                    "==",
                    "0.1.2"
                ]
            ]
        },
        {
            "name": "more-itertools",
            "specs": [
                [
                    "==",
                    "9.0.0"
                ]
            ]
        },
        {
            "name": "mypy-extensions",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "23.0"
                ]
            ]
        },
        {
            "name": "pathspec",
            "specs": [
                [
                    "==",
                    "0.11.0"
                ]
            ]
        },
        {
            "name": "pkginfo",
            "specs": [
                [
                    "==",
                    "1.9.6"
                ]
            ]
        },
        {
            "name": "platformdirs",
            "specs": [
                [
                    "==",
                    "3.0.0"
                ]
            ]
        },
        {
            "name": "pluggy",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "pycodestyle",
            "specs": [
                [
                    "==",
                    "2.10.0"
                ]
            ]
        },
        {
            "name": "pyflakes",
            "specs": [
                [
                    "==",
                    "3.0.1"
                ]
            ]
        },
        {
            "name": "Pygments",
            "specs": [
                [
                    "==",
                    "2.14.0"
                ]
            ]
        },
        {
            "name": "pyproject_hooks",
            "specs": [
                [
                    "==",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": [
                [
                    "==",
                    "7.2.1"
                ]
            ]
        },
        {
            "name": "readme-renderer",
            "specs": [
                [
                    "==",
                    "37.3"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.28.2"
                ]
            ]
        },
        {
            "name": "requests-toolbelt",
            "specs": [
                [
                    "==",
                    "0.10.1"
                ]
            ]
        },
        {
            "name": "rfc3986",
            "specs": [
                [
                    "==",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "rich",
            "specs": [
                [
                    "==",
                    "13.3.1"
                ]
            ]
        },
        {
            "name": "six",
            "specs": [
                [
                    "==",
                    "1.16.0"
                ]
            ]
        },
        {
            "name": "tomli",
            "specs": [
                [
                    "==",
                    "2.0.1"
                ]
            ]
        },
        {
            "name": "twine",
            "specs": [
                [
                    "==",
                    "4.0.2"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.4.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "1.26.14"
                ]
            ]
        },
        {
            "name": "webencodings",
            "specs": [
                [
                    "==",
                    "0.5.1"
                ]
            ]
        },
        {
            "name": "zipp",
            "specs": [
                [
                    "==",
                    "3.13.0"
                ]
            ]
        }
    ],
    "lcname": "puffy"
}
        
Elapsed time: 0.08116s