/test-pr

Primary LanguagePython

Note

  1. Read TEMPLATE.md and update github settings like it explains.
  2. Update this readme/delete this note.
  3. To use this template, select 'Use this template' option and create a new repository from it.

test2

Python Project Template

Write something useful about the app/script you are making, what it does/solves.



🧑‍🏭 Work in progress

  • todo 1
  • todo 2
  • todo 3




💡Info

  • See gitops repo for link to deployment/vault etc
  • See pyproject.toml for contact info/open api tag info
  • See action_config.toml for gitops/docker config




🔗Links

Common:

Test:

Prod:




✍️ How to update code

This project uses protected main branch. So all updates have to go through pull request.

This project also forces Squash merge, so all your commits in a branch will only be 1 commit on main, so please try and stick to 1 fix or feature per pull request if possible.

All pull request will need to start with fix/feat/chore, and you need to label it with a release label. We also run pylint and a few other checks on you code.




👶First time using this project (local git clone)

If you use vscode then go under under extension tab, search @recommended and install them

  • Create virtual environment: python -m venv ./venv
  • Activate virtual environment: ./venv/Scripts/activate
  • Install dependencies: pip install -r requirements.txt
  • Add .env file (see own section)
  • Start application: python ./src/main.py
  • ... open webpage ?




👶First time using this project (dev container vscode)

Install vscode extension ms-vscode-remote.remote-containers

  • click bottom left corner Open a Remote Window, looks like 2 arrows
  • select repository
  • select Open Repository from github.
  • sign inn if needed
  • search for python-app-template and open it
  • when its loaded, click button left corner again
  • now select Continue Working in Container Volume




👴🏻 Not first time using this project:

Next time only run

  • Activate virtual environment: ./venv/Scripts/activate
  • Start application: python ./src/main.py
  • ...open web page ?




🐛 Debug vscode issues:

If you are not able to debug, do this:

  • use keys SHIFT + CONTROL + P
  • select Python: Select interpreter
  • then select venv (you might need restart..)

Now be able to start debug of main.py




🧊 Freeze dep, if you add new new python modules:

If you add new dependencies remember to update requirements.txt

Option 1:(will add all in virtual env)

  • pip freeze > requirements.txt

Option 2: (only whats needed)

  • pip install pipreqs
  • pipreqs ./ --force

ofc, you need to run you application to make sure after..




🔬 Linting code:

This is how you can run local linting if needed.

  • pip install ruff black isort
  • ruff ./src --fix
  • isort .
  • black ./src --config pyproject.toml

You should run this before you do any pull request, and make sure you score 10 of 10




🗺️ Add .env file

  • add .env file

Add important:

ENV_VARIABLE_01="Fill out something..."

There is more you can use, but project is setup with correct defaults, to save time.

# DATABASE
ENV_VARIABLE_02="hello2"    # default: something

# AZURE
ENV_VARIABLE_02="hello2"    # default: something

# SOMETHING ELSE
ENV_VARIABLE_03="hello3"    # default: something