semvec/pypi-packages huggingface dataset:
fastapi-dynamic-router 0.1.4
A FastAPI extension for dynamic and automatic route registration
Requires Python: >=3.7

# FastAPI Dynamic Router

FastAPI extension that provides automatic and dynamic route registration for FastAPI applications, inspired by Next.js's file-system based routing.

## Installation

```bash
pip install fastapi-dynamic-router
```

## How to Use

### Basic Setup

```python
from fastapi import FastAPI
from fastapi_dynamic_router import DynamicRouter

# Create FastAPI app
app = FastAPI()

# Initialize the router
router = DynamicRouter(app)

# Register routes from a directory
router.register_routes('routes')

if __name__ == '__main__':
    import uvicorn
    uvicorn.run(app)
```

### Route Examples

1. **Basic Route** (`routes/root/__init__.py`):
```python
from fastapi import APIRouter

router = APIRouter()

@router.get('/')
def index():
    return {'message': 'Welcome to the API'}
```

2. **Dynamic Parameter** (`routes/users/[user_id]/__init__.py`):
```python
from fastapi import APIRouter

router = APIRouter()

@router.get('/')
def get_user(user_id: str):
    return {'message': f'User details for ID: {user_id}'}
```

3. **Nested Routes** (`routes/products/[productID]/reviews/__init__.py`):
```python
from fastapi import APIRouter

router = APIRouter()

@router.get('/')
def get_reviews(product_id: str):
    return {'message': f'Reviews for product ID: {product_id}'}
```

### Configuration Options

```python
# Make routes case-insensitive
app.state.dynamic_router_config['case_sensitive'] = False

# Add a global prefix to all routes
app.state.dynamic_router_config['prefix'] = '/api/v1'
```

## Directory Structure

The router follows a convention-based approach where your directory structure maps directly to URL routes:

```
📦 routes
├── 📂 Root
│   ├── 📄 __init__.py          ➜  🌐 /
│   ├── 📂 version
│   │   └── 📄 __init__.py      ➜  🌐 /version
│   └── 📂 about
│       └── 📄 __init__.py      ➜  🌐 /about
│
├── 📂 users
│   ├── 📄 __init__.py          ➜  🌐 /users
│   ├── 📂 [userID]             ➜  💫 Dynamic Parameter
│   │   ├── 📄 __init__.py      ➜  🌐 /users/{user_id}
│   │   └── 📂 profile
│   │       └── 📄 __init__.py  ➜  🌐 /users/{user_id}/profile
│   └── 📂 settings
│       └── 📄 __init__.py      ➜  🌐 /users/settings
│
└── 📂 products
    ├── 📄 __init__.py          ➜  🌐 /products
    └── 📂 [productID]          ➜  💫 Dynamic Parameter
        └── 📄 __init__.py      ➜  🌐 /products/{product_id}
```

## Route Mapping Examples

| Directory Structure | Generated Route | Type |
|--------------------|-----------------|------|
| `Root/__init__.py` | `/` | Static Route |
| `users/__init__.py` | `/users` | Static Route |
| `users/[userID]/__init__.py` | `/users/{user_id}` | Dynamic Route |
| `Products/[productID]/__init__.py` | `/products/{product_id}` | Dynamic Route |

## Dynamic Parameters

Dynamic parameters are defined using square brackets in directory names:
- 📂 `[userID]` ➜ `{user_id}`
- 📂 `[productID]` ➜ `{product_id}`
- 📂 `[categoryName]` ➜ `{category_name}`

## License

This project is licensed under the MIT License - see the LICENSE file for details.
worldnames 0.0.8
A populater for databases and generator for user information
Requires Python: >=3.8

Random name generator.
Random email generator.
Random age generator. 

## Doel van het programma
Als developer wil je soms je database populeren met gebruikers om testen uit te voeren of een MVP te demonstreren of je hebt simpelweg
gewoon een random voornaam, achternaam, gender, email of leeftijd nodig. Met dit programma kan je MySQL of SQLite database populeren met gebruikers of de module gebruiken om een eigen populatie programma te maken.

PyPi package: https://pypi.org/project/worldnames/

# Installation manual for the Populating program

1. Clone the repository (**required**)

```commandline
git clone https://github.com/ayoub-abdessadak/world-names.git
```

2. Create a python virtual environment (**optional**)
```commandline
python -m venv venvworldnames
```
3. Activate the python virtual environment (**optional**)
```commandline
source venvworldnames/bin/activate
```

3.1 If you're on windows you can activate the virtual environment as is (**optional**)
```commandline
.\venvworldnames\Scripts\activate
```

4. Navigate to the repository (world-names) and install the required packages (**required**)
```commandline
pip install -r requirments.txt
```
5. Run the population simulator 
```commandline
python -m worldnames.populate
```
Or use the worldnames module to populate you're database:

1. Install the worldnames module (**required**)
```commandline
pip install worldnames
```
2. Use the worldnames module in you're python program
```python
import worldnames

worldnames.full_name() # returns 'Ashanti Qjtkbyh' for example. Type is a string.

worldnames.first_name() # returns 'Teodor' for example. Type is a string.

worldnames.last_name() # returns 'Pmgnwzqls' for example. Type is a string.

worldnames.age() # returns 50 for example. Type is an int.

worldnames.gender() # returns male for example. Type is a string.

worldnames.email() # returns 'Ashanti.Qjtkbyh@gmail.com' for example. Type is a string.

worldnames.email('Ashanti', 'Qjtkby') # It is possible to pass a first_name and last_name to the email method.

worldnames.user() # Returns all the attributes above in a tuple, for example: ('Cuauhtémoc', 'Sfzn', 'Woman', 88, 'Cuauhtémoc.Sfzn@outlook.com'). Type is an tuple.

worldnames.phone_number() # Returns a random phone number 
```