Introducing cookiecutter-fastpi
: a template for FastAPI powered by cookiecutter. This template simplifies the process of initializing a versatile project directory. It's designed to be language-neutral and cloud-platform agnostic.
- Install
git
andcookiecutter
: Before generating your FastAPI project, ensure you have bothgit
andcookiecutter
installed:- Update your packages:
sudo apt update && sudo apt install git -y
- Upgrade pip (Python package installer):
python3 -m pip install --upgrade pip
- Install
cookiecutter
:python3 -m pip install --user cookiecutter
- Update your packages:
-
Create your FastAPI project: Use the template from this repository. During this step, you'll be prompted for details like project name, customer/client details, description, author information, and more:
cookiecutter https://github.com/lucasmtz/cookiecutter-fastapi
- Example prompts:
- Project Name:
propensity-buy-ecommerce
- Customer or Client Name:
Some Big Company
- Project Description:
A data science project for a big company
- Authors:
John Doe,Jane Doe
- Author Emails:
[email protected],[email protected]
- License Choice:
1
- Python Version:
x
,x.x
orx.x.x
(If provided input isn't valid, it defaults to the most recent Python 3.x version.) - DVC Remote Name:
YourChosenName
- DVC Remote URL: This can be a local path or remote storage. Examples:
gs://my-bucket
or/path/to/local/storage
. If you choose a remote storage, ensure the remote location has been set up before executing. Using remote storage is recommended for collaborative projects.
- Project Name:
- Example prompts:
Note: This template initializes various configurations, such as updating
apt
, setting uppyenv
,poetry
, installing dependencies, setting up pre-commit hooks, initializingdvc
, and creating the initial commit. If any of these configurations aren't required, or if you wish to make modifications, you should fork the repository and then adjust or remove items from thehooks
directory accordingly.
- Access your new project directory: Once the project is generated, navigate to its directory and optionally open it in Visual Studio Code:
cd propensity_buy_ecommerce code .
By following these steps, you're on your way to developing a robust FastAPI project. Happy coding!