semvec/pypi-packages huggingface dataset:
happy-tools 1.0.0
Handy utilities to make everyday Python users happy.
License: MIT
Requires Python: >=3.5

# happy
Library with tools that make any everyday Python user simply happy.

[Documentation](https://github.com/jankukacka/happy/wiki/Documentation)


## Installation

```
pip install happy_tools=1.0.0
```

To keep the library installation lightweight, additional dependencies for file IO are not installed by default.

## License

The software is provided under the [MIT open license](LICENSE.txt).

## Citation
If you use this software for your research, please cite it as:
```
Kukačka, Jan (2021). Happy (v1.0.0) [Computer software]. https://github.com/jankukacka/happy
```
django-admin-material-able 0.2
A Django admin based on material design.
License: MIT
Requires Python: >=3.8

================================
Django admin material able V:0.1
================================

Django material admin is a Django admin based on material design.

This django app is tested on python 3.8 and django 3.0

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

1. Add "material_admin" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        'material_admin',
        'django.contrib.admin',
        ...
    ]

2. Run ``python3 manage.py runserver`` to start server.

3. Visit http://127.0.0.1:8000/admin/
fastsecurity 0.1.11
Authentication for FastAPI
License: MIT
Requires Python: >=3.8,<4.0

## Fast Security

Authentication for [FastAPI](https://fastapi.tiangolo.com/) applications.

## Installation

```
pip install fastsecurity
```

## Usage

There are 4 [FastAPI Dependencies](https://fastapi.tiangolo.com/tutorial/dependencies/) provided by this module.

```python
from fastsecurity import Security, Principal, Secured, Authentication
```

### Security

Use `Security()` as a global dependency.

```python
app = FastAPI(dependencies=[Depends(Security(
    token_secret="your app's secret"
))])
```

Please generate a `token_secret` to secure your application like:

```
openssl rand -hex 32
```

### Principal

`Principal()` is used to get the current authenticated user.

```python
@app.get("/")
async def home(principal: Principal = Depends(Principal())):
    return {"token": principal.token}
```

### Secured

`Secured()` is used to secure a path.

```python
@app.get("/secured", dependencies=[Depends(Secured())])
async def user(principal: Principal = Depends(Principal())):
    return {"token": principal.token}
```

`Secured()` accepts a list of role names.

```python
@app.get("/user", dependencies=[Depends(Secured("user", "admin"))])
async def user():
    return {"role": "user"}


@app.get("/admin", dependencies=[Depends(Secured("admin"))])
async def admin():
    return {"role": "admin"}
```

### Authentication

`Authentication()` has utility functions for login and password hashing.

```python
users_db = {
    "user": {
        "roles": ["user"],
        "password": "$2b$12$1SzM3c4u/WE6mnZKzT/6h.ZKJRBVMAk1eNdXJF8ImvKy0gPdHZeve"
    },
    "admin": {
        "roles": ["user", "admin"],
        "password": "$2b$12$1SzM3c4u/WE6mnZKzT/6h.ZKJRBVMAk1eNdXJF8ImvKy0gPdHZeve"
    }
}

@app.post("/login")
async def token(auth: Authentication = Depends(Authentication())):
    user: dict = users_db.get(auth.form_data.username)

    if user:
        if auth.verify_password(auth.form_data.password, user.get("password")):
            token = auth.create_access_token(
                sub=auth.form_data.username,
                roles=user.get("roles")
            )
            return {"token": token}

    raise HTTPException(status_code=401, detail="Unauthorized")
```

## Backend

This module does not provide any backend for user management.

## Warning

This library is in development. Please do not use for critical work.
djang-admin-material 0.1
A Django admin based on material design.
License: MIT
Requires Python: >=3.8

===========================
Django material admin V:0.1
===========================

Django material admin is a Django admin based on material design.

This django app is tested on python 3.8 and django 3.0

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

1. Add "material_admin" to your INSTALLED_APPS setting like this::

    INSTALLED_APPS = [
        'material_admin',
        'django.contrib.admin',
        ...
    ]

2. Run ``python3 manage.py runserver`` to start server.

3. Visit http://127.0.0.1:8000/admin/
slurmer 1.0.7
A package to schedule different tasks in parallel with cluster support.
License: MIT
Requires Python: >=3.10,<4.0

# Slurmer

This package is designed to run heavy loads in a computer cluster. Supported task schedulers are:

- Running on a single node
- [SLURM](https://slurm.schedmd.com/documentation.html)

PRs to add more schedulers are welcome.

## Features

- Run multiple tasks in parallel.
- Run tasks in randomised order but consistently in multiple computing nodes.
- Consistent pipeline to work with heavy tasks (directory creation, handling errors, postprocessing...)

## Example

You can find the documentation [here](https://jmigual.github.io/slurmer/). 

The package can be used as follows:

```python
from dataclasses import dataclass
from pathlib import Path
from typing import Iterator

import slurmer


@dataclass
class MyTaskParameters(slurmer.TaskParameters):
    processing_id: int


@dataclass
class MyTaskResult(slurmer.TaskResult):
    good_result: bool


class MyTask(slurmer.Task):

    def __init__(self, min_job: int, max_job: int):
        super().__init__()
        self.min_job = min_job
        self.max_job = max_job

    def generate_parameters(self) -> Iterator[MyTaskParameters]:
        for i in range(self.min_job, self.max_job):
            yield MyTaskParameters(processing_id=i)

    def make_dirs(self):
        # Dirs are created before the task is run
        for i in range(self.min_job, self.max_job):
            Path(f"out/result_{i}").mkdir(parents=True, exist_ok=True)

    def process_function(self, parameters: MyTaskParameters) -> MyTaskResult:
        # Run your heavy code here
        for i in range(parameters.processing_id, parameters.processing_id + 10):
            print(f"Processing {i}")

        return MyTaskResult(good_result=True)

    def process_output(self, result: MyTaskResult) -> bool:
        # Postprocess output, this is NOT run in parallel and only handles the tasks run 
        # in the current node. If you want to postprocess everything wait for all the nodes
        # to finsish computing.
        #
        # This function should check whether the output is the "expected" one and return True 
        # if something went wrong.
        return not result.good_result
```

Then in your main script:
```python
>>> task = MyTask(min_job=1, max_job=10)
>>> task.execute_tasks()
```