A brief description of the project.
-
Clone the repository.
-
Install the required dependencies using pip:
pip install -r requirements.txt
The pre-commit git hooks consists on run some checks before confirm or commit your staged changes on the local repo, the .pre-commit-config.yml file contains the checks.
https://pre-commit.com/
https://pypi.org/project/pre-commit/
To set it up, you need to run this command on the root folder of the project
(venv)$ pre-commit install
It runs each time you try to commit your changes, or you can just run it manually
(venv)$ pre-commit run --all-files
The following local checks are implemented:
- Linting with PyLint
(venv)$ pylint *
Start the application using the following command:
docker-compose up --build
If it fails: "set: illegal option -"
Try this: sed -i 's/\r$//' entrypoint.sh
Then, open your web browser and navigate to: http://localhost:8000/docs
-
Add debug configuration in
.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Python: Remote Attach", "type": "python", "request": "attach", "port": 5678, "host": "localhost", "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "/app" } ] } ] }
-
Add some breakpoints.
-
Start the application using the following command:
docker-compose -f docker-compose.debug.yml up
-
Click
Python: Remote Attach
buttom in Run And Debug sidebar.
-
Add debug configuration in
.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Python: Remote Attach", "type": "python", "request": "attach", "port": 5678, "host": "localhost", "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "/app" } ] } ] }
-
Run
docker-compose up --build
-
Run
debug_startup.sh
-
Click
Python: Remote Attach
buttom in Run And Debug sidebar.
-
Add debug configuration in
.vscode/launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Python: Remote Attach", "type": "python", "request": "attach", "port": 5678, "host": "localhost", "pathMappings": [ { "localRoot": "${workspaceFolder}", "remoteRoot": "/app" } ] } ] }
-
Modify
kernel.json
{
"argv": [
"python",
"-m",
"debugpy",
"--wait-for-client",
"--listen",
"0.0.0.0:5678",
"-m",
"src.service.ykernel.ykernel",
"-f",
"{connection_file}"
],
"display_name": "YKernel"
}
-
Run
docker-compose up --build
-
Click
Python: Remote Attach
buttom in Run And Debug sidebar.
To run the tests, execute the following command:
docker-compose exec fastapi python -m pytest -s src/tests
-
Fork the repository.
-
Create a new branch:
git checkout -b my-new-feature
-
Make changes and commit them:
git commit -am 'Add some feature'
-
Push to the branch:
git push origin my-new-feature
-
Submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.