Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b16256b
add shellcheck
blooop Sep 1, 2025
011eb99
bump pixi version
blooop Sep 1, 2025
468fc11
update pixi.lock
blooop Sep 1, 2025
e8ae755
Merge pull request #91 from blooop/feature/shellcheck
blooop Sep 1, 2025
5032386
build(deps): bump prefix-dev/setup-pixi from 0.8.14 to 0.9.1
dependabot[bot] Sep 27, 2025
aec6e44
build(deps): bump the dev-dependencies group with 7 updates
dependabot[bot] Sep 27, 2025
58a68d3
Merge pull request #92 from blooop/dependabot/github_actions/prefix-d…
blooop Sep 27, 2025
a68d1e2
Merge pull request #94 from blooop/dependabot/pip/dev-dependencies-e0…
blooop Sep 27, 2025
ff66008
build(deps): bump actions/checkout from 4 to 5
dependabot[bot] Sep 27, 2025
ab3a927
only install extensions if inside a docker container
blooop Sep 27, 2025
b24be8b
Merge pull request #93 from blooop/dependabot/github_actions/actions/…
blooop Sep 27, 2025
cdc843b
Merge pull request #95 from blooop/feature/detect_docker
blooop Sep 27, 2025
626c4c2
remove deps.yaml and upate rockerc
blooop Oct 12, 2025
f67a4c9
Merge pull request #96 from blooop/feature/update_rockerc
blooop Oct 12, 2025
2435d18
build(deps): bump prefix-dev/setup-pixi from 0.9.1 to 0.9.2
dependabot[bot] Nov 1, 2025
f32d60d
Clean up README: remove black reference and update legacy section
claude Nov 12, 2025
0701fa3
Remove all black references and fix outdated configurations
claude Nov 12, 2025
f28bb03
Additional cleanup and consistency improvements
claude Nov 12, 2025
ca9bd8f
Merge pull request #99 from blooop/claude/update-readme-cleanup-011CV…
blooop Nov 12, 2025
01e1b3f
Merge pull request #97 from blooop/dependabot/github_actions/prefix-d…
blooop Nov 12, 2025
562f046
build(deps): bump prefix-dev/setup-pixi from 0.9.2 to 0.9.3
dependabot[bot] Nov 12, 2025
5990b43
build(deps-dev): bump the dev-dependencies group across 1 directory w…
dependabot[bot] Nov 12, 2025
9bdd182
Merge pull request #100 from blooop/dependabot/github_actions/prefix-…
blooop Nov 12, 2025
70e6c3f
Merge pull request #101 from blooop/dependabot/pip/dev-dependencies-1…
blooop Nov 12, 2025
09d0db8
update pixi to workspace
blooop Nov 15, 2025
e650182
update pixi.lock
blooop Nov 15, 2025
c4fc62c
Merge pull request #102 from blooop/feature/fix-workspace
blooop Nov 15, 2025
46b2e99
Add Claude Code online environment support
claude Nov 16, 2025
94fab02
Merge pull request #103 from blooop/claude/setup-claude-template-018p…
blooop Nov 16, 2025
d260b40
build(deps): bump actions/checkout from 5 to 6
dependabot[bot] Nov 29, 2025
5747b2b
Merge pull request #104 from blooop/dependabot/github_actions/actions…
blooop Nov 29, 2025
4a40b2a
build(deps-dev): bump the dev-dependencies group with 6 updates
dependabot[bot] Nov 29, 2025
bb26f4c
Merge pull request #105 from blooop/dependabot/pip/dev-dependencies-9…
blooop Nov 29, 2025
48cece3
build(deps-dev): bump the dev-dependencies group with 2 updates
dependabot[bot] Dec 1, 2025
086e4e8
Merge pull request #106 from blooop/dependabot/pip/dev-dependencies-6…
blooop Dec 21, 2025
70e076b
feat: pull changes from remote template
blooop Dec 22, 2025
d53187f
update pixi.lock
blooop Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .claude/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Claude Code Configuration

This directory contains configuration for using this project with Claude Code, particularly in the online environment.

## SessionStart Hook

The `hooks/SessionStart` script automatically runs when a new Claude Code session begins. It:

1. **Installs pixi** (if not already installed) - The package and environment manager
2. **Installs project dependencies** - All Python packages and tools defined in `pyproject.toml`
3. **Sets up pre-commit hooks** - For automatic code quality checks
4. **Configures git** - Sets up merge drivers for lockfiles

## Usage with Claude Code Online

When you start a Claude Code online session, the SessionStart hook will automatically run and set up your environment. You'll see output indicating the setup progress.

### Available Commands

Once setup is complete, Claude can use these pixi tasks:

#### Testing & Quality
- `pixi run test` - Run pytest tests
- `pixi run coverage` - Run tests with coverage report
- `pixi run lint` - Run ruff and pylint linters
- `pixi run format` - Format code with ruff

#### CI Tasks
- `pixi run ci` - Run full CI pipeline (format, lint, test, coverage)
- `pixi run fix` - Auto-fix common issues (update lock, format, lint)

#### Pre-commit
- `pixi run pre-commit` - Run all pre-commit hooks
- `pixi run pre-commit-update` - Update pre-commit hook versions

### How It Works

1. **First session**: The hook installs pixi and all dependencies (may take a few minutes)
2. **Subsequent sessions**: The hook verifies the environment is ready (much faster)
3. **Environment activated**: All pixi commands are available to Claude

### Troubleshooting

If you encounter issues:

1. **Dependencies not found**: Run `pixi install` manually
2. **Lockfile conflicts**: Run `pixi run update-lock`
3. **Pre-commit issues**: Run `pixi run pre-commit-update`
4. **Full reset**: Delete `.pixi` directory and restart session

### Customization

You can modify `hooks/SessionStart` to:
- Install additional tools
- Run custom setup scripts
- Configure environment variables
- Set up external services

## Learn More

- [Claude Code Documentation](https://docs.claude.com/claude-code)
- [Pixi Documentation](https://pixi.sh)
- [Project README](../README.md)
19 changes: 19 additions & 0 deletions .claude/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Source this file to activate the pixi environment in your current shell
# Usage: source .claude/activate.sh

# Add pixi to PATH
export PATH="$HOME/.pixi/bin:$PATH"

# Optional: Activate pixi shell if available
Comment on lines +5 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Avoid repeatedly prepending $HOME/.pixi/bin to PATH when the script is sourced multiple times.

Because this script is intended to be sourced, it may be run multiple times in the same shell, causing $HOME/.pixi/bin to be prepended repeatedly. Consider guarding it with a check such as:

case :$PATH: in
  *:$HOME/.pixi/bin:*) ;;
  *) export PATH="$HOME/.pixi/bin:$PATH" ;;
esac

or an equivalent approach so the entry is only added once.

Suggested change
# Add pixi to PATH
export PATH="$HOME/.pixi/bin:$PATH"
# Optional: Activate pixi shell if available
# Add pixi to PATH (only once)
case ":$PATH:" in
*:"$HOME/.pixi/bin":*)
# Already present, do nothing
;;
*)
export PATH="$HOME/.pixi/bin:$PATH"
;;
esac
# Optional: Activate pixi shell if available

if command -v pixi &> /dev/null; then
echo "✅ Pixi environment activated"
echo "💡 Available commands:"
echo " pixi run test - Run tests"
echo " pixi run lint - Run linters"
echo " pixi run format - Format code"
echo " pixi run ci - Run full CI"
pixi task list --summary 2>/dev/null || true
else
echo "⚠️ Pixi not found. Please run .claude/hooks/SessionStart first."
fi
50 changes: 50 additions & 0 deletions .claude/hooks/SessionStart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash
# SessionStart hook for Claude Code online environment
# This script sets up the Python development environment using pixi

set -e

echo "🚀 Setting up Python Template environment..."

# Check if pixi is installed
if ! command -v pixi &> /dev/null; then
echo "📦 Installing pixi..."
curl -fsSL https://pixi.sh/install.sh | bash

# Add pixi to PATH for current session
export PATH="$HOME/.pixi/bin:$PATH"

# Source bashrc to get pixi in PATH (if bashrc was updated)
[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"

echo "✅ Pixi installed successfully"
else
echo "✅ Pixi already installed"
fi

# Ensure pixi is in PATH for this session
export PATH="$HOME/.pixi/bin:$PATH"

# Install project dependencies
echo "📦 Installing project dependencies..."
pixi install

# Run pre-commit installation
echo "🔧 Setting up pre-commit hooks..."
pixi run pre-commit install || echo "⚠️ Pre-commit installation skipped (optional)"

# Set up git merge driver for lockfiles
echo "🔧 Configuring git merge driver..."
pixi run setup-git-merge-driver || true

echo "✅ Environment setup complete!"
echo ""
echo "Available pixi tasks:"
pixi task list
echo ""
echo "💡 Common commands:"
echo " pixi run test - Run tests"
echo " pixi run lint - Run linters"
echo " pixi run format - Format code"
echo " pixi run ci - Run full CI pipeline"
echo ""
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM mcr.microsoft.com/devcontainers/base:jammy

ARG PIXI_VERSION=v0.41.4
ARG PIXI_VERSION=v0.48.2

RUN curl -L -o /usr/local/bin/pixi -fsSL --compressed "https://github.com/prefix-dev/pixi/releases/download/${PIXI_VERSION}/pixi-$(uname -m)-unknown-linux-musl" \
&& chmod +x /usr/local/bin/pixi \
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"PIXI_VERSION": "v0.41.4"
"PIXI_VERSION": "v0.48.2"
}
},
"customizations": {
Expand Down
5 changes: 2 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ updates:
groups:
dev-dependencies:
#try to group all development dependencies updates into a single pr
patterns:
- "black"
patterns:
- "check-manifest"
- "pre-commit"
- "pylint"
- "pytest"
- "pytest-cov"
- "pytest-cov"
- "hypothesis"
- "ruff"
- "coverage"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
environment: [py310, py311, py312, py313]
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.14
uses: actions/checkout@v6
- uses: prefix-dev/setup-pixi@v0.9.3
with:
cache: true
frozen: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: pre-commit/action@v3.0.1
16 changes: 3 additions & 13 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
},
{
"label": "autoformat",
"detail": "Use ruff and black to automatically fix and format the code",
"detail": "Use ruff to automatically fix and format the code",
"type": "shell",
"command": "pixi run fmt"
"command": "pixi run format"
},
{
"label": "lint",
Expand Down Expand Up @@ -103,17 +103,7 @@
"detail": "Replaces all instances of the template project name with a new name. ",
"type": "shell",
"command": "scripts/rename_project.sh '${input:new_project_name}' '${input:new_author_name}' '${input:new_author_email}' '${input:github_username}'"
},
{
"label": "flit install",
"type": "shell",
"command": "flit install --symlink"
},
{
"label": "flit publish",
"type": "shell",
"command": "flit publish"
},
{
"label": "setup: host",
"detail": "Sets up docker, nvidia docker git-lfs and rocker which are used to clone and setup docker containers",
Expand All @@ -140,7 +130,7 @@
"label": "Install All Recommended Extensions",
"type": "shell",
"linux": {
"command": "cat .vscode/extensions.json | jq .recommendations[] | xargs -n 1 code . --install-extension"
"command": "if [ -f /.dockerenv ] || grep -q 'docker\\|lxc' /proc/1/cgroup 2>/dev/null; then echo 'Docker container detected, installing extensions...'; cat .vscode/extensions.json | jq .recommendations[] | xargs -n 1 code . --install-extension; else echo 'Not in Docker container, skipping extension installation'; fi"
},
"runOptions": {
"runOn": "folderOpen"
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## dbw

## [0.0.0]
## [0.2.0]
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ A template repo for python projects that is set up using [pixi](https://pixi.sh)
This has basic setup for

* pylint
* ruff
* black
* ruff (formatting and linting)
* pytest
* git-lfs
* basic github actions ci
Expand Down Expand Up @@ -37,6 +36,27 @@ If you want to use docker you may want to run the `scripts/setup_host.sh` script

If you are using pixi, look at the available tasks in pyproject.toml If you are new to pixi follow the instructions on the pixi [website](https://prefix.dev/)

# Claude Code Online Support

This template includes built-in support for [Claude Code](https://docs.claude.com/claude-code) online environment! The `.claude/hooks/SessionStart` script automatically:

- Installs pixi package manager
- Sets up all project dependencies
- Configures pre-commit hooks
- Prepares the development environment

**Quick Start with Claude Code:**
1. Open this repository in Claude Code online
2. The environment sets up automatically via the SessionStart hook
3. Claude can immediately run commands like `pixi run test`, `pixi run lint`, etc.

**Manual activation (if needed):**
```bash
source .claude/activate.sh
```

See [.claude/README.md](.claude/README.md) for detailed information about the Claude Code configuration.

# Github setup

There are github workflows for CI, codecov and automated pypi publishing in `ci.yml` and `publish.yml`.
Expand Down Expand Up @@ -77,7 +97,7 @@ pixi run ci

## Legacy

If you don't want to install rocker on your system but want to use vscode, you can run the `scripts/launch_vscode.sh` script to build and connect to a docker container. It will install rocker in a venv. The docker container is dynamically generated using [rocker](https://github.com/osrf/rocker) and [deps rocker](https://github.com/blooop/deps_rocker). [deps rocker](https://github.com/blooop/deps_rocker) looks at the dbw.deps.yaml file to install any required apt, pip or shell scripts and launches a container that vscode attaches to.
If you don't want to install rocker on your system but want to use vscode, you can run the `scripts/launch_vscode.sh` script to build and connect to a docker container. It will install rocker in a venv. The docker container is dynamically generated using [rocker](https://github.com/osrf/rocker) and the configuration in `rockerc.yaml`.

## Troubleshooting

Expand Down
3 changes: 1 addition & 2 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ A template repo for python projects
This has basic setup for

* pylint
* ruff
* black
* ruff (formatting and linting)
* pytest
* codecov
* git-lfs
Expand Down
Loading