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

Use ruff to enforce import alias #57282

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

tqa236
Copy link
Contributor

@tqa236 tqa236 commented Feb 6, 2024

I replaced the hook use-pd_array-in-core with ruff's unconventional-import-alias

The pre-commit job will fail to show that the check works. It will pass after I enable exclude: ^pandas/core/api\.py$.

If this change is accepted, I can continue with removing the old hook.

As far as I can understand, a major difference is that scripts/use_pd_array_in_core.py tries to detect all variants of pd.<insert anything here>.array while we must explicitly pass the full path for ruff (there's only pandas.core.construction.array).

@simonjayhawkins simonjayhawkins added the Code Style Code style, linting, code_checks label Feb 7, 2024
@mroeschke
Copy link
Member

Looks pretty good. Could you address the pre-commit failure?

@tqa236 tqa236 force-pushed the use-ruff-to-enforce-alias branch from 10e20b5 to e75de8c Compare February 29, 2024 04:26
@tqa236
Copy link
Contributor Author

tqa236 commented Feb 29, 2024

@mroeschke I fixed the config and removed the old hook. pre-commit passes now. The failed pipelines seem unrelated to this PR.

@mroeschke mroeschke added this to the 3.0 milestone Mar 5, 2024
@mroeschke mroeschke merged commit 2ce4fba into pandas-dev:main Mar 5, 2024
45 of 47 checks passed
@mroeschke
Copy link
Member

Thanks @tqa236

@tqa236 tqa236 deleted the use-ruff-to-enforce-alias branch March 17, 2024 07:53
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* Use ruff to enforce import alias

* Remove old hook

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants