Skip to content

initial claude setup#77

Merged
AlexanderFengler merged 5 commits intomainfrom
initial-claude-setup
Mar 31, 2026
Merged

initial claude setup#77
AlexanderFengler merged 5 commits intomainfrom
initial-claude-setup

Conversation

@AlexanderFengler
Copy link
Copy Markdown
Member

This pull request adds important project documentation and enforces standardized Python package management practices. The most significant changes are the addition of a comprehensive project context file and a rules file that mandates the use of the uv package manager.

Documentation and Project Standards:

  • Added a detailed CLAUDE.md file describing the project's purpose, structure, build system, supported commands, architecture patterns (including network types and training backends), ONNX export process, HuggingFace integration, configuration and MLflow usage, CLI entry points, CI workflows, and known issues. This serves as a central reference for contributors and maintainers.

Python Package Management Rules:

  • Introduced .claude/rules/uv.md to enforce the use of uv as the package manager for all Python operations. This includes rules such as always using uv run for commands, never using pip install, and treating uv.lock as the source of truth for dependencies.

Copilot AI review requested due to automatic review settings March 28, 2026 16:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds contributor-facing documentation and Claude rules intended to standardize development workflows around uv and provide a single “project context” reference for LANfactory.

Changes:

  • Added CLAUDE.md with project structure, common commands, architecture notes, CLI entry points, CI workflow summary, and known issues.
  • Added .claude/rules/uv.md to enforce uv usage for Python execution and dependency management.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
CLAUDE.md New central project context doc (commands, architecture, CLI/CI overview).
.claude/rules/uv.md New Claude rule file to mandate uv-based workflows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## Build & Tooling

- **Build system:** setuptools (pure Python, no compiled extensions)
- **Package manager:** uv (with `uv.lock`)
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

uv.lock is currently ignored by git in this repo (.gitignore contains uv.lock), so stating “uv.lock is the source of truth” (and implying it’s present) is misleading. Either commit uv.lock and remove it from .gitignore, or update this doc to reflect that the repo doesn’t track a lockfile.

Suggested change
- **Package manager:** uv (with `uv.lock`)
- **Package manager:** uv (no `uv.lock` committed; dependencies resolved from `pyproject.toml`)

Copilot uses AI. Check for mistakes.
CLAUDE.md Outdated
## Common Commands

```bash
# Install all dependencies (dev + optional)
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

uv sync --all-groups installs dependency groups (e.g. dev) but does not install optional extras, so the comment “dev + optional” is inaccurate. Consider either changing the text to “dev” only, or updating the command to include extras (e.g., add --all-extras or explicit --extra ...).

Suggested change
# Install all dependencies (dev + optional)
# Install all dependency groups (e.g. dev)

Copilot uses AI. Check for mistakes.
CLAUDE.md Outdated
Comment on lines +110 to +111
Optional experiment tracking via MLflow. CLI flags: `--run-name`, `--experiment-name`,
`--tracking-uri`, `--artifact-location`. Supports resuming runs via `--run-id`.
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

The MLflow CLI flag names in this section don’t match the actual CLI options in lanfactory.cli.{torch_train,jax_train} (they use --mlflow-run-name, --mlflow-experiment-name, --mlflow-tracking-uri, --mlflow-artifact-location, --mlflow-run-id). Updating these flags here will prevent users from copying commands that fail.

Suggested change
Optional experiment tracking via MLflow. CLI flags: `--run-name`, `--experiment-name`,
`--tracking-uri`, `--artifact-location`. Supports resuming runs via `--run-id`.
Optional experiment tracking via MLflow. CLI flags: `--mlflow-run-name`, `--mlflow-experiment-name`,
`--mlflow-tracking-uri`, `--mlflow-artifact-location`. Supports resuming runs via `--mlflow-run-id`.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +11
- The `uv.lock` file is the source of truth for resolved dependency versions.
- When adding dependencies, add them to `pyproject.toml` and run `uv sync`.
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

This rule says uv.lock is the source of truth, but the repository currently ignores uv.lock in .gitignore (so it won’t be committed/reviewed). To make this enforceable, either stop ignoring and commit uv.lock, or adjust the rule to reflect the current workflow (no checked-in lockfile).

Suggested change
- The `uv.lock` file is the source of truth for resolved dependency versions.
- When adding dependencies, add them to `pyproject.toml` and run `uv sync`.
- `pyproject.toml` is the source of truth for dependencies; `uv.lock` is a local resolution artifact and is not committed.
- When adding dependencies, add them to `pyproject.toml` and run `uv sync` to update your local `uv.lock`.

Copilot uses AI. Check for mistakes.
---

- Always use `uv run` to execute commands — never bare `python`, `pytest`, `ruff`, or other tools.
- Never use `pip install` — use `uv sync` (with `--extra` or `--all-groups` flags) to manage dependencies.
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

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

“Never use pip install” is too broad given the repo’s README still documents pip install lanfactory for end users. Consider scoping this rule explicitly to repository development/CI (e.g., “When working in this repo, don’t use pip; use uv…”) so it doesn’t conflict with published installation guidance.

Suggested change
- Never use `pip install` use `uv sync` (with `--extra` or `--all-groups` flags) to manage dependencies.
- When working in this repo (local development, CI, or scripts), do not use `pip install`; instead use `uv sync` (with `--extra` or `--all-groups` flags) to manage dependencies. End‑user installation instructions in README or external docs may still use `pip install` where appropriate.

Copilot uses AI. Check for mistakes.
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/lanfactory/hf/upload.py 100.00% <100.00%> (ø)
src/lanfactory/trainers/torch_mlp.py 94.17% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

AlexanderFengler and others added 3 commits March 29, 2026 16:06
- Remove uv.lock from .gitignore and commit lockfile
- Raise check-added-large-files limit to 1000 KB
- Fix uv sync comment: dev + optional -> all dependency groups
- Fix MLflow CLI flags to use correct --mlflow- prefix
- Scope no pip install rule to development only

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Match GitHub's own 100 MB hard limit rather than imposing an artificial
lower threshold. Notebooks and lock files should not be blocked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 30, 2026 22:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 338 to 341
if isinstance(network_config, str):
with open(network_config, "rb") as f:
network_config = pickle.load(f)
network_config = pickle.load(f) # noqa: S301

Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

pickle.load() is being explicitly exempted from Ruff’s S301 security warning. If network_config can come from an untrusted path (e.g., user input/CLI), this is a code execution risk. Prefer a safe serialization format (YAML/JSON) for configs, or add an explicit trust boundary (validate/limit the config path and clearly document that only trusted pickles are supported) rather than blanket-suppressing the warning.

Copilot uses AI. Check for mistakes.
network_config = pickle.load(f)
network_config = pickle.load(f) # noqa: S301

assert isinstance(network_config, dict)
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

Using assert isinstance(network_config, dict) for runtime input validation is brittle: assertions are stripped under python -O, and an AssertionError is not very actionable for users. Consider replacing this with an explicit TypeError/ValueError with a clear message (and, if relevant, include the path that was loaded) so failures are consistent in all runtime modes.

Copilot uses AI. Check for mistakes.
CLAUDE.md Outdated
- **Build system:** setuptools (pure Python, no compiled extensions)
- **Package manager:** uv (with `uv.lock`)
- **Python:** >3.10, <3.14 (classifiers target 3.11, 3.12, 3.13)
- **Linting:** ruff (line length 120, via pre-commit)
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The documented Ruff line length here (120) is inconsistent with the repo configuration (pyproject.toml sets [tool.ruff].line-length = 88). Please update this doc to match the actual configured value so contributors don’t format code to the wrong width.

Suggested change
- **Linting:** ruff (line length 120, via pre-commit)
- **Linting:** ruff (line length 88, via pre-commit)

Copilot uses AI. Check for mistakes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@AlexanderFengler AlexanderFengler merged commit 047fa8e into main Mar 31, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants