Draft
Conversation
…EM102) - Replace os.path calls with pathlib.Path in _load_config and _find_file - Move tomlkit.items.Item import into TYPE_CHECKING block - Use absolute imports in goodconf.contrib modules - Extract exception message variable and change ValueError → TypeError for invalid callable check in initial_for_field - Exclude auto-generated _version.py from ruff - Remove PTH, TID252, TC002, TRY003, TRY004, EM102 from ruff ignore list
- Add NotRequired to GoodConfConfigDict fields (file_env_var, default_files) - Annotate loader variable in _load_config as Callable[..., Any] - Fix _fieldinfo_to_str else branch to return str(annotation) - Restructure initial_for_field to use isinstance dict check - Add type: ignore[call-arg] for pydantic default_factory() - Add type: ignore[assignment] for intentional BaseCommand monkey-patch - Use walrus operator in argparse.py to narrow default_files type - Add django-stubs to dev deps for Django type coverage - Switch mypy pre-commit hook to language: system using uv run
…sion - Annotate Field(), FileConfigSettingsSource.__init__(), GoodConf._load(), get_initial(), generate_yaml/json/toml(), django_manage() - Annotate argparser_add_argument() and execute_from_command_line_with_config() - Annotate patched_parser() closure in contrib/django using lazy-imported types - Annotate tests/utils.env_var() - Narrow Field json_schema_extra param to dict[str, Any] | None - Remove ANN from ruff ignore list; only ANN401 (Any) remains suppressed
- Import PydanticUndefined from pydantic_core (explicitly exported) - Cast PydanticField return value to FieldInfo for no-any-return - Fix type: ignore code on BaseCommand monkey-patch to [method-assign] - Enable strict = true in [tool.mypy]
- Run mypy on tests/ in pre-commit hook - Enable pydantic.mypy plugin - Add test override: relax untyped-def, suppress pydantic-settings false positives for assignment/call-arg - Use GoodConfConfigDict in test_django.py instead of pydantic ConfigDict - Fix individual ignores: arg-type, no-redef, attr-defined - Fix test_goodconf: guard __doc__ None before 'in' check - Fix test_optional_initial: call G.get_initial() (classmethod, no instance needed)
Using getattr(c, "UNDEFINED") is explicit about intent (runtime attribute lookup) and removes both the attr-defined type: ignore and noqa: B018.
…CI workflow - Update mypy hook entry to `uv run mypy goodconf tests` so it runs in the project venv rather than requiring a globally installed mypy - Add .prettierrc.toml for YAML and Markdown formatting - Add .github/workflows/pre-commit.yml to replace pre-commit.ci; installs uv and syncs project deps before running hooks
…_filenames: true)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #60 +/- ##
==========================================
+ Coverage 98.42% 98.44% +0.02%
==========================================
Files 8 8
Lines 380 386 +6
Branches 5 5
==========================================
+ Hits 374 380 +6
Misses 3 3
Partials 3 3 ☔ View full report in Codecov by Sentry. |
…ings abstract interface
…by calling convention
- Add if t.TYPE_CHECKING to coverage exclude_lines - Pin codecov-action to SHA v5.5.2
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.
Closes #59
Summary
ruff
A001,ANN,ANN401,ARG001,ARG002,E501,EM102,ISC001,N802,PLC0415,PTH,TC002,TID252,TRY003,TRY004# noqaadded inline where the suppression is genuinely needed:N802—Field()intentional public API casingARG001/ARG002— args required by calling convention (pydantic-settings abstract interface, loader shims)PLC0415— lazy imports for optional deps (yaml, toml) and DjangoANN401—Anyon pydantic passthroughs and config field defaults;load()closures properly typed (stream: object,-> dict[str, Any])A001resolved by renaming internal variablehelp→help_textinargparser_add_argumentmypy
ignore_errors = truereplaced withstrict = trueandpydantic.mypyplugintests.*override:disallow_untyped_defs = false, suppressassignmentandcall-argfalse positives from pydantic-settingsdjango-stubsadded to dev dependenciesgoodconf/Source fixes (found during annotation work)
GoodConfConfigDictfields changed from required toNotRequired—GoodConfConfigDict()is now validPydanticUndefinedimported frompydantic_core(correct export path; waspydantic.fields)initial_for_fieldraisesTypeErrorinstead ofValueErrorwheninitialis not callable_find_fileusesPath.resolve()instead ofos.path.abspath()open(path)replaced withPath(path).open()tests
tmpdirmigrated totmp_path(pathlib.Path) throughout-> Noneadded to all test functionsMockerFixture,pytest.MonkeyPatch,pytest.CaptureFixture[str]pre-commit / CI
language: system,entry: uv run mypy(uses project venv)ci: skip: [mypy]added so pre-commit.ci skips mypy; local developers still run it on committest.yml(Python 3.14 only, after tests).prettierrc.tomladded