Skip to content

Conversation

@Zrahay
Copy link
Contributor

@Zrahay Zrahay commented Oct 28, 2025

Description

This PR adds an .editorconfig file to improve developer experience by helping text editors and IDEs automatically apply formatting settings that align with pandas' project rules.

This complements existing formatters (ruff format, clang-format, meson-fmt) by providing immediate visual feedback in editors before files are saved/committed.

Closes #62736


Checkbox Updates:

  • Closes Create .editorconfig #62736
  • Tests added and passed - N/A (configuration file, no tests needed)
  • All code checks passed - Validated .editorconfig syntax and settings
  • Added type annotations - N/A (not applicable for configuration file)
  • Added whatsnew entry - N/A (documentation/tooling improvement, not user-facing)

Changes Made

Added .editorconfig file with format settings for:

  • Python (.py): max_line_length = 88, indent_size = 4
  • Cython (.pyx): max_line_length = 88, indent_size = 4
  • C (.c, .h): max_line_length = 80, indent_size = 2
  • YAML (.yml, .yaml): indent_size = 4
  • JSON (.json): indent_size = 4
  • Shell (.sh): indent_size = 4
  • RST (.rst): indent_size = 4
  • Meson (meson.build): max_line_length = 80, indent_size = 4
  • Global: UTF-8 charset, LF line endings, insert final newline, trim trailing whitespace

Alignment with Project Standards

All settings align with pandas' existing conventions:

  • Python/Cython max_line_length = 88 matches [tool.ruff] line-length in pyproject.toml
  • Python/Cython indent_size = 4 matches existing code style
  • C file settings (max_line_length = 80, indent_size = 2) match C codebase conventions
  • Character encoding and line ending settings match project requirements

Testing

Validated the .editorconfig using the editorconfig command-line tool:

Zrahay and others added 10 commits October 25, 2025 23:50
- Add type check for numeric_only parameter in _cython_agg_general
- Raise ValueError if numeric_only is not a boolean
- Add test case for validation
- Closes pandas-dev#62778
…mment on line 1759 and reverted the comment change on line 1757
Define formatting rules for .py, .pyx, .c, meson.build, YAML, JSON, .sh, and .rst files to complement existing formatters and improve developer experience.

Closes pandas-dev#62736
@Zrahay Zrahay changed the title Feature/editorconfig Create .editorconfig #62736 Oct 28, 2025
charset = UTF-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
Copy link
Member

Choose a reason for hiding this comment

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

This instruction is a little bit invasive to be applied for all files

Comment on lines +11 to +19
[*.py]
max_line_length = 88
indent_style = space
indent_size = 4

[*.pyx]
max_line_length = 88
indent_style = space
indent_size = 4
Copy link
Member

Choose a reason for hiding this comment

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

Merge these 2 instructions



[*.c]
max_line_length = 80
Copy link
Member

Choose a reason for hiding this comment

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

I think it's best to don't add max_line_length

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, should I follow this only for this .c or every other file?

Copy link
Member

Choose a reason for hiding this comment

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

There is no intent in adding this file to the repository.

But FYI, it depends mainly on linting settings. For Python and Pyrex this setting is enforced, so it would be beneficial. I don't recall how it's defined for C, but a textwidth of 80 seems small.

indent_size = 2

[meson.build]
max_line_length = 80
Copy link
Member

Choose a reason for hiding this comment

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

Same here


[*.{yml,yaml}]
indent_style = space
indent_size = 4
Copy link
Member

Choose a reason for hiding this comment

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

Some files in the codebase has an indent size of 2, others has of 4. Keep it in 2 for now.

indent_size = 4


[*.c]
Copy link
Member

Choose a reason for hiding this comment

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

include .h

@mroeschke
Copy link
Member

Given the discussion in #62736, we'll not be moving forward with this file so closing

@mroeschke mroeschke closed this Oct 28, 2025
@Zrahay Zrahay deleted the feature/editorconfig branch October 28, 2025 21:32
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.

Create .editorconfig

3 participants