Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions .cursor/commands/add-python-dependencies.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Add helpful Python dependencies to the current Poetry project.
Add helpful Python dependencies to the current uv project.

## Parameters

Expand Down Expand Up @@ -28,19 +28,19 @@ Add helpful Python dependencies to the current Poetry project.
Run these commands in the package directory (where `pyproject.toml` exists):

```sh
poetry add python-dotenv python-decouple
uv add python-dotenv python-decouple
```

```sh
poetry add --group dev black pre-commit pylint perflint ruff bandit pytest detect-secrets
uv add --group dev black pre-commit pylint perflint ruff bandit pytest detect-secrets
```

## Example Usage

**With parameter:**

- package_dir: `tools/python/my_package`
- This will navigate to `tools/python/my_package/` and run the poetry add commands there
- This will navigate to `tools/python/my_package/` and run the uv add commands there

**Without parameter:**

Expand All @@ -53,5 +53,5 @@ poetry add --group dev black pre-commit pylint perflint ruff bandit pytest detec

- The package directory must contain a `pyproject.toml` file
- The directory location can be absolute or relative to the workspace root
- The dev dependencies will be added to the `[tool.poetry.group.dev.dependencies]` section in `pyproject.toml`
- Regular dependencies will be added to the `[tool.poetry.dependencies]` section
- The dev dependencies will be added to the `[dependency-groups]` dev section in `pyproject.toml`
- Regular dependencies will be added to the `[project]` dependencies section
37 changes: 20 additions & 17 deletions .cursor/commands/create-python-package.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Create a new Python package using Poetry in the specified directory.
Create a new Python package using uv in the specified directory.

## Parameters

Expand All @@ -9,18 +9,18 @@ Create a new Python package using Poetry in the specified directory.

1. If `directory_location` is not provided, ask the user: "What directory should the package be created in?"
2. If `package_name` is not provided, ask the user: "What should the package be named?"
3. Check the root `pyproject.toml` file for `package-mode = false` in the `[tool.poetry]` section. If the section doesn't exist or `package-mode` is not set to `false`, add or update it:
3. Navigate to the specified directory location (create it if it doesn't exist)
4. Run `uv init --lib <package_name>` in that directory
5. Add the new package to the project's root `pyproject.toml` file in the `[tool.uv.workspace]` members list (create the section if it doesn't exist)
6. The entry should use the format: `"<relative_path_from_root>/<package_name>"`
- Convert underscores in package_name to hyphens for the directory name (e.g., `my_new_package` becomes `my-new-package`)
- The path should be relative to the workspace root (e.g., if directory_location is `tools/python` and package_name is `my_new_package`, the path would be `tools/python/my-new-package`)
7. Ensure the new package uses hatchling as the build backend:
```toml
[tool.poetry]
package-mode = false
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
```
This ensures the root is not packaged up and is only used for dependency management in the mono-repo.
4. Navigate to the specified directory location (create it if it doesn't exist)
5. Run `poetry new <package_name>` in that directory
6. Add the new package to the project's root `pyproject.toml` file in the `[tool.poetry.dependencies]` section (create the section if it doesn't exist)
7. The entry should use the format: `<package_name> = { path = "<relative_path_from_root>/<package_name>", develop = true }`
- Convert underscores in package_name to hyphens for the dependency name (e.g., `my_new_package` becomes `my-new-package`)
- The path should be relative to the workspace root (e.g., if directory_location is `tools/python` and package_name is `my_new_package`, the path would be `tools/python/my-new-package`)
8. Confirm the package was created successfully and added to the root pyproject.toml

## Example Usage
Expand All @@ -31,8 +31,12 @@ Create a new Python package using Poetry in the specified directory.
- package_name: `my_new_package`
- This will create the package at `tools/python/my-new-package/` and add to root `pyproject.toml`:
```toml
[tool.poetry.dependencies]
my-new-package = { path = "tools/python/my-new-package", develop = true }
[tool.uv.workspace]
members = [
"tools/python/core_github",
"tools/python/gcp_gemini",
"tools/python/my-new-package",
]
```

**Without parameters:**
Expand All @@ -44,8 +48,7 @@ Create a new Python package using Poetry in the specified directory.
## Notes

- The directory location can be absolute or relative to the workspace root
- If the directory doesn't exist, create it before running `poetry new`
- If the directory doesn't exist, create it before running `uv init`
- The package name should follow Python naming conventions (lowercase, underscores allowed)
- The dependency name in pyproject.toml should use hyphens (e.g., `my-new-package`) while the package directory name created by `poetry new` will also use hyphens
- If `[tool.poetry.dependencies]` section doesn't exist in the root pyproject.toml, create it before adding the new package
- The root `pyproject.toml` must have `package-mode = false` to indicate it's a mono-repo root used only for dependency management, not for packaging
- The directory name in the workspace members list should use hyphens (e.g., `my-new-package`)
- If `[tool.uv.workspace]` section doesn't exist in the root pyproject.toml, create it before adding the new package
22 changes: 22 additions & 0 deletions .cursor/rules/uv.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
description: uv workspace conventions for this monorepo
alwaysApply: true
---

# uv Workspace

This project is a uv workspace with multiple members (see `pyproject.toml` `[tool.uv.workspace]`).

## Syncing

Always use `--all-packages` when syncing:

```bash
uv sync --all-packages
```

Plain `uv sync` only installs the **root** project's dependencies, which are empty. Without `--all-packages`, workspace member packages (and their entry-point scripts) will not be installed into the virtual environment.

## Locking

Use `uv lock` (not `poetry lock` or `uv lock --no-update`). No special flags are needed.
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11.11
3.12.9
2 changes: 1 addition & 1 deletion .trufflehogignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ node_modules/

# Exclude lock files (use full paths or patterns)
package-lock.json
poetry.lock
uv.lock
yarn.lock
pnpm-lock.yaml
Loading