Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

hello-python - minimal python project setup tutorial

Minimal Python project using Poetry for dependency and virtual environment management.

Table of Contents

[[TOC]]

Prerequisites

Packages Version

Term Description
Python 3.10+
Poetry pipx install poetry (recommended)

Python Interpreter Setup (VS Code)

  1. Open the Command Palette (Ctrl+Shift+P)
  2. Type Python: Select Interpreter
  3. Choose the Poetry virtual environment (e.g., .venv or the one containing your project name)

If the virtual environment doesn't appear, run poetry install first, then reload VS Code.

Installing pytest

pytest is included as a dev dependency. Install it via Poetry:

poetry install

To verify pytest is available:

poetry run pytest --version

Poetry Setup

poetry install

To also install build dependencies (PyInstaller):

poetry install --with build

Running Application

Using the script entry point:

poetry run hello-python

Using the module directly:

poetry run python -m hello_python

Running Unit Test and Coverage Test

poetry run pytest
poetry run pytest --cov=hello_python --cov-report=term-missing

Formatting And Style Checking

Format (applies changes):

poetry run python -m hello_python.codestyle

Style check only (no changes):

poetry run python -m hello_python.codestyle check

Building Executables (PyInstaller)

Using the Python build class (cross-platform):

poetry run python -m hello_python.build

Output: dist/windows/hello-python-windows.exe (Windows) or dist/linux/hello-python-linux (Linux)

Project Structure

src/hello_python/
├── __init__.py      # Package exports
├── __main__.py      # python -m entry point
├── main.py          # Core logic and app entry
├── window.py        # UI components (HelloWindow)
├── build.py         # PyInstaller build class
└── codestyle.py     # Ruff formatting/linting class
tests/
├── conftest.py      # Shared test fixtures
├── test_main.py     # Unit tests for main + window
├── test_build.py    # Build configuration tests
├── test_build_class.py  # BuildExecutable class tests
└── test_codestyle.py    # CodeStyle class tests
docs/                # Documentation

Pre-commit Hooks

Install and activate:

poetry run pre-commit install

Run manually:

poetry run pre-commit run --all-files

CI/CD

  • CI: .github/workflows/ci.yml — lint, test, build on push/PR
  • CD: .github/workflows/cd.yml — release candidate on main after CI passes

See docs/CICD-validation.md for full details.

Additional Documentation

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages