This project conforms to 12-factor methodology. The 12-Factor methodology is a set of best practices for building modern, scalable, maintainable software-as-a-service apps. These principles were first presented by engineers at Heroku, a cloud platform as a service (PaaS) company. Following are the salient points of how this project adopts these best practices.
-
- Codebase: [✅] One codebase tracked in revision control, many deploys
-
- Dependencies: [✅] Explicitly declare and isolate dependencies. We're using a Python virtual environment along with a requirements.txt file to manage package versions. We also use Dependabot and Mergify on GitHub Actions to periodically monitor and update package versions.
-
- Config: [✅] Store config in the environment. This project implements a special .env file, which locally stores all configuration information for the package.
-
- Backing services: [✅] Treat backing services as attached resources. We're using remote OpenAI Api and MySql
-
- Build, release, run: [✅] Strictly separate build and run stages. 1-click
init,build,test,run,releaseandtear-downare implemented in Makefile.
- Build, release, run: [✅] Strictly separate build and run stages. 1-click
-
- Processes: [✅] Execute the app as one or more stateless processes. Our app runs from the command line, but it could be repurposed as a backing service for a REST Api.
-
- Port binding: [✅] Export services via port binding. This could be implemented as micro service listening on ports 80 and 443.
-
- Concurrency: [✅] Scale out via the process model. We implement a single, stateless agentic workflow in this app.
-
- Disposability: [✅] Maximize robustness with fast startup and graceful shutdown. Makefile implemenent
tear-downas a 1-click way to dispose of the environment.
- Disposability: [✅] Maximize robustness with fast startup and graceful shutdown. Makefile implemenent
-
- Dev/prod parity: [✅] Keep development, staging, and production as similar as possible. The repo for this project has
alpha,beta,next, andmainbranches.
- Dev/prod parity: [✅] Keep development, staging, and production as similar as possible. The repo for this project has
-
- Logs: [✅] Treat logs as event streams. We get this "for free" from Python logging.
-
- Admin processes: [✅] Run admin/management tasks as one-off processes. All admin processes are implemented with GitHub Actions and other GitHub management features.
Where and when possible, we enforce strong data typing within the source code via type hints and annotations. Additionally, we leverage pre-commit to enforce code formatting, linting and to check all of the following on each commit:
codespell................................................................Passed
prettier.................................................................Passed
black................................................(no files to check)Skipped
flake8...............................................(no files to check)Skipped
isort................................................(no files to check)Skipped
pylint...............................................(no files to check)Skipped
bandit...............................................(no files to check)Skipped
fix utf-8 byte order marker..............................................Passed
fix python encoding pragma (deprecated)..............(no files to check)Skipped
check for case conflicts.................................................Passed
check json...........................................(no files to check)Skipped
check for merge conflicts................................................Passed
check for broken symlinks............................(no files to check)Skipped
check toml...............................................................Passed
check xml............................................(no files to check)Skipped
check yaml...........................................(no files to check)Skipped
detect destroyed symlinks................................................Passed
detect aws credentials...................................................Passed
detect private key.......................................................Passed
fix end of files.........................................................Passed
trim trailing whitespace.................................................Passed
check for case conflicts.................................................Passed
check for merge conflicts................................................Passed
debug statements (python)............................(no files to check)SkippedFinally, we use semantic-release from Node.js via GitHub Actions to automate version bumps and package releases.