-
Notifications
You must be signed in to change notification settings - Fork 14
fix: update scaffolding to make full use of pixi #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b79b75e
c6e3972
374cf67
26b10a4
db5aee6
94677cb
c5d74b0
6d3e432
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -65,6 +65,17 @@ def save_pyproject(pyproject): | |||||||||||||||||
| # the python dependency should be in line with the dependencies | ||||||||||||||||||
| pyproject["project"]["requires-python"] = ">=3.11,<4.0" | ||||||||||||||||||
|
|
||||||||||||||||||
| # configure coverage | ||||||||||||||||||
| pyproject["tool"]["coverage"] = { | ||||||||||||||||||
| "report": { | ||||||||||||||||||
| "exclude_lines": [ | ||||||||||||||||||
| "pass", | ||||||||||||||||||
| "\\.\\.\\.", | ||||||||||||||||||
| ], | ||||||||||||||||||
| "fail_under": 90.0, | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| save_pyproject(pyproject) | ||||||||||||||||||
|
|
||||||||||||||||||
| # add dependencies | ||||||||||||||||||
|
|
@@ -79,8 +90,9 @@ def save_pyproject(pyproject): | |||||||||||||||||
| "--feature", | ||||||||||||||||||
| "dev", | ||||||||||||||||||
| "ruff", | ||||||||||||||||||
| "coverage", | ||||||||||||||||||
| "pytest", | ||||||||||||||||||
| "pytest-cov", | ||||||||||||||||||
| "pyrefly", | ||||||||||||||||||
|
Comment on lines
+94
to
+95
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Pyrefly is "currently under active development with known issues", and the announcement explicitly describes it as an alpha version. Every plugin generated by this scaffolding will adopt pyrefly as its type checker. If pyrefly introduces breaking CLI changes or produces noisy false positives in early plugin projects, it could be disruptive. Consider whether pinning a minimum version or noting the alpha status in generated documentation is warranted. 🤖 Prompt for AI Agents |
||||||||||||||||||
| "twine", | ||||||||||||||||||
| "build", | ||||||||||||||||||
| ] | ||||||||||||||||||
|
|
@@ -93,11 +105,19 @@ def save_pyproject(pyproject): | |||||||||||||||||
| save_pyproject(pyproject) | ||||||||||||||||||
|
|
||||||||||||||||||
| sp.run( | ||||||||||||||||||
| ["pixi", "task", "add", "--feature", "dev", "lint", "ruff check"], | ||||||||||||||||||
| ["pixi", "task", "add", "--feature", "dev", "lint", "ruff check src tests"], | ||||||||||||||||||
| check=True, | ||||||||||||||||||
| ) | ||||||||||||||||||
| sp.run( | ||||||||||||||||||
| ["pixi", "task", "add", "--feature", "dev", "format", "ruff format src tests"], | ||||||||||||||||||
| check=True, | ||||||||||||||||||
| ) | ||||||||||||||||||
| sp.run( | ||||||||||||||||||
| ["pixi", "task", "add", "--feature", "dev", "typecheck", "pyrefly check src tests"], | ||||||||||||||||||
| check=True, | ||||||||||||||||||
| ) | ||||||||||||||||||
| sp.run( | ||||||||||||||||||
| ["pixi", "task", "add", "--feature", "dev", "format", "ruff format"], | ||||||||||||||||||
| ["pixi", "task", "add", "--feature", "dev", "coverage-report", "coverage report -m"], | ||||||||||||||||||
| check=True, | ||||||||||||||||||
| ) | ||||||||||||||||||
|
Comment on lines
+115
to
+118
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ruff S607 on line 116 is a false positive — no action required.
🔇 Suppress false positive if needed- sp.run(
- ["pixi", "task", "add", "--feature", "dev", "typecheck", "pyrefly check"],
+ sp.run( # noqa: S607
+ ["pixi", "task", "add", "--feature", "dev", "typecheck", "pyrefly check"],
check=True,
)📝 Committable suggestion
Suggested change
🧰 Tools🪛 Ruff (0.15.1)[error] 116-116: Starting a process with a partial executable path (S607) 🤖 Prompt for AI Agents🧩 Analysis chain🏁 Script executed: # First, find and check ci.yml.j2 for coverage references
fd "ci.yml.j2" --exec grep -n "coverage" {}Repository: snakemake/snakedeploy Length of output: 105 🏁 Script executed: # Also search for any task-related references in common.py
fd "common.py" --path "*scaffold_plugins*" --exec wc -l {} \;Repository: snakemake/snakedeploy Length of output: 280 🏁 Script executed: # Get a sense of what tasks are registered in common.py
fd "common.py" --path "*scaffold_plugins*" --exec grep -n "pixi.*task.*add" {} \;Repository: snakemake/snakedeploy Length of output: 280 🏁 Script executed: # Find common.py in scaffold_plugins
find . -name "common.py" -path "*/scaffold_plugins/*"Repository: snakemake/snakedeploy Length of output: 105 🏁 Script executed: # Read common.py to see all pixi task add calls
cat -n snakedeploy/scaffold_plugins/common.py | grep -A 2 "pixi.*task.*add"Repository: snakemake/snakedeploy Length of output: 626 🏁 Script executed: # Get the full context around all pixi task add calls
rg "pixi.*task.*add" snakedeploy/scaffold_plugins/common.py -B 2 -A 2Repository: snakemake/snakedeploy Length of output: 611 🏁 Script executed: # Also check the full line count and see the complete file structure
wc -l snakedeploy/scaffold_plugins/common.pyRepository: snakemake/snakedeploy Length of output: 107 🏁 Script executed: # Search for all task names being added, to get a complete list
rg "task.*add.*--feature" snakedeploy/scaffold_plugins/common.py | sed 's/.*--feature[^"]*"\([^"]*\)".*/\1/'Repository: snakemake/snakedeploy Length of output: 76 🏁 Script executed: # Also check for test and check-build tasks
rg "(test|check-build|coverage)" snakedeploy/scaffold_plugins/common.pyRepository: snakemake/snakedeploy Length of output: 574 🏁 Script executed: # Read lines around task registrations to see the complete picture
sed -n '100,150p' snakedeploy/scaffold_plugins/common.pyRepository: snakemake/snakedeploy Length of output: 1596 🏁 Script executed: # Check if coverage-report task is added anywhere in the file
grep -n "coverage-report" snakedeploy/scaffold_plugins/common.pyRepository: snakemake/snakedeploy Length of output: 133 🏁 Script executed: # Let's check what ci.yml.j2 expects and the full context around coverage-report reference
sed -n '50,70p' snakedeploy/scaffold_plugins/templates/ci.yml.j2Repository: snakemake/snakedeploy Length of output: 156 🏁 Script executed: # Find ci.yml.j2 file
find . -name "ci.yml.j2"Repository: snakemake/snakedeploy Length of output: 106 🏁 Script executed: # Check the context around line 58 where coverage-report is referenced
sed -n '50,70p' ./snakedeploy/templates/plugins/ci.yml.j2Repository: snakemake/snakedeploy Length of output: 251 🏁 Script executed: # Also check if there are any other coverage-report references
grep -n "coverage-report" ./snakedeploy/templates/plugins/ci.yml.j2Repository: snakemake/snakedeploy Length of output: 105 Remove the The CI template ( Either add 🧰 Tools🪛 Ruff (0.15.1)[error] 116-116: Starting a process with a partial executable path (S607) 🤖 Prompt for AI Agents
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
107
to
122
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CI failure: multiple lines exceed ruff's line-length limit. The pipeline is failing because ♻️ Proposed fix (multi-line style for all offending calls) sp.run(
- ["pixi", "task", "add", "--feature", "dev", "lint", "ruff check src tests"],
+ [
+ "pixi",
+ "task",
+ "add",
+ "--feature",
+ "dev",
+ "lint",
+ "ruff check src tests",
+ ],
check=True,
)
sp.run(
- ["pixi", "task", "add", "--feature", "dev", "format", "ruff format src tests"],
+ [
+ "pixi",
+ "task",
+ "add",
+ "--feature",
+ "dev",
+ "format",
+ "ruff format src tests",
+ ],
check=True,
)
sp.run(
- ["pixi", "task", "add", "--feature", "dev", "typecheck", "pyrefly check src tests"],
+ [
+ "pixi",
+ "task",
+ "add",
+ "--feature",
+ "dev",
+ "typecheck",
+ "pyrefly check src tests",
+ ],
check=True,
)
sp.run(
- ["pixi", "task", "add", "--feature", "dev", "coverage-report", "coverage report -m"],
+ [
+ "pixi",
+ "task",
+ "add",
+ "--feature",
+ "dev",
+ "coverage-report",
+ "coverage report -m",
+ ],
check=True,
)Note: The Ruff S607 warnings on these lines are false positives — the strings like 🧰 Tools🪛 Ruff (0.15.1)[error] 108-108: Starting a process with a partial executable path (S607) [error] 112-112: Starting a process with a partial executable path (S607) [error] 116-116: Starting a process with a partial executable path (S607) [error] 120-120: Starting a process with a partial executable path (S607) 🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be fixed by #118.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||
| sp.run( | ||||||||||||||||||
|
|
@@ -109,10 +129,10 @@ def save_pyproject(pyproject): | |||||||||||||||||
| "dev", | ||||||||||||||||||
| "test", | ||||||||||||||||||
| "pytest " | ||||||||||||||||||
| f"--cov={package_name} " | ||||||||||||||||||
| f"--cov={package_name.replace('-', '_')} " | ||||||||||||||||||
| "--cov-report=xml:coverage-report/coverage.xml " | ||||||||||||||||||
| "--cov-report=term-missing " | ||||||||||||||||||
| "tests/tests.py", | ||||||||||||||||||
| "tests/test_plugin.py", | ||||||||||||||||||
| ], | ||||||||||||||||||
| check=True, | ||||||||||||||||||
| ) | ||||||||||||||||||
|
|
@@ -157,7 +177,6 @@ def render_template(name, dest: Path): | |||||||||||||||||
|
|
||||||||||||||||||
| (tests_path / "__init__.py").unlink(missing_ok=True) | ||||||||||||||||||
|
|
||||||||||||||||||
| render_template("setup.cfg.j2", Path("setup.cfg")) | ||||||||||||||||||
| render_template("release_please.yml.j2", workflows_path / "release-please.yml") | ||||||||||||||||||
| render_template("ci.yml.j2", workflows_path / "ci.yml") | ||||||||||||||||||
| render_template( | ||||||||||||||||||
|
|
||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,65 +6,53 @@ on: | |
| - main | ||
| pull_request: | ||
|
|
||
| env: | ||
| PYTHON_VERSION: 3.11 | ||
|
|
||
| jobs: | ||
| linting: | ||
| format: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out the code | ||
| uses: actions/checkout@v3 | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: {{ "${{ env.PYTHON_VERSION }}" }} | ||
| - name: Setup pixi | ||
| uses: prefix-dev/setup-pixi@v0 | ||
|
|
||
| - name: Install poetry | ||
| run: pip install poetry | ||
| - name: Check formatting | ||
| run: pixi run format --check | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: git ls-files | grep -E "(ci\.yml|common\.py|pixi)" | head -20Repository: snakemake/snakedeploy Length of output: 143 🏁 Script executed: find . -type f -name "*.py" -o -name "*.yml*" | grep -E "(ci|common|pixi)" | head -30Repository: snakemake/snakedeploy Length of output: 147 🏁 Script executed: cat -n snakedeploy/templates/plugins/ci.yml.j2Repository: snakemake/snakedeploy Length of output: 1533 🏁 Script executed: cat -n snakedeploy/scaffold_plugins/common.pyRepository: snakemake/snakedeploy Length of output: 7298 🏁 Script executed: find . -type f \( -name "pixi.toml" -o -name "pyproject.toml" \) | head -5Repository: snakemake/snakedeploy Length of output: 81 🏁 Script executed: cat pyproject.tomlRepository: snakemake/snakedeploy Length of output: 2054 🏁 Script executed: # Search for any pixi documentation or examples in the repo
find . -type f \( -name "*.md" -o -name "*.txt" \) | xargs grep -l "pixi" 2>/dev/null | head -5Repository: snakemake/snakedeploy Length of output: 79 🏁 Script executed: # Check CHANGELOG for any pixi-related information
cat CHANGELOG.md | grep -i pixi -A3 -B3 | head -50Repository: snakemake/snakedeploy Length of output: 439 🏁 Script executed: # Search for how pixi tasks are used elsewhere in the codebase
rg "pixi run" --include="*.md" --include="*.yml" --include="*.yaml" --include="*.sh" -A2 -B2Repository: snakemake/snakedeploy Length of output: 506 🏁 Script executed: # Search for how pixi tasks are used elsewhere in the codebase (corrected)
rg "pixi run" -A2 -B2Repository: snakemake/snakedeploy Length of output: 1658 🏁 Script executed: # Search for pixi behavior documentation or comments
rg "pixi.*run.*-e|pixi.*environment" -A2 -B2Repository: snakemake/snakedeploy Length of output: 1068 🏁 Script executed: # Check the release_please template to see how it handles environments
cat -n snakedeploy/templates/plugins/release_please.yml.j2Repository: snakemake/snakedeploy Length of output: 1546 🏁 Script executed: # Search for any setup-pixi configuration with environments
rg "setup-pixi" -A5 -B5Repository: snakemake/snakedeploy Length of output: 3571 🌐 Web query:
💡 Result: In Pixi, the environment used by
Notes on features ↔ environments:
Sources: Tasks & default-environment + dependency environment precedence [1]; 🌐 Web query:
💡 Result: In
Examples: # Install one env (e.g., in a matrix job)
- uses: prefix-dev/setup-pixi@v0.9.3
with:
environments: ${{ matrix.environment }}[1] # Install multiple envs in one job (space-separated)
- uses: prefix-dev/setup-pixi@v0.9.3
with:
environments: >-
py311
py312[1] [2] Add Tasks ( Use ♻️ Suggested pattern for each job step- - name: Setup pixi
- uses: prefix-dev/setup-pixi@v0
+ - name: Setup pixi
+ uses: prefix-dev/setup-pixi@v0
+ with:
+ environments: dev- run: pixi run format --check
+ run: pixi run -e dev format --checkAlso applies to: 32, 44, 55 🤖 Prompt for AI Agents |
||
|
|
||
| - name: Determine dependencies | ||
| run: poetry lock | ||
| lint: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check out the code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: {{ "${{ env.PYTHON_VERSION }}" }} | ||
| cache: poetry | ||
| - name: Setup pixi | ||
| uses: prefix-dev/setup-pixi@v0 | ||
|
|
||
| - name: Install Dependencies using Poetry | ||
| run: poetry install | ||
| - name: Check code | ||
| run: pixi run lint | ||
|
|
||
| - name: Check formatting | ||
| run: poetry run ruff format --check . | ||
|
|
||
| - name: Lint | ||
| run: poetry run ruff check . | ||
|
|
||
| testing: | ||
| typecheck: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: {{ "${{ env.PYTHON_VERSION }}" }} | ||
| - name: Check out the code | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Install poetry | ||
| run: pip install poetry | ||
| - name: Setup pixi | ||
| uses: prefix-dev/setup-pixi@v0 | ||
|
|
||
| - name: Determine dependencies | ||
| run: poetry lock | ||
| - name: Check code | ||
| run: pixi run typecheck | ||
|
|
||
| - uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: {{ "${{ env.PYTHON_VERSION }}" }} | ||
| cache: poetry | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Install dependencies | ||
| run: poetry install | ||
| - name: Setup pixi | ||
| uses: prefix-dev/setup-pixi@v0 | ||
|
|
||
| - name: Run pytest | ||
| run: poetry run coverage run -m pytest | ||
| run: pixi run test -v | ||
|
|
||
| - name: Run Coverage | ||
| run: poetry run coverage report -m | ||
| run: pixi run coverage-report | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyproject["tool"]will raiseKeyErrorif the initialpyproject.tomlhas no[tool]section.At this point in execution the file hasn't been touched by any
pixicommand yet, so the[tool]key must already be present in the user'spyproject.toml. While pixi-generated manifests do include[tool.pixi], user-created files may not. The same fragility exists at line 103, but that executes after pixi has already modified the file.🛡️ Proposed defensive fix
+ pyproject.setdefault("tool", {}) pyproject["tool"]["coverage"] = {🤖 Prompt for AI Agents