-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Coding Style Guidline.rst #34608
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
Coding Style Guidline.rst #34608
Conversation
Created a unified version of the Coding Style Guidelines Extracted rules from various pandas website information as well as submission scripts that verify style requirements Work in progress
This just duplicates what is already on the docs right? If so I think can just update the existing contributing guide with links rather than a new file with copied content |
This doesn't just copy what is in the docs. This is just the start of the doc and I did pull information scattered in multiple locations about coding guidelines. I also started to pull out checks that are done in the script that check for coding guidelines that are not described anywhere. If this document becomes more robust it think that it would be a useful tool for the OSS project. |
I am also unsure of how to fix the CI/Checks error. It is saying there is a trailing white space after all my lines which do no show up in my IDE |
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.
OK thanks. So for things that are enforced by black I don't think we need to go into details as the tool just does these things for you.
We still need to figure out how to manage this versus existing documentation we have, but if you can trim down by removing the black sections should make it easier to iterate
Coding Style Guidline.rst
Outdated
2.1 Line Length | ||
~~~~~~~~~~~~~~~ | ||
|
||
Line length is restricted to 80 characters to promote readability. |
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.
We use a line length of 88
Coding Style Guidline.rst
Outdated
|
||
Line length is restricted to 80 characters to promote readability. | ||
|
||
2.2 Indentation |
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 think this is enforced by black; no need to detail here
Coding Style Guidline.rst
Outdated
if x == 3 | ||
x = 10 | ||
|
||
2.3 Whitespaces Around Arithmetic Operators |
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.
same for comment around black
Coding Style Guidline.rst
Outdated
|
||
x=3+5/2 | ||
|
||
2.4 Missing White Spaces After Commas |
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.
same for black
Coding Style Guidline.rst
Outdated
|
||
myFunctionCall('a','b','c') | ||
|
||
2.5 Header File |
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.
Is this a Python reference?
value = str | ||
f"Unknown recived type, got: '{type(value).__name__}'" | ||
|
||
4 Types |
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.
OK so this is already in the contributing guideline. If we want to move here then should remove from that so as not to duplicate
@WillAyd I'll trim those out and resubmit, thank you for your help! |
@WillAyd I have updated those sections. Let me know if there is anything else that I could research/add |
@WillAyd I am also unsure of how to get past the CI / Checks portion of the pull request. It is saying there is a trailing white space after every line but in my IDE this is not there. |
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 think the trailing whitespace might be a false positive from not having the code-block
directives explicitly declared
Coding Style Guidline.rst
Outdated
|
||
**Good:** | ||
|
||
:: |
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.
Can you make these code-block:: python directives?
Coding Style Guidline.rst
Outdated
2 Patterns | ||
---------- | ||
|
||
2.1 Header File |
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.
What is this in reference to? This isn't anything Python related right? I think should just remove
Coding Style Guidline.rst
Outdated
import numpy as np | ||
import pandas as pd | ||
|
||
4.1.2 Unused Imports |
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.
Since this is enforced by flake8 already I don't think need to call out here
Coding Style Guidline.rst
Outdated
|
||
maybe_primes: List[Union[int, None]] = [] | ||
|
||
4.1.1 Redundant Imports |
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.
This is strictly for writing documentation, but for general code style it is certainly OK to import these. I think can just remove this from this guide
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.
@WillAyd I made those changes you requested, but it still seems like it is failing after ever carriage line return
The section on |
@Stockfoot still active? If so can you simplify and address comments? |
@WillAyd I am still around.
|
This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. |
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.
@Stockfoot are you interested in continuing? If yes if you can address comments & merge master we'll take another look
@arw2019 I am interested in continuing. I have addressed the comments but no one has ever responded back to my question on how to proceed and actually get a pull request going. Every time I try and submit it will no pass CI / Checks and am unsure how to proceed... |
Can you merge master again and I'll take a look (output from the last build is no longer available for inspection). Some failures are random but we want to make sure otherwise will have to address Also I might be wrong but I don't think you responded to https://github.com/pandas-dev/pandas/pull/34608/files#r440389770 |
Closing for now. @Stockfoot let us know whenever you'd like to pick this up and we'll reopen |
Created a unified version of the Coding Style Guidelines
Extracted rules from various pandas website information as well as submission scripts that verify style requirements
Work in progress
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff