-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use Pipfile and pipenv to manage dependencies for backend (#32)
* feat: use pipenv for dependencies * fix: added required python-multipart package * refactor: renamed TestUserType to UserType inorder to prevent pytest warnings * chore: updated readme files * feat: use pipenv in run-windows.cmd install command * ci: updated test ci to use pipenv * chore: use pipenv run instead of using .venv packages directly * ci: removed cache from setup-python action * ci: use pipenv as cache key in setup-python action * chore: updated backend dependencies * chore: updated render.yaml to use pipenv instead * ci: run pytest via python
- Loading branch information
Showing
25 changed files
with
1,093 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,8 @@ | |
"autouse", | ||
"DOESNT", | ||
"fastapi", | ||
"pipenv", | ||
"Pipfile", | ||
"pydantic", | ||
"sessionmaker", | ||
"sqlalchemy", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
bcrypt = "~=4.1.3" | ||
fastapi = "~=0.109.2" | ||
pydantic-settings = "~=2.0.2" | ||
greenlet = "~=3.0.1" | ||
joserfc = "~=0.10.0" | ||
sqlalchemy = "~=2.0.19" | ||
psycopg = {extras = ["binary", "pool"], version = "*"} | ||
uvicorn = "~=0.23.2" | ||
httpx = "~=0.26.0" | ||
python-multipart = "~=0.0.6" | ||
|
||
[dev-packages] | ||
black = "~=24.8.0" | ||
isort = "~=5.13.2" | ||
pylint = "~=3.3.1" | ||
pytest = "~=8.3.3" | ||
|
||
[requires] | ||
python_version = "3.12" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,51 @@ | ||
This is the backend app for my project management app. | ||
|
||
## Building the project | ||
First you will need to install the packages from requirements.txt | ||
for instance if you want to use venv then run: | ||
|
||
First you will need to install the packages from the Pipfile: | ||
|
||
```bash | ||
pipenv install | ||
``` | ||
|
||
If you don't have pipenv, please follow the [official pipenv instructions](https://pipenv.pypa.io/en/latest/installation.html#preferred-installation-of-pipenv) first inorder to install it. | ||
|
||
- this project requires python 3.12 or greater | ||
- if you want to install dev dependencies as well (which includes linters) run this command instead: | ||
|
||
```bash | ||
# create venv | ||
python -m venv venv | ||
# activate the venv | ||
... depends on os | ||
pip install -r requirements.txt | ||
pipenv install --dev | ||
``` | ||
* this project requires python 3.12 or greater | ||
|
||
instead. | ||
|
||
## Add env variables | ||
|
||
All required env variables are in .env.raw file. Create a new .env file from that template and fill in your own variables | ||
For instance the final .env file in DEV mode would look like this (last update 2023/12/13): | ||
|
||
```bash | ||
# .env contents | ||
ALLOWED_ORIGINS = ["http://localhost", "http://localhost:4173", "http://localhost:5173", "http://localhost:5174"] | ||
SQLALCHEMY_DATABASE_URL = "sqlite:///./todos.db" | ||
SQLALCHEMY_DATABASE_URL = "sqlite:///./todos.db" | ||
IS_SQLALCHEMY_LOG_ENABLED = True | ||
``` | ||
|
||
## Running the project | ||
If you are using vscode you can simply use the run&debug to run the backend app after doing the mentioned steps. | ||
|
||
If you are using vscode you can simply use the run&debug to run the backend app after doing the mentioned steps. | ||
You can also run the app manually with: | ||
|
||
```bash | ||
python -m uvicorn main:app --reload --port 8080 | ||
``` | ||
After running the project goto | ||
http://127.0.0.1:8080/docs | ||
|
||
After running the project goto | ||
http://127.0.0.1:8080/docs | ||
for a web based swagger docs. | ||
|
||
## Tests | ||
|
||
For tests to work you need to create a `.env.integration` file. In this file override the database connection string to a test database. | ||
UI tests connect should connect to an instance running in port `8090` for instance which | ||
connects to the test database instead. | ||
UI tests connect should connect to an instance running in port `8090` for instance which | ||
connects to the test database instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.