semvec/pypi-packages huggingface dataset:
django-tortoise 0.0.1
Integration of Tortoise orm into a Django project with one line of code
License: MIT
Requires Python: >=3.8
Keywords: django,tortoise,tortoise-ormsql,postgres,psql,sqlite,aiosqlite,psycopg,asyncpg,relational,database,orm,rdbms,object,mapper,async,asyncio,aio,monkey,patching,monkey-patching

===============
django-tortoise
===============

This python package is the simplest way to use Tortoise ORM in an existing (maybe not)
Django project that uses sqlite or PostgreSQL databases


Features
--------

* Saving all Django ORM advantages (migrations - the biggest one)
* Monkey patching existing Django models with generated on-the-fly Tortoise ORM models
* Generated Tortoise ORM models have the same behavior as Django models (fields behavior)
* Support all Django models fields and validators added to them (except FileFiled, FilePathField, ImageField)
* Support default database only (DATABASES['default'] from the setting.py)
* You can use Django models or Tortoise ORM models when you want (use Django models when it's more suitable than usage of Tortoise ORM models)
* There are enough limitations that are not described here, so most likely some thing is not supported (pre-alpha release =)
* Easy to use - just one line of code... Okay, two ;)


Quickstart
----------

Install django-tortoise::

    pip install django-tortoise

Modify the asgi.py in the main Django project folder:

.. code-block:: python

    import os

    from django.core.asgi import get_asgi_application
    from django_tortoise import get_boosted_asgi_application  # first line

    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'proj.settings')

    application = get_asgi_application()

    # get_boosted_asgi_application function monkey patch all registered apps models;
    # each model will has abjects attribute (the objects attribute was not modified),
    # which is a Tortoise model actually
    application = get_boosted_asgi_application(application)  # second line

Now you can use all valid Tortoise ORM queries via <model>.abjects attribute:

.. code-block:: python

    await ModelA.abjects.get(id=id)


Running Tests
-------------

::

    $ tox
codecrumbs 0.1.0
leave codecrumbs behind so that other can adopt the changes
License: MIT
Requires Python: >=3.8,<4.0

[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

# codecrumbs

Codecrumbs is a Python library (and pytest plugin) for source code refactoring across library boundaries.
It allows you to change the API of your library and to propagate this changes to every one who uses your library.


More can be found in the [documentation](https://15r10nk.github.io/codecrumbs/introduction/).

## Example

Simple example which renames one argument:

``` python
class Example:
    # old code ...
    # def method(self,v):
    #    print(v)

    @renamed_argument("v", "value")
    def method(self, value):
        print(value)


# some where else
e = Example()

e.method(v=5)
```

and apply the refactoring later

``` bash
# if you have a standalone script
codecrumbs example.py
# or if you have tests
pytest --codecrumbs-fix test_example.py
```

which will rename the argument

```python
e.method(value=5)
```

You can use `codecrumbs` instead of `python` to execute your code, or `pytest` to run your tests and apply the renamings automatically.

This can be used to fix the small things in your library you wanted to fix but never did,
because you wanted to stay backwards compatible or didn't wanted you user to fix 1000 renamings in their code.

## Installation

You can install `codecrumbs` via `pip` from [PyPI](https://pypi.org/project):

`pip install codecrumbs`

The pytest support comes out of the box and everyone who depends on your library can use `pytest --codecrumbs-fix` to apply the changes you declared.

## Features

With codecrumbs you can fix:
 * method / attribute names
 * rename named arguments of functions


## Contributing
Contributions are very welcome. Tests can be run with [tox](https://tox.readthedocs.io/en/latest/), please ensure
the coverage at least stays the same before you submit a pull request.

## Issues

If you encounter any problems, please [file an issue](https://github.com/15r10nk/pytest-codecrumbs/issues) along with a detailed description.

## License

Distributed under the terms of the [MIT](http://opensource.org/licenses/MIT) license, "pytest-codecrumbs" is free and open source software
fastapi-cloud-logging 1.1.0
Cloud Logging For FastAPI
License: MIT
Requires Python: >=3.7,<4.0

# fastapi-cloud-logging

[![Test](https://github.com/quoth/fastapi-cloud-logging/actions/workflows/test.yaml/badge.svg)](https://github.com/quoth/fastapi-cloud-logging/actions/workflows/test.yaml)

## Project description

fastapi-cloud-logging improves cloud logging with fastapi. It enables to send request data on cloud logging.

## Dependencies

* fastapi
* cloud logging
* Python >= 3.7
  * Require [contextvars](https://docs.python.org/3/library/contextvars.html)

## Installation

```sh
pip install fastapi-cloud-logging
```

## Usage

Add a middleware and set a handler to send a request info with each logging.

```python
from fastapi import FastAPI
from google.cloud.logging import Client
from google.cloud.logging_v2.handlers import setup_logging

from fastapi_cloud_logging import FastAPILoggingHandler, RequestLoggingMiddleware

app = FastAPI()

# Add middleware
app.add_middleware(RequestLoggingMiddleware)

# Use manual handler
handler = FastAPILoggingHandler(Client())
setup_logging(handler)
```

## Optional

### Structured Message

Cloud logging supports log entries with structured and unstructured data.
When a log record has a structured data, it write a log entry with structured data. And when a log record contains a string message, it write a log entry as an unstructured textPayload attribute.

When this structured option set True on FastAPILoggingHandler, it always write a log entry with a message attribute on a structured jsonPayload object.

```python
# default structured value is False
handler = FastAPILoggingHandler(Client(), structured=True)
```

### Error trace

On logging with an error, message payloads includes traceback from an error.
If you do not want to include traceback, you should set traceback_length to 0.

```python
# default traceback_length is 100
handler = FastAPILoggingHandler(Client(), traceback_length=0)
```

## Changelog

[`CHANGELOG.md`](CHANGELOG.md)

## Appendix

### With multithreading

This middleware depends mainly contextvars. So, when you use multithreading, it cannot handle a request info. On this case, you write a code for manual context management. For example, use `copy_context` on a thread.

For more information, please read [a great article about contextvars][1].

[1]: https://kobybass.medium.com/python-contextvars-and-multithreading-faa33dbe953d