Use Poetry and start and instance of PostgreSQL
This commit is contained in:
parent
86e44cdf05
commit
e18ce186da
|
@ -0,0 +1,28 @@
|
||||||
|
[tool.poetry]
|
||||||
|
name = "odapi"
|
||||||
|
version = "0.1.0"
|
||||||
|
description = "Odyfo RESTful API"
|
||||||
|
authors = ["coolneng <akasroua@gmail.com>"]
|
||||||
|
license = "GPL-3.0-or-later"
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.8"
|
||||||
|
fastapi = "^0.63.0"
|
||||||
|
uvicorn = "^0.13.3"
|
||||||
|
pydantic = "^1.7.3"
|
||||||
|
email-validator = "^1.1.2"
|
||||||
|
SQLAlchemy = "^1.3.23"
|
||||||
|
alembic = "^1.5.4"
|
||||||
|
twilio = "^6.51.1"
|
||||||
|
passlib = "^1.7.4"
|
||||||
|
bcrypt = "^3.2.0"
|
||||||
|
psycopg2 = "^2.8.6"
|
||||||
|
|
||||||
|
[tool.poetry.dev-dependencies]
|
||||||
|
pytest = "^6.2.2"
|
||||||
|
isort = "^5.7.0"
|
||||||
|
pyflakes = "^2.2.0"
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
41
shell.nix
41
shell.nix
|
@ -2,22 +2,27 @@
|
||||||
|
|
||||||
with pkgs;
|
with pkgs;
|
||||||
|
|
||||||
mkShell {
|
let
|
||||||
buildInputs = [
|
sql_file = "assets/db_creation.sql";
|
||||||
# Dependencies
|
data_dir = "$(pwd)/.pgdata";
|
||||||
python38Packages.fastapi
|
|
||||||
python38Packages.uvicorn
|
in mkShell {
|
||||||
python38Packages.pydantic
|
buildInputs = [ python38 poetry postgresql ];
|
||||||
python38Packages.email_validator
|
|
||||||
python38Packages.sqlalchemy
|
shellHook = ''
|
||||||
python38Packages.alembic
|
trap "kill 0" EXIT
|
||||||
python38Packages.pytest
|
export PGDATA="${data_dir}"
|
||||||
python38Packages.twilio
|
export PGHOST="${data_dir}"
|
||||||
python38Packages.passlib
|
|
||||||
python38Packages.bcrypt
|
if [ ! -d ${data_dir} ]; then
|
||||||
sqlite
|
initdb --auth-local=trust --no-locale --encoding=UTF8
|
||||||
# Development tools
|
fi
|
||||||
python38Packages.isort
|
|
||||||
python38Packages.pyflakes
|
if ! pg_ctl status; then
|
||||||
];
|
pg_ctl start -o "--unix_socket_directories=${data_dir} --listen_addresses='''"
|
||||||
|
fi
|
||||||
|
|
||||||
|
psql -d postgres -f ${sql_file}
|
||||||
|
alias psql='psql -d postgres'
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue