Python Project Layout: Difference between revisions
Jump to navigation
Jump to search
Line 19: | Line 19: | ||
=Setting a Manual Project= | =Setting a Manual Project= | ||
A project set up this way will be compatible with [[PyCharm_Concepts#Overview|PyCharm]]. Also see: {{Internal|PyCharm_Operations#Create_a_Simple.2C_Standalone_Project|Simple PyCharm Project}} | |||
Add the dependencies to <code>requirements.txt</code>. For more details, see: {{Internal|Pip#requirements.txt|requirements.txt}} | Add the dependencies to <code>requirements.txt</code>. For more details, see: {{Internal|Pip#requirements.txt|requirements.txt}} |
Revision as of 00:53, 18 February 2022
Internal
Overview
A typical Python project layout, which allows for code written in other programming languages as well, is similar to:
. ├─ .gitignore ├─ requirements.txt ├─ run ├─ src │ └─ main │ └─ python │ └─ main.py └─ venv # created automatically upon virtual environment initialization ├─ bin ...
Setting a Manual Project
A project set up this way will be compatible with PyCharm. Also see:
Add the dependencies to requirements.txt
. For more details, see:
Initialize the virtual environment:
cd ${PROJECT_HOME} python3 -m venv venv venv/bin/pip install -r ./requirements.txt
For more details on virtual environments, see:
Example of .gitignore
:
venv/
Example of run
:
#!/usr/bin/env bash $(dirname $0)/venv/bin/python $(dirname $0)/src/main/python/main.py