This page describes the directory layout and the application structure of GeniePy.
The initial directory structure looks as follows:
~/W/p/geniepy/code main ❯ tree -L 1 . . ├── app ├── .ci.env ├── dist ├── docker-compose.yml ├── Dockerfile ├── fly.toml ├── .github ├── .gitlab-ci.yml ├── heroku.yml ├── Makefile ├── .pre-commit-config.yaml ├── Procfile ├── pyproject.toml ├── README.md ├── render.yaml ├── requirements.in ├── requirements.txt ├── sample.env ├── setup.cfg ├── tasks.py └── .test.env 3 directories, 18 files
app directory contains all the application source code. We'll talk about
this in detail in a later section.
This file contains CI specific environment variables used on Github Actions and Gitlab CI for the tests to work in this environment.
As mentioned before, we're using
docker-compose for local development.
docker-compose.yml specifies the containers to start.
The default configuration GeniePy ships with includes the following 2 containers:
postgres: PostgreSQL container that the app process connects to for persisting data
postgres_test: similar to the postgres container, but only used for hosting the test database
uvicorn process runs on the host machine (i.e. outside of Docker).
Dockerfile defines the container image for the Starlette / Uvicorn
GeniePy supports Fly.io as one of the deployment targets.
Fly.io allows developers to configure their application stacks using TOML
configuration files. We've added an initial configuration to
you're welcome to extend if you use this deployment target.
GeniePy support Github Actions as one of the Continuous Integration targets.
This directory contains the workflow definitions that will enable continuous testing for your application, if you've chosen Github as the source code hosting service.
GeniePy support Gitlab CI as one of the Continuous Integration targets.
This directory contains the workflow definitions that will enable continuous testing for your application, if you've chosen Gitlab as the source code hosting service.
GeniePy supports Heroku as one of the deployment targets.
Heroku allows developers to deploy their applications inside containers. We've
included an initial build configuration to
heroku.yml that lets Heroku know
how to build the application (which is through Docker).
If you choose Heroku as your deployment target, you're welcome to extend this file depending on your application's needs.
Make is a build automation tool that also acts as a great task runner.
Makefile we've defined shortcuts for a few commands that you would need to
initialize the local development environment and to maintain the pip dependency
The rest of the task definitions are specified using Invoke.
We use the pre-commit framework for managing Git's pre-commit hooks.
This YAML file specifies pre-commit's configuration.
This file is mainly for use for Heroku and lets Heroku know which processes to run in the server environment and how to run them.
pyproject.toml is a new standard introduced by the Python developers to
specify build system information for Python projects.
This file also supports adding configuration for different Python tools. This is also what GeniePy uses this file for.
At the time of this writing, GeniePy specifies the configuration for
this file under a
This file contains the project's README. We've left the file empty so you can fill it up with details about your project.
GeniePy supports Render as one of the deployment targets.
Render supports the Infrastructure as Code philosophy by letting users define
their services inside a
render.yaml file. We've specified the base
configuration in this file, which you're welcome to extend if you are deploying
your app on Render.
GeniePy uses pip-tools to help you keep your project's dependencies pinned and fresh.
requirements.in specifies the project's (first-level) dependencies pinned to
their exact versions. The contents of this file are specified in the
requirements.txt file format which
Using this file as input, the
pip-compile CLI bundled in pip-tools helps us
generate the entire dependency tree with all the dependencies pinned to their
requirements.txt file contains the entire dependency tree of our project.
This file is auto-generated using the
pip-compile CLI, and as such, should NOT
be edited by hand.
If you have adjusted
requirements.in and would like to have
reflect the change, please run
This file acts as a starting point for the environment variables for your application.
If you're initializing a new application, copy this file to
.env and edit
.env to have your application reflect the changes.
setup.cfg file is another way to store configuration for Python tools.
GeniePy stores the
flake8 configuration in this file.
tasks.py file defines the common development task definitions you'll
usually run during the course of your project. This includes, for instance,
running style checks, running tests using
pytest, executing database
invoke --list to see a complete list of what's available.
.test.env file contains environment variables specific to running tests
(eg. the database URL pointing to the test database container, etc.).