semvec/pypi-packages huggingface dataset:
sqla-paranoid3 0.1.4
Brings transparent soft delete to SQLAlchemy ORM
License: MIT

Paranoid3
=========

This fork has been updated to work with SQLAlchemy 3.

Brings transparent soft delete to SQLAlchemy ORM. This branch has been
modified to add the with_deleted() and restore() methods for interacting
with soft-deleted resources.

.. image:: https://travis-ci.org/sashahilton00/sqla-paranoid3.svg?branch=dev
   :target: https://travis-ci.org/sashahilton00/sqla-paranoid3
   :alt: Build Status


Installation
------------

.. code-block:: bash

    pip install sqla-paranoid3


Usage
-----

.. code-block:: python

    from paranoid.models import (
        Model,
        Query,
        Session,
    )

    class User(Model):
        __tablename__ = 'user'
        __softdelete__ = True

        id = Column(Integer, primary_key=True)
        name = Column(String)


    engine = create_engine('sqlite://')
    session = sessionmaker(engine, class_=Session, query_cls=Query)()

    session.query(User)

    # retrieve a user that has not been deleted (assuming ID is 1)
    user = User.query.get(1)

    # soft delete the user
    user.delete()

    # query for a soft deleted user
    user = User.query.with_deleted().get(1)
    # or
    user = User.query.with_deleted().filter_by(id=1).first()

    # restore the user (undo soft delete)
    user.restore()

    # save the changes
    session.add(user)
    session.commit()

    # hard delete the user
    session.delete(user, hard=True)
    session.commit()


Flask
-----

Paranoid3 comes with a ready to use ``Flask`` extension built
on top of Flask-SQLAlchemy:


.. code-block:: python

    from paranoid.flask import SQLAlchemy


    db = SQLAlchemy(app)
    # or you can use the factory style of initialisation
    db = SQLAlchemy()
    db.init_app(app)

    Model = db.Model


    class User(Model):
        __softdelete__ = True

        id = Column(Integer, primary_key=True)
        name = Column(String)

    User.query
RandStrGen 0.2.0
A simple and flexible random string generator
License: MIT
Requires Python: >=3.6

# RandStrGen

RandStrGen is a simple and flexible random string generator for Python. It allows you to generate random strings with customizable character types and constraints.

## Features

- **Customizable Character Types:** Include uppercase, lowercase, digits, symbols, or a combination.
- **First Character Constraints:** Specify if the first character should be a letter, uppercase, or lowercase.
- **Batch Generation:** Generate multiple random strings at once.
- **Secure Randomness:** Utilizes Python's `secrets` module for cryptographic security.

## Installation

Install RandStrGen using pip:

```bash
pip install RandStrGen
flask-grpc-bridge 0.0.2
Bridge between Flask and gRPC definitions.
License: MIT
Requires Python: >=3.8

# flask-grpc-bridge
Bridge between Flask and gRPC. `flask_grpc_bridge` allows you to define RPC services and methods using protobufs,
but serve them using Flask. The resulting Flask endpoints can accept either JSON or binary representations of the
request messages, and return the corresponding response message.

## Who is this for?
Two cases that I've run across in various jobs:
* Existing Flask services that want some stronger typing and validation on the incoming requests, or that are being
called from strongly-typed languages (like golang), and want to use a shared schema, or don't want to deal with JSON
requests and responses.
* Existing gRPC services that want to be called from web browsers (or other systems that might not have good protobuf
support). These clients need to be able to pass JSON requests and receive JSON responses, but they don't want to
rewrite the service logic.

## Example usage
Given a gRPC service definition (from the [gRPC documentation](https://grpc.io/docs/what-is-grpc/introduction/)):
```protobuf
// hello_world.proto
syntax = "proto3";

// The greeter service definition.
service Greeter {
  // Sends a greeting
  rpc SayHello (HelloRequest) returns (HelloReply) {}
}

// The request message containing the user's name.
message HelloRequest {
  string name = 1;
}

// The response message containing the greetings
message HelloReply {
  string message = 1;
}
```

You can set up a regular Flask app, and add a bridge for the gRPC service:
```python
app = Flask(__name__)
bridge = Bridge(app, hello_world_pb2, "Greeter")
```
Then write the implementation and decorate it:

```python
@bridge.rpc()
def SayHello(req: HelloRequest) -> HelloReply:
    message = "Hello, " + (req.name or "world")
    resp = HelloReply(message=message)
    return resp
```

This will register a `/Greeter/SayHello/` route with the Flask app.
* When the endpoint receives a JSON request, it will be converted to a `HelloRequest` message and passed to the
`SayHello` function. The returned `HelloReply` message will be converted to JSON and returned in the response.
* If the endpoint receives a request with `Content-Type: application/protobuf` header, it will treat the body as a
serialized protobuf, and deserialize it as a `HelloRequest` message. Similarly, the returned `HelloReply` will be
serialized and returned (using the same `Content-Type` header).

## Future work
* Short term:
  * Better error handling and messaging.
  * More options for protobuf <-> JSON conversion (e.g. control over the `ignore_unknown_fields` flag, http methods)
* Long term:
  * Client-side code generation
  * Support for some options from [Transcoding HTTP/JSON to gRPC](https://cloud.google.com/endpoints/docs/grpc/transcoding)
  * OpenAPI schema generation