semvec/pypi-packages huggingface dataset:
fastapi-supabase 0.2.0
Integrate supabase to FastAPI with less effort
Requires Python: >=3.9

# fastapi-supabase

Integrate supabase to FastAPI with less effort

## Installation

```sh
pip install fastapi-supabase
```

For local development:

```sh
uv sync
uv pip install -e .
```

## Usage

This module needs to initialize the Supabase client object during the lifespan event. You can do it like this:

```py
SUPABASE_URL = os.environ["SUPABASE_URL"]
SUPABASE_KEY = os.environ["SUPABASE_KEY"]


@asynccontextmanager
async def lifespan(app: FastAPI):
    yield await fastapi_supabase.lifespan(SUPABASE_URL, SUPABASE_KEY)

app = FastAPI(
    title="FastAPI Supabase",
    lifespan=lifespan # Here we add a function to handle when the app starts up.
)
# You're all set!
```

We provide some dependency functions, which help you access supabase client on FastAPI endpoints.

### `SupabaseClient`

This type helps you access supabase asynchronous clients.

Example usage:

```python
@app.post("/login")
async def login(sp: SupabaseClient, form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
    """
    Login and get access token
    """
    # login using email
    data = {
        "email": form_data.username,
        "password": form_data.password
    }
    resp = await sp.auth.sign_in_with_password(data)
    if resp.user:
        access_token = None
        if resp.session:
            access_token = resp.session.access_token
        
        return {"access_token": access_token}
    raise HTTPException(400, "Invalid username or password")
```

### `SupabaseSession`

This type is same as `SupabaseClient`. The difference is this type adds access token to supabase client automatically and endpoint will be protected.

### `CurrentUser`

This type is to get the current user object. And, if you use this type, your endpoint will not be accessible if the client request does not provide a Bearer access token. The access token must be valid on the supabase.

Example:

```python
@app.get("/book")
async def list_book(sp: SupabaseSession, current_user: CurrentUser, page: int = 1, limit: int = 10):
    """
    List of books with pagination.
    """
    tbl = sp.table("books")
    offset = (page - 1) * limit
    resp = await tbl.select("*").eq("user_id", current_user.id).limit(limit).offset(offset).execute()
    return resp.data
```
packageimporter 1.4.1
A really simple package that allows you to import packages to your code
Requires Python: >=3.8

# IMPORTANT NOTE: 1.SUPPORT FOR PACKAGEIMPORTER <=1.3.0 HAS OFFICIALLY DROPPED. WE WILL NO LONGER BE SEEING ANYMORE BUGFIXES IN FUTURE VERSION (IF ANY) ABOUT BUGFIXES APPEARING IN THIS VERSION; 2.PLEASE DOWNLOAD THIS NEW VERSION, NOT PACKAGEIMPORTER 1.4.0 FOR THE NEWEST BUGFIXES

# About

## PackageImporter is a simple project for importing projects according to different types (DataScience, Plotting, etc.). It can also be used to install packages and inspect installed packages.

# Installation

## To install PackageImporter, run this command into your terminal (Use Windows Powershell because I love it):

### `pip install packageimporter`

## For a specific version, run:

### `pip install packageimporter=={version}`

## To upgrade the exsisting PackageImporter module (which you probably don't):

### `pip install --upgrade packageimporter`

## note: you can either use `python -m pip` or `py -m pip` if it's different (HINT: It may). PackageImporter has only one limitation: `Python>=3.8`

# Usage Example

## `from packageimporter import Importer`

## `Importer.stable.Plotter.plotly.express(alias="i_love_plotly_express")`

### # This will import plotly.express as i_love_plotly_express (weird alias) and raise an ModuleNotFoundError if plotly.express is not globally installed.

# Update Notes:

## Minor Bugfixes on error while class calling

## Updates on README.MD

## PICDT (PackageImporter CoreDev Team joined with Fasthelp Dev Team (FDT))

### PS: Guess we'll have to wait for PIIP (PackageImporter Insider Project) in packageimporter v1.5.0...

(鈫慪)

# Thanks to all, JVSCode Dev Team (JDT)