fix: resolve flake8 failures breaking the Conda workflow#323
Merged
Conversation
The 'Python Package using Conda' workflow's flake8 hard-fail gate
(--select=E9,F63,F7,F82) was failing on real bugs and on template files:
- operator_utils.py: run_and_log() used time, re, and subprocess without
importing them (F821) — the function would crash at runtime. Add the
missing imports.
- examples/fibonacci.py: used os.getenv without importing os (F821).
- util/cosutils.py: _download() read with an undefined CHUNK_SIZE (F821);
use the module's MIN_CHUNK_SIZE constant.
- mlx/s3_kv_store.py: main() instantiated MLX(...) but the class is
S3KVStore (F821) — fix the name.
- c3/templates/*: string.Template code-gen files with ${placeholder}
substitutions, not valid standalone Python (E999). Exclude the
templates dir from flake8 via setup.cfg extend-exclude.
flake8 src terratorch_iterate --select=E9,F63,F7,F82 now exits 0.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Romeo Kienzler <romeo.kienzler1@ibm.com>
experiment_logs/ and iterate_study.db are local outputs from running the iterate2 example; they should not be tracked. Remove them and add to .gitignore. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Romeo Kienzler <romeo.kienzler1@ibm.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Python Package using Conda workflow fails on every push. Its flake8 hard-fail gate (
--select=E9,F63,F7,F82, which stops the build on syntax errors and undefined names) flagged a mix of real bugs and template files:Fixes
Real bugs (these would crash at runtime, not just lint):
operator_utils.py—run_and_log()usestime,re,subprocesswith no imports → add them.fibonacci.py— usesos.getenvwith noimport os→ add it.cosutils.py—_download()reads with an undefinedCHUNK_SIZE→ use the module's existingMIN_CHUNK_SIZE(8 MiB), matching_upload.s3_kv_store.py—main()instantiatesMLX(...)but the class isS3KVStore→ fix the name.Not a bug — false positive:
c3/templates/*— these arestring.Templatecode-generation files with${placeholder}substitutions; they are intentionally not valid standalone Python. Excluded viaextend-excludeinsetup.cfg[flake8]so the exclusion applies wherever flake8 runs.Also removed two local run artifacts (
experiment_logs/,iterate_study.db) that slipped in, and added them to.gitignore.Verification
All four edited modules parse (AST) and
operator_utilsimports cleanly.🤖 Generated with Claude Code