Skip to content

DOC: Fix flake8 issue in whatsnew files #24177

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 9, 2018 · 21 comments · Fixed by #24199
Closed

DOC: Fix flake8 issue in whatsnew files #24177

saurav2608 opened this issue Dec 9, 2018 · 21 comments · Fixed by #24199

Comments

@saurav2608
Copy link

saurav2608 commented Dec 9, 2018

In some of the whatsnew files we are using implicit imports. For example in "whatsnew/v0.11.0.rst"
we import pandas from pandas import * implicitly. We instantiate using the implicitly imported class DataFrame later in the code.

df1 = DataFrame(randn(8, 1), columns = ['A'], dtype = 'float32')
df1

The preferred approach is to use explicit import as import pandas as pd and replace the call to DataFrame with pd.DateFrame.

Note:

  1. import pandas as pd is part of the header, so it is imported by default. In that case just replacing DataFrame with pd.DateFrame and removing from pandas import * should be enough.
  2. Many whatnew files are using the preferred approach of explicit calling pd.*. However, the import statement of from pandas import * is included by default. In such case, just remove the import statement.

cc: @datapythonista

Status of whatsnew files

File Name Implicit Imports Flake8-rst
v0.24.0.rst Pass Pass: #24217
v0.23.4.rst Pass Pass
v0.23.3.rst Pass Pass #24273
v0.23.2.rst Pass Pass
v0.23.1.rst Pass: #24199 Pass #24273
v0.23.0.rst Pass Pass: #24217
v0.22.0.rst Pass Pass: #24217
v0.21.1.rst Pass Pass
v0.21.0.rst Pass Pass: #24217
v0.20.3.rst Pass Pass
v0.20.2.rst Pass Pass
v0.20.0.rst Pass Pass: #24236
v0.19.2.rst Pass Pass
v0.19.1.rst Pass Pass
v0.19.0.rst Pass #24236 Pass #24236
v0.18.1.rst Pass Pass
v0.18.0.rst Pass #24233 Pass #24233
v0.17.1.rst Pass #24235 Pass #24235
v0.17.0.rst Pass #24235 Pass #24235
v0.16.2.rst Pass #24338 Pass #24338
v0.16.1.rst Pass #24338 Pass #24338
v0.16.0.rst Pass #24338 Pass #24338
v0.15.2.rst Pass #24635 Pass #24635
v0.15.1.rst Pass #24635 Pass #24635
v0.15.0.rst Pass #24635 Pass #24635
v0.14.1.rst Pass #24253 Pass #24253
v0.14.0.rst Pass #24253 Pass #24253
v0.13.1.rst Pass #24322 Pass #24322
v0.13.0.rst Pass #24322 Pass #24322
v0.12.0.rst Pass #24309 Pass #24309
v0.11.0.rst Pass #24277 Pass #24277
v0.10.1.rst Pass #24277 Pass #24277
v0.10.0.rst Pass #24277 Pass #24277
v0.7*-v0.9* Pass #24273 Pass #24273
v0.4*-v0.6* Pass Pass
@datapythonista
Copy link
Member

Thanks for creating the issue @saurav2608

Did you check if the changes required are small to have a single PR for all files? I'm guessing if it'd make sense to create an issue to fix all the flake8-rst errors for each version (all the 0.23.* in one issue). I see all the whatsnew files are skipped right now.

If you want to take a look yourself, may be fix some cases, see what's reasonable to do (in terms of having issues that are not too big), and create the issues, that would be really great. Otherwise I'll take a look myself.

@saurav2608
Copy link
Author

@datapythonista :
There are 1015 flake8-rst errors in all the whatsnew files. Of that 200 have F405 type errors. F405 is due to import * but could have other reasons as well. My suggestion is to fix all the F405 errors in one PR. I will take this up.
For the rest, I can create one issue per whatsnew. And one master issue tracking them all. (similar to how you have organized for the rest of .rst files)

@datapythonista
Copy link
Member

Sounds good. I'd start by the newest whatsnew files, and if you see there are too many F405 errors for one PR, just open one half way and continue in another. Huge PRs make reviews very inefficient.

@saurav2608
Copy link
Author

I have created a PR for errors in recent whatsnew ( v20.0 and above). I am creating issues for the flake-8 error. One for each whatsnew.

@saurav2608 saurav2608 changed the title DOC: remove implicit imports in whatsnew rst files DOC: track implicit imports and flake8 errors in whatsnew rst files Dec 10, 2018
@datapythonista datapythonista changed the title DOC: track implicit imports and flake8 errors in whatsnew rst files DOC: Fix flake8 issue in whatsnew files Dec 10, 2018
@datapythonista
Copy link
Member

I changed the formats in the table to be the same as the issue for the other .rst files, I hope you don't mind. Makes it easier to read having the same.

For the Pass or OK, I consider them OK when we don't exclude them anymore in in setup.cfg. Otherwise, we don't guarantee that a new change does not break them again (in this case there shouldn't be changes to the old whatsnew, but still, better to be in the safe side).

Thanks a lot for taking care of this.

@thoo
Copy link
Contributor

thoo commented Dec 11, 2018

@saurav2608 Can you update the table: status of whatsnew files for my PR? This PR is related to v0.23.0.rst and v0.22.0.rst?

@datapythonista
Copy link
Member

updated

@thoo
Copy link
Contributor

thoo commented Dec 11, 2018

PR #24217 now covers #24200 (v0.24.0.rst) too.

@saurav2608
Copy link
Author

@jreback - this issue should remain open. This is a master issue with reference to all the issues in whatsnew.

@jreback jreback reopened this Dec 11, 2018
@jreback
Copy link
Contributor

jreback commented Dec 11, 2018

@saurav2608 see my comment

don’t put ‘closes’ in the PR, instead use xref

@saurav2608
Copy link
Author

@jreback I see what you mean. This issue changed over time. Going forward it will be streamlined.

@saurav2608
Copy link
Author

saurav2608 commented Dec 16, 2018

@datapythonista : can you have a quick look at the issue I pointed to in the PR #24236. I am cleaning up the above table need clarifications.

@datapythonista
Copy link
Member

@saurav2608 I couldn't find the issue, can you send me the link to the exact comment, or tag me on it?

@saurav2608
Copy link
Author

saurav2608 commented Dec 18, 2018

@saurav2608 I couldn't find the issue, can you send me the link to the exact comment, or tag me on it?

@datapythonista : I tagged you on that. I am not able to get the link to the exact comment (it is a review ). I have added a new comment tagging you. Line 1036.

@datapythonista
Copy link
Member

I can't find anything in #24236 and didn't received any notification, no idea what's going on, but no idea what's the issue, sorry.

@saurav2608
Copy link
Author

@datapythonista : I am replicating the comment here. The issue is near line 1030.

I know this is closed and merged. But I noticed an exception while building docs on my local. And traced it back to here. This 2 space indentation is probably wrong. In my local build, I am getting an error

Exception in .../pandas-saurav/doc/source/whatsnew/v0.20.0.rst at block ending on line 1043
Specify :okexcept: as an option in the ipython:: block to suppress this message
  File "<ipython-input-114-e2b4e607b6f6>", line 1
    .. _whatsnew_0200.api_breaking.hdfstore_where:
    ^
SyntaxError: invalid syntax

The indentation puts this line of code inside .. code-block:: ipython
@FHaase , retag @datapythonista

@datapythonista
Copy link
Member

ok, I see, can you open a PR to remove the indentation please?

@jreback
Copy link
Contributor

jreback commented Jan 2, 2019

these are left (aside from open PR to fix 0.15.x)

    doc/source/basics.rst
    doc/source/contributing_docstring.rst
    doc/source/enhancingperf.rst

@saurav2608
Copy link
Author

There are no issues created for one and two above. I can create those and if reasonable effort finish them off.

@saurav2608
Copy link
Author

@jreback / @datapythonista - this issue is now closed. All what whatsnew files are off the exception list.

@datapythonista
Copy link
Member

thanks a lot for this @saurav2608

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

Successfully merging a pull request may close this issue.

4 participants