Skip to content

Commit

Permalink
Documentation changes
Browse files Browse the repository at this point in the history
* Make `poetry` not part of the setup as it needs to be a separate pre-installed package.
  • Loading branch information
nb-programmer committed Nov 2, 2024
1 parent 7092d56 commit 87baf41
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
SECRET_KEY = "SecretSecretSecret!"
UVICORN_PORT = 8000
25 changes: 15 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,38 +13,43 @@ Note that this is a template project. You will need to make changes to this appl
pyenv install
```

2. Create a virtual environment:
2. [Install poetry](https://python-poetry.org/) to your system by following the [setup instructions](https://python-poetry.org/docs/#installation) convenient for you.

> [!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:
```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.

python3 -m venv venv
python3 -m venv .venv

# Windows
./venv/Scripts/activate
./.venv/Scripts/activate

# POSIX
source ./venv/bin/activate
source ./.venv/bin/activate
```

3. [Windows] Run the `scripts/dev-setup.bat` script:
4. [Windows] Run the `scripts/dev-setup.bat` script:
```shell
./scripts/dev-setup.bat
```

3. [POSIX] Run the `scripts/dev-setup.sh` shell script using any bash-compatible shell:
4. [POSIX] Run the `scripts/dev-setup.sh` shell script using any bash-compatible shell:
```shell
bash ./scripts/dev-setup.sh
```

4. Create a `.env` file from the given example and edit it:
5. 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 changes
# Open the new .env file in your favourite editor and make the required changes
```

5. Run the dev server using `F5` key in VSCode. You can also use the `dev-launch` shell script:
6. Run the dev server using `F5` key in VSCode. You can also use the `dev-launch` shell script:
```shell
# Windows
./scripts/dev-launch.bat
Expand All @@ -53,7 +58,7 @@ cp .env.example .env
bash ./scripts/dev-launch.sh
```

6. You can also run the cli script:
7. You can also run the cli script:
```shell
sample-fastapi --help
```
2 changes: 1 addition & 1 deletion sample_fastapi/app/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class BaseAppSettings(BaseSettings):

class AppSettings(BaseAppSettings):
"""Main application-specific settings"""
app_base_url: AnyUrl = "http://localhost:8000"
app_base_url: AnyUrl = Field(default=AnyUrl("http://localhost:8000"))


class AppDirectories(BaseAppSettings):
Expand Down
3 changes: 0 additions & 3 deletions scripts/dev-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
echo Creating "dev" folder...
mkdir "dev/"

echo Installing poetry...
python3 -m pip install -q poetry

echo Installing requirements (all with dev)...
poetry -q install --with dev,test

Expand Down
3 changes: 0 additions & 3 deletions scripts/dev-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
echo 'Creating "dev" folder...'
mkdir "dev/"

echo 'Installing poetry...'
python3 -m pip install poetry

echo 'Installing requirements (all with dev)...'
poetry install --with dev,test

Expand Down

0 comments on commit 87baf41

Please sign in to comment.