Skip to content
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

Allow extras to be installed for typechecking #6

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

DMRobertson
Copy link
Contributor

@DMRobertson DMRobertson commented Apr 25, 2022

In matrix-org/synapse#12531 I was bitten by a different mypy result in CI to my local environment. CI was running poetry install; I had run poetry install --extras all locally.

I had intended for poetry's development environment (its list of dev-dependencies) to be sufficient for all development tasks. But that ideal doesn't work well here. On reflection, let's allow this action to install a list of extras for typechecking only.

Proof that this works: https://github.com/matrix-org/synapse/runs/6156325285?check_suite_focus=true#step:3:3 shows that we pass the extras through to setup-python-poetry.

Once merged, I'll do a minor release (1.3.0) and forward the v1 tag.

@DMRobertson DMRobertson changed the base branch from main to release/v1 April 25, 2022 11:26
@DMRobertson DMRobertson marked this pull request as ready for review April 25, 2022 11:28
@DMRobertson DMRobertson requested a review from a team as a code owner April 25, 2022 11:28
@@ -33,6 +45,9 @@ jobs:

- name: Setup Poetry
uses: matrix-org/setup-python-poetry@v1
with:
# We want to make use of type hints in optional dependencies too.
extras: "${{ inputs.typechecking-extras }}"
Copy link
Member

Choose a reason for hiding this comment

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

Seems OK -- should we use just extras for this though instead of typechecking-extras?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to emphasise that this was only going to install extras to run mypy; flake8, isort, black all run from the "bare" set of developer dependencies that poetry defines.

Not a strongly-held opinion though; happy to change if you think extras is clearer.

Copy link
Member

Choose a reason for hiding this comment

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

👍 Ah, I see. I think it is fine either way, just wasn't sure of the rationale!

@DMRobertson DMRobertson merged commit af67b64 into release/v1 Apr 27, 2022
@DMRobertson DMRobertson deleted the dmr/extras-for-typechecking branch April 27, 2022 11:32
DMRobertson pushed a commit to matrix-org/synapse that referenced this pull request Apr 27, 2022
Now that matrix-org/backend-meta#6 is merged to
the release/v1 branch.
DMRobertson pushed a commit to matrix-org/synapse that referenced this pull request Apr 27, 2022
Over time we've begun to use newer versions of mypy, typeshed, stub
packages---and of course we've improved our own annotations. This makes
some type ignore comments no longer necessary. I have removed them.

There was one exception: a module that imports `select.epoll`. The
ignore is redundant on Linux, but I've kept it ignored for those of us
who work on the source tree using not-Linux. (#11771)

I'm more interested in the config line which enforces this. I want
unused ignores to be reported, because I think it's useful feedback when
annotating to know when you've fixed a problem you had to previously
ignore.

* Installing extras before typechecking

Lacking an easy way to install all extras generically, let's bite the bullet and
make install the hand-maintained `all` extra before typechecking.

Now that matrix-org/backend-meta#6 is merged to
the release/v1 branch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants