Merged
Conversation
- Fix fill_config returning undefined 'defaulted' instead of 'overrided' - Add missing imports: warnings, Dict, List in _interpolation.py - Replace srsly.json_loads/json_dumps with stdlib json in util.py - Add missing ConfigValidationError import in util.py - Create _constants.py module for shared constants (VARIABLE_RE, SECTION_PREFIX, ARGS_FIELD, etc.) to avoid circular imports - Fix __init__.py importing symbols from wrong modules
…itance, fix pyrightconfig
- Phase 1: use sections() not keys() to exclude DEFAULT - Phase 2: navigate into section (parts not parts[:-1]) - _replace_section_refs: write to node[key] not config[key] - validate_configparser: validate configparser structure early - test_config_basic: hypothesis roundtrip test with interpolate=False
Coverage on _parser.py: 71% -> 93%
…-section refs, string coercion
…, interpolate, overrides
Cover: custom handlers, Strict() metadata, string forward refs, string enums, dataclass decompose, Parameter.empty, pydantic v1/v2 validator edges, schema alias decompose
- fill_config now recursively fills defaults from registered function schemas - Handles nested promises (promise args that are themselves promises) - Schema.from_function() generates schemas from function signatures
Cover: Promise lifecycle, insert/resolve/fix_positionals, registry.has/get, get_constructor, parse_args, alias_generator, _deep_copy_with_uncopyable, _is_config_section, nested promise resolution
…inst unresolved types Fixes TypeError when TypeVar bounds or generic origins contain ForwardRefs or complex Union types that aren't valid for isinstance(). Falls back to outer_match() for recursive checking.
ForwardRefs from dataclass/typing annotations (e.g. thinc's Floats3d) can reach the typechecker when not using pydantic for resolution. Accept them since we can't validate what we can't resolve.
Instead of accepting unresolved ForwardRefs blindly, resolve them using get_type_hints() with the dataclass's module namespace. Falls back to raw annotations if resolution fails.
… compat - resolve() accepts schema and validate kwargs - fill() accepts schema for default filling - Post-resolve validation against schema when validate=True - Note: promise arg validation not yet implemented (1 spaCy test fails)
…igparser level Overrides now applied in the correct order: 1. Parse flat sections (configparser) 2. Re-nest into dict (interpret) 3. Apply overrides (on nested dict) 4. Replace section refs Fixes dict overrides replacing promise sections (e.g. replacing a scorer with a different registered function).
- fill() skips promises referencing unknown functions (defaults can't be filled, error surfaces at resolve time) - fill_defaults() strips extra fields when schema has extra='forbid' - Recursive default filling for nested schemas
…g, move issue tests
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.
Couldn't bear to abandon the refactor and go back to the tangled v0.1.5 implementation. I redid the type checking, laying out a good top-level structure for the recursion: https://github.com/explosion/confection/blob/87fb1733317208ffa1929b895119f315d93f0e6b/confection/typechecker.py. This allowed me to finally separate the
ConfigParserpart out into two pure functions that just handle the string-to-dict and dict-to-string parts.