-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Refactor Session._initialparts to have a more explicit type #6547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@blueyed I forgot to mention, I'm working on these types you suggest, but I decided not to mix code changes with typing changes, so that they can be considered separately. I will send the typing changes in a separate PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, including @blueyed's suggestion.
Perhaps we should target features
instead though, even if this is renaming an internal attribute?
7a3ec7d
to
3f52f30
Compare
Thanks for review @blueyed @nicoddemus.
I prefer features too because I don't think these changes need to go on patch releases. But @blueyed sends typing changes to master so I started following suit. I must say I am still confused by this 😄. I think I and @blueyed should be synchronized on this, WDYT @blueyed? If I have time this weekend, I'll try to address your comments on going forward with the master/features workflow changes. Then we won't have this dilemma :) |
I think adding type hints to Now that I mention this, perhaps we should also rename it? I think it is good practice to rename an attribute when the underlying data changes like this one, because I think an |
Good idea, I'll do it.
The tricky part here is that I only make this change so that further typing changes can depend on it. So they will need to go to features. As I said I actually prefer it, but I'm not sure @blueyed does. |
3f52f30
to
8b9601c
Compare
I think we do not need to care about compatibility for internal attributes really, but I agree that this should be avoided in bugfix releases. Currently this means that this should go into features, but given the situation described in #6387 (comment) I actually think that we're about to drop features soon, and consider master what features is currently for us, using release branches for bugfix releases.
That would be great. I've also started looking at the documented release process briefly (#6549). In my opinion we could start with a Anyway, for this PR I think it is better to stay with master, which shouldn't really be a problem when we're creating the next 5.3.x release as suggested above (and like I've suggested for 5.3.4 already). |
This is new to me... I thought we would just release from Or did you mean hotfixes? (Anyway we should probably discuss this in another venue, sorry for the noise). |
Yes that's the point. 👍 Even if a plugin is wrongly accessing it, I would not like to "break" it for users in a bugfix release. |
8b9601c
to
3286a6e
Compare
Previously, _initialparts was a list whose first item was a `py.path.local` and the rest were `str`s. This is not something that mypy is capable of modeling. The type `List[Union[str, py.path.local]]` is too broad and would require asserts for every access. Instead, make each item a `Tuple[py.path.local, List[str]]`. This way the structure is clear and the types are accurate. To make sure any users who might have been accessing this (private) field will not break silently, change the name to _initial_parts.
3286a6e
to
dd5c2b2
Compare
Rebased on features. |
Previously,
_initialparts
was a list whose first item was apy.path.local
and the rest werestr
s. This is not something thatmypy is capable of modeling. The type
List[Union[str, py.path.local]]
is too broad and would require asserts for every access.
Instead, make each item a
Tuple[py.path.local, List[str]]
. This waythe structure is clear and the types are accurate.