>>> python3 -m venv venv
>>> pip install -r requirements.txt
Create a .env
file (use .example-env as a reference) and then run following command.
>>> source .env
>>> python main.py
- Add models to
models.py
example for a model class:
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
user_name = Column(String, unique=True)
first_name = Column(String)
last_name = Column(String)
phone = Column(String)
user_type = Column(String)
email = Column(String, unique=True, index=True)
password = Column(String)
- Create a revision
>>> PYTHONPATH=. alembic revision --autogenerate -m "..."
- Running migrations
>>> PYTHONPATH=. alembic upgrade head
>>> pylint `pwd`
NOTE: The above cmd is tested on ubuntu.
>>> pytest tests/
Pytest docs
Fastapi testing docs
>>> coverage run -m pytest tests/
>>> coverage report
>>> coverage html
>>> sudo docker image build .
>>> sudo docker run -d --name myapp 8080:80 <image>
We are using Circleci for CI.
Steps to setup
- Go to CircleCI.
- Connect you github account.
- you can simply follow the steps there to set up your project there.
- Update
.circleci/config.yml
as per your need.
Important links for CI