chore: add Python .gitignore - #24
Conversation
Not sure about `.python-version` line
The code loads C_lut.npy (complex_colormap/cplot.py:25), not M_lut.npy.
📝 WalkthroughWalkthroughThe pull request adds 223 lines to ChangesPython project ignore rules
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.gitignore:
- Around line 222-223: Ensure the package includes or generates C_lut.npy before
complex_colormap imports cplot. Update the packaging/import flow around
complex_colormap/__init__.py, setup.py, and generation.py so clean installations
do not raise FileNotFoundError, while preserving normal cplot imports.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| # Generated lookup table | ||
| C_lut.npy |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 5 'C_lut\.npy|M_lut\.npy|np\.load|numpy\.load' complex_colormap/cplot.py
if git ls-files --error-unmatch -- C_lut.npy >/dev/null 2>&1; then
echo "C_lut.npy is tracked."
else
echo "C_lut.npy is not tracked; locate its generator or packaging path."
rg -n -C 5 'C_lut\.npy|generate.*lut|lookup table' .
fiRepository: endolith/complex_colormap
Length of output: 6727
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- repository files ---'
git ls-files | sed -n '1,160p'
printf '%s\n' '--- packaging and build configuration ---'
for f in setup.py setup.cfg pyproject.toml MANIFEST.in requirements.txt requirements-dev.txt; do
if [ -f "$f" ]; then
echo "### $f"
cat -n "$f"
fi
done
printf '%s\n' '--- generation entry point ---'
sed -n '115,190p' complex_colormap/generation.py
printf '%s\n' '--- package references ---'
rg -n -C 3 'generation|C_lut\.npy|package_data|data_files|include_package_data|MANIFEST' .Repository: endolith/complex_colormap
Length of output: 6658
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
import ast
from pathlib import Path
import subprocess
tracked = subprocess.run(
["git", "ls-files", "--error-unmatch", "--", "C_lut.npy"],
capture_output=True, text=True
).returncode == 0
setup = Path("setup.py").read_text()
init_tree = ast.parse(Path("complex_colormap/__init__.py").read_text())
generation_tree = ast.parse(Path("complex_colormap/generation.py").read_text())
setup_calls = [
node for node in ast.walk(ast.parse(setup))
if isinstance(node, ast.Call)
and isinstance(node.func, ast.Name)
and node.func.id == "setup"
]
setup_call = setup_calls[0]
keywords = {kw.arg: ast.unparse(kw.value) for kw in setup_call.keywords if kw.arg}
imports = [
alias.name for node in init_tree.body
if isinstance(node, ast.ImportFrom) and node.module == "."
for alias in node.names
]
main_guards = [
node for node in generation_tree.body
if isinstance(node, ast.If)
and ast.dump(node.test) == ast.dump(
ast.Compare(
left=ast.Name(id="__name__", ctx=ast.Load()),
ops=[ast.Eq()],
comparators=[ast.Constant(value="__main__")]
)
)
]
save_calls = [
ast.unparse(node)
for node in ast.walk(generation_tree)
if isinstance(node, ast.Call)
and isinstance(node.func, ast.Attribute)
and isinstance(node.func.value, ast.Name)
and node.func.value.id == "np"
and node.func.attr == "save"
]
print(f"tracked_C_lut={tracked}")
print(f"setup_package_data={keywords.get('package_data', '<absent>')}")
print(f"setup_include_package_data={keywords.get('include_package_data', '<absent>')}")
print(f"init_imports={imports}")
print(f"generation_main_guard_count={len(main_guards)}")
print(f"generation_save_calls={save_calls}")
PY
printf '%s\n' '--- Makefile targets ---'
cat -n MakefileRepository: endolith/complex_colormap
Length of output: 1397
Include or generate C_lut.npy before importing cplot.
C_lut.npy is untracked and setup.py does not package it. complex_colormap/__init__.py imports cplot before generation, while generation.py creates the file only under its __main__ block. A clean install therefore fails with FileNotFoundError.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.gitignore around lines 222 - 223, Ensure the package includes or generates
C_lut.npy before complex_colormap imports cplot. Update the packaging/import
flow around complex_colormap/__init__.py, setup.py, and generation.py so clean
installations do not raise FileNotFoundError, while preserving normal cplot
imports.
Adds a standard Python
.gitignorefrom the GitHub gitignore template, preventing generated files (bytecode, lookup tables, build artifacts) from being tracked.M_lut.npytypo ->C_lut.npy(the filecplot.pyactually loads)__pycache__files from being committed (the Cloud Agent auto-commit recently picked these up)Summary by CodeRabbit