semvec/pypi-packages huggingface dataset:
ormic 1.0.0
A simple, asynchronous python ORM for SQLite databases
License: MIT
Keywords: database,ORM

<center>
    <h1>ormic</h1>
    <h3>A simple, asynchronous python ORM for SQLite databases</h3>
</center>

## Installation
```sh
# stable
$ pip install ormic

# unstable
$ pip install git+https://github.com/Dorukyum/ormic
```

## Quickstart
```py
from ormic import Database, Model

db = Database()

# create a model
@db.model
class Point(Model):
    name: str
    x: int
    y: int = 5  # default value

# connect to a database
await db.connect("database.db")
```

## Database Actions
```py
# create an object
point = Point(name="A", x=5, y=10)
await point.save()

# fetch objects from the database
point_named_A: Point | None                = await Point.fetch(name="A")
list_of_points_named_A: list[Point] | None = await Point.fetch_all(name="A")

# update an object
await point.update(y=15)
# or
point.y = 15
await point.update()

# delete an object
await point.delete()
```

## Caching
```py
# turn caching on
# setting limit to 20 will only cache the last fetched 20 objects
# this parameter defaults to None, caching all fetched objects
database.set_caching(on=True, limit=20)

# get the object from the cache
# will fetch from the database if no matches found
point_named_A = await Point.get_or_fetch(name="A")
```
unshell 0.7.0
Set your shell free !
License: MIT
Requires Python: >=3.8.5,<4.0.0
Keywords: shell subprocess scripting

# ![un](./unshell.png) shell

> Set your shell free !

Combine python and shell command.


## Features

* **Light**: There are no dependencies
* **Async**: Work with async/await
* **Testable**: Unshell script are easily testable because they yield execution control


## Setup

```sh
pip install unshell
alias unshell=$(pip show unshell | grep Location | cut -d: -f2)/unshell/cli.py
```


## Usage

### Execute script through Shell
```
Execute script through unshell runtime

Usage:
  unshell COMMAND [SCRIPT_PATH] [ARGS...]

Commands:
  help      Print this help message
  run       run a script through unshell runtime
```

Given the script: `pause.py` to pause all docker containers
```py
def pause():
  ids = yield from fetchContainerIds()

  for id in ids:
    yield f"docker pause {id}"


def fetchContainerIds():
  ids = yield f"docker ps -q --no-trunc"

  return ids.splitlines()
```

Run it through unshell
```sh
unshell run pause.py
```


### Embedded script inside apps
Given the precedent script `pause.py`
```py
from unshell import Unshell
import os

def main():
    script = resolve('./scripts/pause.js') # resolve your python module
    
    try:
        Unshell({"env": os.environ})(script)
    except Exception as err:
        print(err)

```


## Examples
Here is some examples of what you can do with unshell
- [Pause containers](examples/pause-resume-container)

## Contribute
```sh
poetry config --local virtualenvs.in-project true
poetry shell
make install
watch make dev
```

## License

The code is available under the [MIT license](LICENSE.md).