Skip to main content

ONE Data Python project utilities - templates, tools, and workflows

Project description

bblocks.projects

ONE Campaign Python project utilities - create, update, and enhance Python projects with standardized templates and tools.

Installation

Use with uvx (recommended for one-off usage)

No installation required! Just use uvx:

uvx bblocks-projects my-awesome-project

Install persistently with uv

uv tool install bblocks-projects
bblocks-projects my-awesome-project

Install with pip/pipx

pipx install bblocks-projects
# or
pip install bblocks-projects

Usage

Create a New Project

Interactive (recommended):

bblocks-projects my-project

The tool will ask you questions to customize your project:

  • Project name and description
  • Project type (package or research)
  • Author information
  • License choice
  • etc.

With options:

# Create a package project with defaults
bblocks-projects my-package --type package --defaults

# Create using a specific template version
bblocks-projects my-project --ref v1.0.0

# Override specific values
bblocks-projects my-project --data author_name="Jane Doe" --data author_email="jane@one.org"

Update an Existing Project

Keep your project in sync with the latest template improvements:

# Update from within your project directory
cd my-project
bblocks-projects update

# Or specify the path
bblocks-projects update --path /path/to/my-project

# Update to a specific template version
bblocks-projects update --ref v1.2.0

Add Components to Existing Projects

Add specific template features to your existing Python projects without full template adoption:

# List available components
bblocks-projects add --list

# Add pre-commit hooks
bblocks-projects add pre-commit

# Add multiple components at once
bblocks-projects add ruff ci pytest

# Add to a specific project
bblocks-projects add pre-commit --path /path/to/project

# Skip confirmation prompts
bblocks-projects add ruff --yes

# Force overwrite existing files
bblocks-projects add ci --force

Available Components:

  • pre-commit - Pre-commit hooks with ruff and mypy
  • ruff - Ruff linter and formatter with comprehensive rules
  • ci - GitHub Actions CI workflow
  • pytest - Pytest with coverage reporting (packages only)
  • pypi-publish - GitHub Actions workflow for PyPI publishing (packages only)

What it does:

  • Copies template files to your project
  • Merges configurations intelligently into pyproject.toml
  • Adds required dependencies
  • Shows you exactly what will change before applying

Example workflow:

# You have an existing Python project
cd my-existing-project

# Add pre-commit hooks from ONE template
bblocks-projects add pre-commit
# ✓ Creates .pre-commit-config.yaml
# ✓ Adds pre-commit to dev dependencies
# Shows next steps: uv sync, pre-commit install

# Add CI workflows
bblocks-projects add ci
# ✓ Creates .github/workflows/ci.yml
# Shows next steps: commit and push to GitHub

# Add ruff configuration
bblocks-projects add ruff
# ✓ Adds [tool.ruff] config to pyproject.toml
# ✓ Adds ruff to dev dependencies
# Shows next steps: uv sync, ruff check

Available Commands

create

Create a new ONE Campaign Python project.

Arguments:

  • DESTINATION - Directory where the project will be created (required)

Options:

  • --ref, -r - Template version (branch, tag, or commit). Defaults to 'main'
  • --type, -t - Project type: 'package' or 'research'
  • --data, -d - Override template variables in KEY=VALUE format (can be used multiple times)
  • --defaults - Use default answers for all questions

Examples:

bblocks-projects my-project
bblocks-projects my-package --type package
bblocks-projects my-project --ref v1.0.0
bblocks-projects my-project --data author_name="John Doe"

update

Update an existing project to the latest template version.

Options:

  • --path, -p - Path to the project to update (defaults to current directory)
  • --ref, -r - Update to specific template version
  • --data, -d - Override template variables in KEY=VALUE format
  • --skip-answered/--no-skip-answered - Skip or re-answer previously answered questions

Examples:

bblocks-projects update
bblocks-projects update --ref v1.2.0
bblocks-projects update --path ../my-other-project
bblocks-projects update --no-skip-answered  # Re-answer all questions

add

Add specific template components to an existing project.

Arguments:

  • COMPONENTS - One or more component names to add

Options:

  • --path, -p - Path to the project (defaults to current directory)
  • --force, -f - Force overwrite existing files
  • --yes, -y - Skip confirmation prompts
  • --list, -l - List available components and exit

Available Components:

  • pre-commit - Pre-commit hooks configuration
  • ruff - Ruff linter/formatter configuration
  • ci - GitHub Actions CI workflow
  • pytest - Pytest testing configuration (packages only)
  • pypi-publish - PyPI publishing workflow (packages only)

Examples:

bblocks-projects add --list
bblocks-projects add pre-commit
bblocks-projects add ruff ci pytest
bblocks-projects add pre-commit --path /path/to/project
bblocks-projects add ruff --yes  # Skip confirmations

Features:

  • Interactive by default - shows what will change before applying
  • Intelligent config merging for pyproject.toml
  • Conflict detection - warns if files/configs already exist
  • Automatic dependency management
  • Post-install guidance for each component

What You Get

The template creates a modern Python project with:

For All Projects

  • uv for fast dependency management
  • Ruff for linting and formatting
  • mypy for type checking
  • pre-commit hooks configured
  • GitHub Actions CI/CD

For Package Projects

  • src-layout structure
  • pytest with coverage
  • PyPI publishing workflow with trusted publishing
  • Type hint support (py.typed)

For Research Projects

  • Organized scripts/ structure
  • Paths class for consistent directory references
  • Configured logger for analysis scripts
  • Separate raw_data/ and output/ directories

Documentation

For detailed documentation about the templates and best practices:

Support

License

MIT License - see LICENSE file for details.

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

bblocks_projects-0.1.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

bblocks_projects-0.1.1-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file bblocks_projects-0.1.1.tar.gz.

File metadata

  • Download URL: bblocks_projects-0.1.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bblocks_projects-0.1.1.tar.gz
Algorithm Hash digest
SHA256 29d75394510c4d552086f22f30329d45b0f06bc70e636325abcf654676c2cf5d
MD5 4058bf8242145cafbd426eb1a8378f53
BLAKE2b-256 28e81710ad654598d510215d40f712d291ccd1366a43e309030af85325411eae

See more details on using hashes here.

Provenance

The following attestation bundles were made for bblocks_projects-0.1.1.tar.gz:

Publisher: publish.yml on ONEcampaign/bblocks-projects

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bblocks_projects-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bblocks_projects-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e3ac4ede0507e63c648132bbdbbc09be83c546f2491422983dbd7da1a7dfaf2
MD5 0dced4bbaef5b537e425e8116cfaba22
BLAKE2b-256 3bf37a87371e18b1217c8b51716ccc8973517c6f389eb8643957fa50c32a5d99

See more details on using hashes here.

Provenance

The following attestation bundles were made for bblocks_projects-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ONEcampaign/bblocks-projects

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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