Skip to content

Conversation

@eddiebergman
Copy link
Collaborator

Reference Issue

#945

What does this PR implement/fix? Explain your changes.

Implements the PEP 561 standard for Distributing and Packaging Type Information.

How should this PR be tested?

By using mypy -c 'import openml'

mypy should succeed and report no errors

Any other comments?

I'm not sure how the test result should be reported.
For now it's a simple if/else print statement in ci_scripts/install.sh but please point me in the right direction otherwise.
I'm not even sure if the ci_scripts/install.sh script ran during any of the testing steps described in CONTRIBUTING.md but there were no errors. I tried to run it manually by it seems to be intended to run from a CI environment.

As setup.py does not install mypy, I also did a manual test by pip install mypy followed by mypy -c 'import openml' which succeeded.

> mypy -c 'import openml'        
Success: no issues found in 1 source file

I can also verify that it ran on the locally installed package by running

> pip list | grep openml
openml              0.11.0.dev0 /home/skantify/opensource/openml-python

Lastly, as the documentation says nothing about py.typed contents and is assumed blank, I did not add the BSD3 clause to it.

@eddiebergman
Copy link
Collaborator Author

The one travis-ci failed run seems to be unrelated to my additions as far as I'm aware

Copy link
Collaborator

@mfeurer mfeurer left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the prompt PR and for contributing to our repository! This looks good, but unfortunately it does not quite work yet - please see my comments inline.

# Assumes mypy relies solely on the PEP 561 standard
# Also assumes mypy to be available
if ! python -m mypy -c "import openml"; then
echo "Failed: PEP 561 compliance"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please make this more strict, i.e. fail the installation?


# PEP 561 compliance check
# Assumes mypy relies solely on the PEP 561 standard
# Also assumes mypy to be available
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately, we don't install mypy and the test therefore fails. An easy fix for now would be to install mypy here as well.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can see this in the travis-ci log for the different builds if you expand the entry for install.sh:

/home/travis/miniconda/envs/testenv/bin/python: No module named mypy

Failed: PEP 561 compliance

@eddiebergman
Copy link
Collaborator Author

Thanks for the quick review!

I'll have a go with it again tomorrow :)

Is there a specific way to fail the build or should I just give an exit(1)?

@mfeurer
Copy link
Collaborator

mfeurer commented Sep 23, 2020

exit(1) should be fine

@eddiebergman
Copy link
Collaborator Author

The logs seem to indicate that it passed the mypy check now :)

@mfeurer mfeurer merged commit d303ced into openml:develop Sep 28, 2020
@mfeurer
Copy link
Collaborator

mfeurer commented Sep 28, 2020

Thank you very much for your contribution!

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