Skip to content

Commit

Permalink
add optional dependencies (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
aminalaee authored Aug 16, 2021
1 parent bbe4d12 commit 782f76b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@ database migrations.

**ORM is still under development: We recommend pinning any dependencies with `orm~=0.1`**

---

## Installation

```shell
$ pip install orm
```

You can install the required database drivers with:

```shell
$ pip install orm[postgresql]
$ pip install orm[mysql]
$ pip install orm[sqlite]
```

Driver support is provided using one of [asyncpg][asyncpg], [aiomysql][aiomysql], or [aiosqlite][aiosqlite].
Note that if you are using any synchronous SQLAlchemy functions such as `engine.create_all()` or [alembic][alembic] migrations then you still have to install a synchronous DB driver: [psycopg2][psycopg2] for PostgreSQL and [pymysql][pymysql] for MySQL.

---

## Quickstart

**Note**: Use `ipython` to try this from the console, since it supports `await`.

```python
Expand Down Expand Up @@ -179,6 +202,13 @@ See TypeSystem for [type-specific validation keyword arguments][typesystem-field
* `orm.JSON()`

[sqlalchemy-core]: https://docs.sqlalchemy.org/en/latest/core/
[alembic]: https://alembic.sqlalchemy.org/en/latest/
[psycopg2]: https://www.psycopg.org/
[pymysql]: https://github.com/PyMySQL/PyMySQL
[asyncpg]: https://github.com/MagicStack/asyncpg
[aiomysql]: https://github.com/aio-libs/aiomysql
[aiosqlite]: https://github.com/jreese/aiosqlite

[databases]: https://github.com/encode/databases
[typesystem]: https://github.com/encode/typesystem
[typesystem-fields]: https://www.encode.io/typesystem/fields/
6 changes: 6 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ def get_packages(package):
package_data={PACKAGE: ["py.typed"]},
data_files=[("", ["LICENSE.md"])],
install_requires=["databases>=0.2.1", "typesystem"],
extras_require={
"postgresql": ["asyncpg"],
"mysql": ["aiomysql"],
"sqlite": ["aiosqlite"],
"postgresql+aiopg": ["aiopg"]
},
classifiers=[
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
Expand Down

0 comments on commit 782f76b

Please sign in to comment.