-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add mypy build to Azure pipelines #1290
Conversation
|
just a comment Since the build is allowed to fail, and at the same time not directly visible in the "Show all checks" list, I don't know who will check it before a merge. I guess that merging this will not hurt that much...but if this is not used, it will just create extra load for Travis-CI and will slow down (just a tiny bit) the whole Travis-CI systems for all the other open source projects. If a CI check is to be added, I think that is better create a separate Later, while changes are made, the mypy-ci configuration file can be updated to include other parts of the Twisted code base From my experience, if you have a build with "allow_fail" it means that the build has no importance and it will never be fixed and will just accumulate more failures. I think that this is the approach we use (and still use) for pyhon3 porting and it was used for the pyflakes cleanup. Bellow is a suggestion of how this new mypy-ci could looks like. Btw... It looks like the mypi.ini file is not used by tox... not sure why it is theres. diff --git a/mypy.ini b/mypy.ini
index 9d4f38bc7..b1fce7f47 100644
--- a/mypy.ini
+++ b/mypy.ini
@@ -18,3 +18,67 @@ disallow_incomplete_defs = False
no_implicit_optional = False
warn_return_any = False
warn_unreachable = False
+
+
+[mypy-twisted.application.*]
+ignore_errors = True
+
+
+[mypy-twisted.logger.*]
+ignore_errors = True
+
+[mypy-twisted.pair.*]
+ignore_errors = True
+
+
+[mypy-twisted.protocols.*]
+ignore_errors = True
+
+
+[mypy-twisted.python.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.conch.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.cred.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.internet.test.*]
+ignore_errors = True
+
+[mypy-twisted.mail.*]
+ignore_errors = True
+
+[mypy-twisted.names.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.trial.*]
+ignore_errors = True
+
+[mypy-twisted._threads.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.trial._dist.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.scripts.*]
+ignore_errors = True
+
+
+[mypy-twisted.web.test.*]
+ignore_errors = True
+
+
+[mypy-twisted.words.*]
+ignore_errors = True
diff --git a/tox.ini b/tox.ini
index c391de715..b272d9de6 100644
--- a/tox.ini
+++ b/tox.ini
@@ -172,5 +172,6 @@ deps =
commands =
mypy \
--cache-dir="{toxworkdir}/mypy_cache" \
+ --config="{toxinidir}/mypy.ini" \
{tty:--pretty:} \
{posargs:src} |
|
The change to tox.ini that you suggested is not needed. If I hack mypy.ini to introduce errors, and then do: |
|
In terms of resources, on my laptop, if I run: So the resources are not too bad. |
c7e3cfc
to
811b27c
Compare
|
To address your concern about not being able to see the mypy build, I removed it from Travis, When we eliminate all mypy errors, we can reconfigure the Azure pipeline to fail if mypy fails. Last week there were over 1200 errors reported by mypy, and right now there are around 550, so I think it is doable over time. |
613f582
to
b7b2e8f
Compare
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.
I would prefer to have the jobs defined in a single file and see the actual result of the tests.
Other than that, all fine.
You are right, there is no need to explicitly call mypy with the path to the configuration file.
azure-pipelines/mypy_test_jobs.yml
Outdated
| @@ -0,0 +1,12 @@ | |||
| parameters: | |||
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.
Thanks for the change.
I think that this is a bit of an over-engineering.
For mypy the "template" should be use only as an include semantic and not as a generator.
I feel that splitting the rules over 2 files, and defining the Ubuntu image name as a variable is only making it harder to understand what is going on there.
Below is my suggestions for the content of this file, and the other file can be removed.
Also, since this is only one job, I think that is best to name this file just mypy.job.yml or something like that.
This is all about testing so using test in the name doesn't add much value... and this is a single job ...so jobs is kind of misleading.
I would prefer to see the test in red, as failing... so that we can see the actual result.
It should not be marked as required, so it should not block any merge.
But it will serve as a reminder that mypy is not really green.
jobs:
- job: 'ubuntu_mypy'
displayName: 'Mypy Ubuntu'
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
displayName: "Use Python 3.8"
inputs:
versionSpec: "3.8"
- script: |
python --version
python -c "import sys; print(sys.prefix)"
python -c "import sys; print(sys.exec_prefix)"
python -c "import sys; print(sys.executable)"
python -c "import struct; print(struct.calcsize('P') * 8)"
displayName: 'Get Python Information'
- script: 'python -m pip install -U pip setuptools tox'
displayName: 'Update pip & install tox'
- script: 'python -m tox -e mypy'
displayName: 'Run mypy'
b7b2e8f
to
95cfabf
Compare
|
OK, I changed this PR to have a single |
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.
Looks good. Thanks.
The status is green, when in fact the build failed.
I think is best not to fake it, and instead show the real status.
I don't see what we gain if we fake the status.
|
OK, I can take out the setting Since the Mypy build is not configured as a build that is required to pass in order to merge a PR, |
95cfabf
to
88a90cd
Compare
|
@adiroiban So I removed Should I put |
|
@adiroiban by the way, the Windows Python 3.8 builds on Azure have been marked as You can see the Windows Python 3.8 builds fail here: Unless there is a way to flag certain Azure builds as required, Do you know if we can change the required builds? |
|
true... as mypy is part of the twisted.twisted pipeline I think that the mypy should renamed to This will be a simple pipeline definition with a single stage/job I don't have access to Azure Devops...so I can't create a new pipeline. Thanks! |
88a90cd
to
f9614f8
Compare
|
Sounds good. Thanks for your patience and review feedback! |
|
I have access to twisted/twisted protected branch settings and I can change which test is required... but I prefer to have mypy as a separate pipeline... otherwise I will have to disable the twisted.twisted main pipeline requirements and require separate jobs.... But maybe this is the best way forward as it will only require GitHub access without extra access to Azure Devops (for creating an extra pipeline) |

https://twistedmatrix.com/trac/ticket/9848