From 274aa083c7a4af789a6c2b1901fbcf3b7ba5bee4 Mon Sep 17 00:00:00 2001 From: Narayan Bandodker Date: Sat, 2 Nov 2024 12:58:04 +0530 Subject: [PATCH] Updated README --- README.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index a77a3ac..e1a11dd 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ Note that this is a template project. You will need to make changes to this appl ## Development setup +### Prerequisites + 1. (Optional) Install Pyenv ([Linux](https://github.com/pyenv/pyenv), [Windows](https://github.com/pyenv-win/pyenv-win)) and the [Python installation](.python-version) needed for this project: ```shell pyenv install @@ -18,13 +20,18 @@ pyenv install > [!IMPORTANT] > You should **NOT** install poetry into your virtual environment as stated in their docs, as this may mess with your dependencies. -3. Create a virtual environment: +### Setup + +1. Create a virtual environment: ```shell # Note: For POSIX, pyenv can create a named virtual environment which you can use instead. # For Windows, pyenv-win exists, but doesn't have this feature afaik. +# Create a local virtual environment (inside .venv/) python3 -m venv .venv +# Activate it: + # Windows ./.venv/Scripts/activate @@ -32,24 +39,28 @@ python3 -m venv .venv source ./.venv/bin/activate ``` -4. [Windows] Run the `scripts/dev-setup.bat` script: +2. Create development environment and install dependencies (pre-made script does it): + ```shell +# [Windows] Run the `scripts/dev-setup.bat` script: ./scripts/dev-setup.bat -``` -4. [POSIX] Run the `scripts/dev-setup.sh` shell script using any bash-compatible shell: -```shell +# [POSIX] Run the `scripts/dev-setup.sh` shell script using any bash-compatible shell: bash ./scripts/dev-setup.sh ``` -5. Create a `.env` file from the given example and edit it: +> [!NOTE] +> This scripts does the following: +> Creates a `dev/` folder needed to save log files and other persistent files used by the app, installs the requirements of the app using poetry, installs `pre-commit` hooks to this repository and also runs the pre-commit hooks. + +3. Create a `.env` file from the given example and edit it: ```shell cp .env.example .env # Open the new .env file in your favourite editor and make the required changes ``` -6. Run the dev server using `F5` key in VSCode. You can also use the `dev-launch` shell script: +4. Run the dev server using `F5` key in VSCode. You can also use the `dev-launch` shell script: ```shell # Windows ./scripts/dev-launch.bat @@ -58,7 +69,7 @@ cp .env.example .env bash ./scripts/dev-launch.sh ``` -7. You can also run the cli script: +5. You can also run the cli script: ```shell sample-fastapi --help ```