Skip to content

trobz/local.py

Repository files navigation

trobz_local (tlc)

Python 3.10+ License: AGPL-3.0

A developer tool for automating setup and management of local Odoo development environments. Streamlines directory structure creation, source code repository management, and installation of required development tools.

What is trobz_local?

trobz_local (CLI: tlc) automates repetitive tasks when setting up an Odoo development environment. Instead of manually creating directories, cloning repositories, and installing dependencies, developers declare their desired environment in a TOML configuration file and tlc handles the rest.

Key Features

  • Environment Initialization (init): Creates standardized directory structure (default: ~/code/)
  • Repository Management (pull-repos): Clones/updates Odoo and OCA repos in parallel
  • Tool Installation (install-tools): Installs from four sources: scripts, system packages, NPM, and UV tools
  • Virtual Environments (create-venvs): Creates Odoo venvs for each configured version
  • Interactive Mode: Newcomer mode with confirmations and guidance
  • Security: HTTPS enforcement for all downloads
  • Custom Directory: Use TLC_CODE_DIR env var to override default ~/code location

Installation

Install globally using uv:

uv tool install git+ssh://git@github.com:trobz/local.py.git

Quick Start

# 1. Initialize directory structure (uses ~/code by default, or set TLC_CODE_DIR)
export TLC_CODE_DIR=~/Development  # Optional: customize location
tlc init

# 2. Create config file
cat > ~/Development/config.toml << 'EOF'
versions = ["16.0", "17.0"]

[tools]
uv = ["odoo-venv", "pre-commit"]
npm = ["prettier"]
system_packages = ["postgresql"]

[repos]
odoo = ["odoo", "enterprise"]
oca = ["server-tools"]
EOF

# 3. Setup environment
tlc pull-repos       # Clone repositories
tlc create-venvs     # Create virtual environments
tlc install-tools    # Install tools

Commands

Command Purpose
tlc init Create directory structure (default: ~/code/)
tlc pull-repos Clone or update Odoo/OCA repositories
tlc create-venvs Create Python virtual environments
tlc install-tools Install scripts, packages, and tools

Use --newcomer=false to skip confirmation prompts. Use --help on any command for options.

Configuration

Place config.toml in your code directory (default: ~/code/config.toml):

versions = ["16.0", "17.0", "18.0"]

[tools]
uv = ["odoo-venv", "odoo-addons-path", "pre-commit"]
npm = ["prettier", "eslint"]
system_packages = ["git", "postgresql", "pnpm"]

[[tools.script]]
url = "https://astral.sh/uv/install.sh"
name = "uv installer"

[repos]
odoo = ["odoo", "enterprise"]
oca = ["server-tools", "server-ux", "web"]

Custom Code Directory

By default, tlc uses ~/code as the base directory. You can customize this by setting the TLC_CODE_DIR environment variable:

# Use a custom directory
export TLC_CODE_DIR=/data/dev
tlc init  # Creates directory structure at /data/dev

# One-liner
TLC_CODE_DIR=/custom/path tlc init

The config file will be created at {TLC_CODE_DIR}/config.toml.

See Configuration Schema for all options and validation rules.

System Requirements

  • Python 3.10+
  • uv package manager
  • Linux (Arch, Ubuntu) or macOS
  • System tools: git, wget or curl, sh

Documentation

For detailed information:

Development

git clone git@github.com:trobz/local.py.git && cd local.py
uv sync && uv run pre-commit install
make check  # Linters and type checks
make test   # Run tests

License

AGPL-3.0 - See LICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published