feat: fully type donfig and ship py.typed - #149
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #149 +/- ##
==========================================
+ Coverage 98.28% 98.46% +0.18%
==========================================
Files 6 6
Lines 759 784 +25
==========================================
+ Hits 746 772 +26
+ Misses 13 12 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
djhoese
left a comment
There was a problem hiding this comment.
This looks good to me. Thanks for doing it. I'm not sure I entirely understand or am comfortable with the changes to self.defaults, but I think I mostly have problems with the previously allowed behavior of in-place modifications. I left some comments inline.
| ): | ||
| config: MutableMapping[str, Any], | ||
| lock: SerializableLock | contextlib.AbstractContextManager[Any], | ||
| deprecations: Mapping[str, str | None], |
There was a problem hiding this comment.
Hm I wonder why this was a MutableMapping before. Good catch.
|
Any other changes needed on this or ready for merge? |
I pushed a couple clean up changes. I think this PR is now ready for merge. |
|
Ah sorry, I merged your other PR first and now there are conflicts. Do you mind fixing those? Rebasing would be nice if you're feeling brave 😉 |
|
Just curious, what lead to the simplification/restriction to |
|
hey, sorry for stepping back from this - I was busy with ESIP last week.
I considered three options here:
I went with 3 mainly because it matched dask's choice, so it seemed battle-tested, but there were a couple of supporting reasons:
In general |
|
I'm ok with the |
| def test_paths_accepts_any_sequence(monkeypatch): | ||
| monkeypatch.setenv("MYPKG_CONFIG", "foo-bar") | ||
| config = Config("mypkg", paths=("/etc/mypkg",)) | ||
| assert config.paths == ["/etc/mypkg", "foo-bar"] |
There was a problem hiding this comment.
Removed because it asserted tuple support, which contradicts the declared paths: list[str]
There was a problem hiding this comment.
Right, but is there a reason Sequence wouldn't work?
There was a problem hiding this comment.
Sequence + a runtime check against a bare str (which is natively a Sequence) would work. I can change this if you prefer that option?
There was a problem hiding this comment.
Nah, let's leave it for now. This PR has seen enough work.
Side question: Have I been doing too much agentic coding or am I talking to your AI in these comments?
There was a problem hiding this comment.
I have typed my comments to you with my human digits 😆
I do often run my responses by Claude first with an "is this accurate?" which might be injecting some bot-ness into my phrasing; I should probably cut that out and just be more confident.
At the same time, I have a long history of failing the "am I a bot tests" when trying to sign up for accounts (I still cannot get into facebook marketplace 😞), so it might not actually be anything different that I'm doing now...
|
I've lost count. Do you have more PRs planned? Then I assume you'd like a release after that? |
This is PR three out of four in a sequence to support downstream use cases. It improves typing via: