Skip to content

TYP: implement a MixinColumn typing.Protocol - #17189

Draft
neutrinoceros wants to merge 2 commits into
astropy:mainfrom
neutrinoceros:table/typing/implement_mixin_column_protocol
Draft

neutrinoceros wants to merge 2 commits into
astropy:mainfrom
neutrinoceros:table/typing/implement_mixin_column_protocol

Conversation

@neutrinoceros

Copy link
Copy Markdown
Contributor

Description

Extracted from, and to be used in #17051, as suggested by @eerovaher

This formalizes an already documented protocol.

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@github-actions github-actions Bot added the table label Oct 16, 2024
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@neutrinoceros neutrinoceros added this to the v7.0.0 milestone Oct 16, 2024
@neutrinoceros neutrinoceros changed the title TYP: implement a MixinColumn typing.Protocol TYP: implement a MixinColumn typing.Protocol Oct 16, 2024
@neutrinoceros
neutrinoceros marked this pull request as ready for review October 17, 2024 13:48
Comment thread astropy/table/typing.py Resolved
Comment thread astropy/table/typing.py
info: MixinInfo
shape: tuple[int, ...]

def __getitem__(self, key): ...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MixinColumn is clearly a generic type where the parameter must agree with the return type of __getitem__().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, though I'm not sure how well this mixes with a Protocol, but let's give it a try !

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type of __getitem__ can be either MixinColumn or a scalar element of MixinColumn. I'm not sure how to capture that.

@neutrinoceros neutrinoceros Dec 16, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was addressed with TypeVar + Protocol[T] + @overloading. Good to go, @eerovaher ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me, but its the sub-package maintainer that should do the final review.

@neutrinoceros
neutrinoceros force-pushed the table/typing/implement_mixin_column_protocol branch from 4d3acb3 to 5a98de4 Compare October 22, 2024 07:57
Comment thread astropy/table/typing.py Resolved
@neutrinoceros
neutrinoceros force-pushed the table/typing/implement_mixin_column_protocol branch from 8073746 to 3ef5960 Compare October 23, 2024 13:08
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

We're hours away from astropy 7.0's feature freeze and this shouldn't be blocking in any way, so I'll bump the milestone to clear the backlog. If this happened to be merged today anyway, please revert the milestone.

@neutrinoceros neutrinoceros modified the milestones: v7.0.0, v7.1.0 Oct 25, 2024
Comment thread astropy/table/typing.py Resolved
Comment thread astropy/table/typing.py Resolved
Comment thread astropy/table/typing.py Resolved
@neutrinoceros
neutrinoceros force-pushed the table/typing/implement_mixin_column_protocol branch from ee5b486 to db117f0 Compare December 16, 2024 10:41
Comment thread astropy/table/typing.py Resolved
@neutrinoceros
neutrinoceros marked this pull request as draft December 17, 2024 10:14
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Taking this one to draft for now, as I committed a partial implementation of @nstarman's suggestion but I'm now uncertain that it is the right approach. Further discussion needed in #17189 (comment)

@astrofrog astrofrog modified the milestones: v7.1.0, v7.2.0 Apr 28, 2025
@github-actions github-actions Bot added the Close? Tell stale bot that this issue/PR is stale label May 17, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Hi humans 👋 - this pull request hasn't had any new commits for approximately 4 months. I plan to close this in 30 days if the pull request doesn't have any new commits by then.

In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary.

If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock.

If you believe I commented on this pull request incorrectly, please report this here.

@neutrinoceros neutrinoceros removed the Close? Tell stale bot that this issue/PR is stale label May 19, 2025
@astrofrog astrofrog modified the milestones: v7.2.0, v8.0.0 Nov 3, 2025
@astrofrog astrofrog modified the milestones: v8.0.0, v8.1.0 May 5, 2026
@pllim pllim removed the keep-open label Oct 14, 2026
@github-actions github-actions Bot added the Close? Tell stale bot that this issue/PR is stale label Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi humans 👋 - this pull request hasn't had any new commits for approximately 1 year, 10 months. I plan to close this in a month if the pull request doesn't have any new commits by then.

In lieu of a stalled pull request, please consider closing this and open an issue instead if a reminder is needed to revisit in the future. Maintainers may also choose to add keep-open label to keep this PR open but it is discouraged unless absolutely necessary.

If this PR still needs to be reviewed, as an author, you can rebase it to reset the clock.

If you believe I commented on this pull request incorrectly, please report this here.

@neutrinoceros
neutrinoceros force-pushed the table/typing/implement_mixin_column_protocol branch from 0e7ffb7 to 35c7b70 Compare October 16, 2026 07:04
@pllim pllim removed the Close? Tell stale bot that this issue/PR is stale label Oct 16, 2026
@nstarman

nstarman commented Nov 8, 2026

Copy link
Copy Markdown
Member

@neutrinoceros what's the latest on this?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants