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

[WIP] docstrings: automatically import pyunlocbox & numpy #23

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mdeff
Copy link
Collaborator

@mdeff mdeff commented Mar 24, 2020

It makes for cleaner doctests, but it doesn't pass make lint with errors like F821 undefined name 'operators'.

doesn't pass make lint with errors like F821 undefined name 'operators'
@mdeff mdeff self-assigned this Mar 24, 2020
@mdeff
Copy link
Collaborator Author

mdeff commented Mar 24, 2020

We should probably switch to black before spending time to make flake8 happy.

@nperraud
Copy link
Collaborator

I think swichting to black is a good idea.

@mdeff mdeff marked this pull request as draft April 8, 2020 21:54
@nperraud
Copy link
Collaborator

Do you want me to give a shot at this?

I would go with the following steps:

  1. Go back one commit
  2. Rebase on master
  3. Fix make lint by swtiching to black
  4. Check if numpy and pyunlocbox in imported in some other place

@nperraud
Copy link
Collaborator

Note that here I do not import numpy but it does not complain:

>>> from pyunlocbox import functions

@mdeff
Copy link
Collaborator Author

mdeff commented Jan 27, 2021

Note that here I do not import numpy but it does not complain:

Oh that is weird. Not only doesn't make lint complain, but the doctest passes. I also tried to remove from pyunlocbox import functions: the doctest passes too but make lint complains about F821 undefined name 'functions'. So it seems that both doctest and flake8 recognize np as being numpy (without configuration), while only doctest recognizes functions to be pyunlocbox.functions.

That issue won't be fixed by black. We have to somehow tell flake8 that functions, solvers, etc. are found in pyunlocbox. Maybe by understanding how it's ok for np not to be imported. Or you meant replacing flake8 by black?

@mdeff
Copy link
Collaborator Author

mdeff commented Jan 27, 2021

I think of them as complementary: black formats the code, and flake8 checks (in CI) that it's ok. Black doesn't make checks right?

But I'm all to have black. It'll save us review time. :) But in another PR (which could be done before this one if necessary).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants