Skip to main content

CLI tool to scaffold Python projects with uv, pre-configured dev tools, and optional GitHub integration

Project description

uv-start

A command-line tool for initializing Python projects using the new uv project management tool: https://docs.astral.sh/uv/ This package integrates uv commands with a template for development configs, commitizen versioning, precommit hooks and CI


Status

Version: version Python License


Development state of the program

This project is in active development. Current version: 0.3.5 Features and APIs may change. Please report issues on GitHub. Tests currently run only on Mac and Linux with Python 3.13.


Versioning

This project uses Semantic Versioning and Conventional Commits.


Authors

Helfrid Hochegger


Dependencies

  • Requires Python 3.13 (not tested on other versions)
  • UV package manager installed (https://github.com/astral-sh/uv)
  • GitHub CLI (gh) authenticated via gh auth login (if using GitHub features)

Contact

Created by Helfrid Hochegger Email: hh65@sussex.ac.uk GitHub Issues: https://github.com/Helfrid/uv-start/issues


License

This project is licensed under the MIT License


Features

  • Create Python libraries, packages, or applications
  • Workspace support for monorepo setups
  • Automatic setup of development tools:
    • Ruff for linting and formatting
    • Ty for type checking
    • Pytest for testing
    • Commitizen for conventional commits
    • Pre-commit hooks
    • Structured logging with environment configuration
  • GitHub repository initialization with CI/CD workflows
  • Semantic versioning support
  • Python 3.10–3.14 support for project initialisation

Installation

git clone https://github.com/Helfrid/uv-start.git
cd uv-start && uv sync

Configure your author details (run once):

uv-start --config "Jane Doe" "jane@example.com"

If you skip this step, uv-start falls back to your git config (user.name / user.email).

GitHub authentication is handled by the gh CLI. Run gh auth login to authenticate.

Usage

Basic usage to install a repo with pre-configured Ruff, Ty, Commitizen and Pre-Commit Hooks settings, optional setup of github repo and basic CI pipeline including version bumps on conventional commit messages.

To run the program cd to desired parent directory (this should not be a git repo!) The set the UV_ORIGINAL_CWD to $PWD and then execute uv run.

bash

cd "parent-directory"
UV_ORIGINAL_CWD="$PWD"
uv run --directory path_to/uv-start uv-start project-name [options]

Alternatively, add this function to your .zshrc or .bashrc config file

bash

uv_start() {
  UV_ORIGINAL_CWD="$PWD" uv run --directory path_to/uv-start uv-start "$@"
}
alias uv-start='uv_start'

The restart your shell cd to the desried parent directory and type bash

uv-start project-name [options]

Options:

  • -t, --type [lib|package]: The type of project to create (default: lib, alternative: package)
  • -p, --python [3.14|3.13|3.12|3.11|3.10]: Python version to use (default: 3.13)
  • -w, --workspace: Create a workspace (monorepo setup)
  • -g, --github: Create and initialize a GitHub repository
  • --private: Create a private GitHub repository (requires --github)
  • --config NAME EMAIL: Save author name and email for project templates

Examples

Create a basic library: bash

uv-start my-package -t package -p 3.13

Create a workspace with GitHub repository:

bash

uv-start my-workspace -w -g

creates an upstream main branch on github (default public, use --private for private repos)

bash

uv-start my-workspace -w -g

This will generate a uv workspace (see: https://docs.astral.sh/uv/concepts/projects/workspaces/) The user will be prompted to add a common-utils library and an additional project.


Project Structure

The generated project follows this structure:

project_name/
├── src/
│   └── project_name/
│       └── __init__.py
├── tests/
├── pyproject.toml
├── README.md
├── LICENSE
└── .pre-commit-config.yaml

For workspaces:

workspace_name/
├── packages/
│ ├── package1/
│ └── package2/
├── pyproject.toml
├── README.md
└── .pre-commit-config.yaml

Development Tools

UV Init sets up the following development tools:

  • Ruff: Modern Python linter and formatter
  • Ty: Static type checker
  • Pytest: Testing framework
  • Commitizen: Conventional commit tooling
  • Pre-commit: Git hooks manager
  • Logging: Configurable logging setup with:
    • Console and file handlers
    • Environment variable configuration
    • Rotating file handler
    • Different log levels for development/production

Development Tools Configuration

Ruff

  • Line length: 79 characters
  • Selected rules: flake8, pyupgrade, isort, and more
  • Automatic fixes enabled

Ty

  • Checks src and tests
  • Sets rule severity to errors for strict enforcement
  • Excludes virtualenv/build/dist/migrations paths

Commitizen

  • Uses conventional commits
  • Automatic version bumping
  • Changelog generation
  • Synchronized version tracking across all workspace packages

Logging

  • Console and file logging configurable via environment variables
  • Rotating file handler with customizable size and backup count
  • Log format includes timestamp, level, filename, and line number
  • Environment-specific configuration support (.env.development, .env.production)

Workspace Features

When creating a workspace (-w flag), UV Init:

  • Sets up a monorepo structure
  • Offers to create a common utilities package
  • Supports adding multiple projects
  • Configures dependencies between workspace packages
  • Synchronized versioning: All packages in the workspace share a single version number. Running cz bump at the root updates pyproject.toml, __init__.py, and README.md across all sub-packages simultaneously.

GitHub Integration

When using the -g flag, UV Init:

  1. Initializes a Git repository
  2. Creates a GitHub repository
  3. Sets up GitHub Actions workflows for:
    • CI (linting, type checking, testing)
    • Automated releases using conventional commits

additional --private flag for optional private repos

GitHub Workflows

CI Pipeline

  • Runs on Python 3.13
  • Performs:
    • Code linting with Ruff
    • Type checking with Ty
    • Unit tests with Pytest
    • Format checking

Release Pipeline

  • Automatic version bumping on main branch
  • Creates releases based on conventional commits
  • Generates changelogs
  • For workspaces, a single cz bump at the root keeps all packages in sync

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes using conventional commits (cz commit)
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development

Local environment

uv sync

Tests

uv run pytest

Type checking (Ty)

uv run ty check .

Building the documentation (Sphinx)

uv run sphinx-build -b html docs docs/_build/html

Then open docs/_build/html/index.html in your browser.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uv_start-0.5.0.tar.gz (92.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uv_start-0.5.0-py3-none-any.whl (28.1 kB view details)

Uploaded Python 3

File details

Details for the file uv_start-0.5.0.tar.gz.

File metadata

  • Download URL: uv_start-0.5.0.tar.gz
  • Upload date:
  • Size: 92.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.11

File hashes

Hashes for uv_start-0.5.0.tar.gz
Algorithm Hash digest
SHA256 b5ff6f9691063f9b4af4870f1aa5ed39a3f5d623bed7143129422bd3524c1e43
MD5 3226ea6bddd9d8e1be678dc9ef6330c1
BLAKE2b-256 ffadc272848f2ce1b0a870f7af2f11d44c397cd8094477c3d3742490e5a24357

See more details on using hashes here.

File details

Details for the file uv_start-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: uv_start-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 28.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.11

File hashes

Hashes for uv_start-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a959a1143520e29ae5e3ed67d2f450ea8a80353bf22d4bd33de9fce618043bf
MD5 9856132b9268a3682ef4ec33c5e7b796
BLAKE2b-256 03e12ba996763a2eeaeb61534a5f8d54ec3cffa0dbf785c1dcde4bb6046e5cf0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page