This is a Python project template that includes a basic structure for a Python application, including configuration, modules, tests, and utilities. It also includes a pre-configured Poetry project and Ruff linting settings.
The project uses Pydantic for handling environment variables, which are loaded from a .env file. This provides a type-safe and validated way of accessing and managing configuration settings.
The project structure is as follows:
pyTemplate
├── .env.example
├── .gitignore
├── LICENSE
├── poetry.lock
├── pyproject.toml
├── README.md
├── docs
│ └── documentation.md
└── pytemplate
├── __init__.py
├── config.py
├── main.py
├── modules
│ ├── __init__.py
│ └── xmodule
│ ├── __init__.py
│ ├── module_helpers.py
│ └── module.py
├── tests
│ └── x
│ └── x_test.py
└── utils
├── __init__.py
└── utils.py
.env.example: Example environment variables file..gitignore: Gitignore file to exclude certain files from version control.LICENSE: The project's license file.poetry.lock: Poetry's lock file, ensuring consistent dependency versions.pyproject.toml: Poetry's project configuration file.README.md: This README file.docs/documentation.md: Additional project documentation.pytemplate/: The main Python package directory.config.py: Configuration module.__init__.py: Package initialization file.main.py: Entry point for the application.modules/: Directory for project modules.tests/: Directory for test cases.utils/: Directory for utility modules.
To set up the project, you'll need to have poetry installed. Then, follow these steps:
- Clone the repository:
git clone https://github.com/ItsZcx/pyTemplate.git- Navigate to the project directory:
cd pyTemplate- Install the project dependencies using Poetry:
poetry install- (Optional) Create a virtual environment and activate it:
poetry shellTo run the application, use the following command:
poetry run python pytemplate/main.pyTo run the tests, use the following command:
poetry run pytestThis project is licensed under the MIT License.