Skip to content

DOC: Fix flake8 issues in doc/source/whatsnew/v0.15.*.rst #24239

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

Closed
saurav2608 opened this issue Dec 11, 2018 · 11 comments · Fixed by #24635
Closed

DOC: Fix flake8 issues in doc/source/whatsnew/v0.15.*.rst #24239

saurav2608 opened this issue Dec 11, 2018 · 11 comments · Fixed by #24635

Comments

@saurav2608
Copy link

xref: #24177

We didn't start validating the format of PEP8 and other code standards in the documentation examples until recently. We still have some files with errors, that we need to skip, and that we should fix, so we can start validating them.

Two steps are required to replicate the issue

  1. Edit setup.cfg in the pandas home, and in the flake8-rst section, remove from the exclude list the file doc/source/whatsnew/v0.15.0.rst, doc/source/whatsnew/v0.15.1.rst & doc/source/whatsnew/v0.15.2.rst
  2. Remove the import block ( from pandas import *) from the lines (8-11) of the file v0.15.*.rst.

After that, running the next command will report the errors in the file (note that syntax error usually prevent to validate other errors, and the list of errors to fix can become much longer when the syntax error is fixed (please make sure that you are using flake8-rst version 0.7.0 or higher):

$ flake8-rst doc/source/whatsnew/v0.15.*
doc/source/whatsnew/v0.15.0.rst:75:10: F821 undefined name 'DataFrame'
doc/source/whatsnew/v0.15.0.rst:75:25: E231 missing whitespace after ':'
doc/source/whatsnew/v0.15.0.rst:75:28: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.0.rst:75:30: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.0.rst:75:32: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.0.rst:75:34: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.0.rst:75:36: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.0.rst:75:52: E231 missing whitespace after ':'
doc/source/whatsnew/v0.15.0.rst:75:84: E501 line too long (80 > 79 characters)
doc/source/whatsnew/v0.15.0.rst:84:84: E501 line too long (96 > 79 characters)
doc/source/whatsnew/v0.15.0.rst:121:21: F821 undefined name 'Timedelta'
...
doc/source/whatsnew/v0.15.1.rst:26:10: F821 undefined name 'Series'
doc/source/whatsnew/v0.15.1.rst:26:17: F821 undefined name 'date_range'
doc/source/whatsnew/v0.15.1.rst:26:38: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.1.rst:26:48: E231 missing whitespace after ','
doc/source/whatsnew/v0.15.1.rst:65:14: F821 undefined name 'df'
doc/source/whatsnew/v0.15.1.rst:65:25: F821 undefined name 'ts'
doc/source/whatsnew/v0.15.1.rst:154:37: E231 missing whitespace after ','
...
doc/source/whatsnew/v0.15.1.rst:231:85: E501 line too long (86 > 79 characters)
doc/source/whatsnew/v0.15.2.rst:77:30: E231 missing whitespace after ':'
doc/source/whatsnew/v0.15.2.rst:152:32: F821 undefined name 'engine'
...

Once all the errors are addressed, please open a pull request with the fixes in the file, and removing the file from setup.cfg. If you need to do something that feels wrong to fix an error, please ask in a comment to this issue. Please avoid other unrelated changes, which can be addressed in a separate pull request.
cc: @datapythonista

@joybh98
Copy link
Contributor

joybh98 commented Dec 13, 2018

Can i work on this issue?

@saurav2608
Copy link
Author

@joybhallaa : please go ahead.

@joybh98
Copy link
Contributor

joybh98 commented Dec 17, 2018

I have not been able to remove line too long error, all other issues are taken care of, only undefined errors are present with the exception of line too long error.
I'm not able to fix the line error.

@datapythonista
Copy link
Member

can you open a pull request @joybhallaa, so we can comment on it.

@joybh98
Copy link
Contributor

joybh98 commented Dec 17, 2018

When i run python make.py html I'm getting the error
ImportError: C extension: dynamic module does not define module export function (PyInit_conversion) not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
And when i run python setup.py build_ext --inplace --force i get a lot of errors related to setup.py.
Can anyone help?

@datapythonista
Copy link
Member

Can you try with a python setup.py clean first?

@saurav2608
Copy link
Author

When i run python make.py html I'm getting the error
ImportError: C extension: dynamic module does not define module export function (PyInit_conversion) not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
And when i run python setup.py build_ext --inplace --force i get a lot of errors related to setup.py.
Can anyone help?

@joybhallaa - Did you follow the instructions given at Contributing to the documentation. You will have to create a dev environment.

@joybh98
Copy link
Contributor

joybh98 commented Dec 19, 2018

screenshot from 2018-12-19 16-38-49
screenshot from 2018-12-19 16-40-50
Only these errors are left,and these cannot be solved due to as it's dependent on pandas see https://lintlyci.github.io/Flake8Rules/rules/F821.html
When running python make.py html
I'm getting the following error.

screenshot from 2018-12-19 16-49-11

I know i'm probably annoying you guys,but i want to get these changes push as soon as possible :)

@datapythonista
Copy link
Member

most of them are solved by replacing Series by pd.Series and equivalent. The ones like df not defined can be solved by defining df (may be in a :suppress: block with a simple df = pd.DataFrame() if no better solution is available.

To run the docs you need to compile pandas C code first python setup.py build_ext --inplace (in the root of the project)

@saurav2608
Copy link
Author

most of them are solved by replacing Series by pd.Series and equivalent. The ones like df not defined can be solved by defining df (may be in a :suppress: block with a simple df = pd.DataFrame() if no better solution is available.

@datapythonista - the issue is that a variable ts is defined in a previous block and is reused in the current block. Is there a way to connect these blocks. I saw some reference to directives such as :flake8-group: Group in the flake8-rst repo. But I don't think it works yet.

@datapythonista
Copy link
Member

Afaik the version of flake8-rst we're using just merges all the blocks, so I don't think that's the problem.

In any case, let's better wait until there is a PR, it's not very efficient to discuss the code without having it or being able to comment on it.

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