Exclude specs#30
Merged
Merged
Conversation
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.
Add
--exclude-filesupport for excluding specs from processingReplaces the hardcoded
blacklistlist incanvas_api_builder.pywith a user-defined TOML file that can be passed via a--exclude-fileCLI option. The same option is also available incanopy_docsto keep excluded specs out of generated LLM documentation.Motivation
Some Canvas spec files contain malformed parameters that cause code generation to fail or produce invalid Python. Previously, the only way to skip these was to edit the
blacklistvariable directly in the source. This approach is user-friendly (no source edits required), portable (each user maintains their own local file), and consistent across both CLI tools.Changes
canopy/scripts/canvas_api_builder.pyblacklist: list[str] = []module-level variableload_excluded_specs(exclude_file)— reads a TOML file usingtomllib(stdlib, Python 3.11+) and returns aset[str]--exclude-file/-eoption tobuild-all-apis,rebuild-apis, andupdate-spec-filescanopy/scripts/canopy_docs.pyload_excluded_specs()using the same implementation for consistency_collect_api_files()now acceptsexcluded_specsand filters by mapping the.pystem back to its source spec name (e.g.accounts_async.py→accounts.json)--exclude-file/-eoption togenerate-indexandgenerate-allgenerate-llmsintentionally has no--exclude-fileas it writes a static framework description unrelated to individual specsexcluded_specs.toml.example(new).exampleconvention as.env.local.example.gitignoreexcluded_specs.tomlso each user's exclusion list stays localREADME.mdcanvas_api_builderusage docscanopy_docscommands and the--exclude-fileoptionUsage
Notes
tomllibis part of the Python 3.12 stdlib already required by this projectexcluded_specs.tomlis gitignored;excluded_specs.toml.exampleis committed as a reference