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

disallow "private" imports #14890

Closed
wants to merge 6 commits into from
Closed

disallow "private" imports #14890

wants to merge 6 commits into from

Conversation

zzstoatzz
Copy link
Collaborator

@zzstoatzz zzstoatzz commented Aug 12, 2024

use a preview ruff rule (PLC2701) to disallow "private" imports, since we should try to keep the use of some thing _foo to the place in which its defined

and make ruff happy in some assorted cases found by running pre-commit run --all-files

also updates ruff in the pre-commit config

lint.extend-select = ["I"]
lint.preview = true
lint.extend-select = ["I", "PLC2701"]
lint.explicit-preview-rules = true
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"only use preview rules we explicitly include in extend-select"


# Do not enforce line length; black does this for code and we do not care about comments / docs
lint.ignore = ["E501"]

[lint.per-file-ignores]
# Do not enforce usage and import order rules in init files
"__init__.py" = ["E402", "F401", "I"]
"__init__.py" = ["E402", "F401", "I", "PLC2701"]
"**/{tests,docs}/*" = ["F841", "PLC2701"]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"don't worry about private imports in tests" e.g. from prefect._internal

@zzstoatzz zzstoatzz marked this pull request as ready for review August 12, 2024 15:47
Copy link

codspeed-hq bot commented Aug 12, 2024

CodSpeed Performance Report

Merging #14890 will not alter performance

Comparing no-import-private-name (6d8f6d8) with main (75e4738)

Summary

✅ 3 untouched benchmarks

@zzstoatzz zzstoatzz marked this pull request as draft August 12, 2024 15:52
Copy link
Contributor

This pull request is stale because it has been open 14 days with no activity. To keep this pull request open remove stale label or comment.

Copy link
Contributor

This pull request was closed because it has been stale for 14 days with no activity. If this pull request is important or you have more to add feel free to re-open it.

@github-actions github-actions bot closed this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant