chore(packaging): Convert project to src-layout#736
chore(packaging): Convert project to src-layout#736MaxymVlasov merged 2 commits intoantonbabenko:masterfrom
Conversation
This patch puts it directly into the check script. In general, it's harmful to have such logic in `__init__.py` since it's executed at import time and would get triggered when interacting with other importables from the same namespace just as well.
This is one of the most resilient Python project structures that offers isolation and prevents accidental local imports during testing [[1]]. [1]: https://blog.ganssle.io/articles/2019/08/test-as-installed.html
| 'For migration instructions see ' | ||
| 'https://github.com/antonbabenko/pre-commit-terraform/issues/248' | ||
| '#issuecomment-1290829226', |
There was a problem hiding this comment.
There is a linter in my branch, which ask to avoid implicit string concatenations, so, let's not make it less happy (no matter that this hook is not supported anymore)
| 'For migration instructions see ' | |
| 'https://github.com/antonbabenko/pre-commit-terraform/issues/248' | |
| '#issuecomment-1290829226', | |
| 'For migration instructions see ' | |
| + 'https://github.com/antonbabenko/pre-commit-terraform/issues/248' | |
| + '#issuecomment-1290829226', |
There was a problem hiding this comment.
You missed one line in the code suggestion. Also, we talked about disabling that rule, so I suggest skipping this change. Besides, this isn't exactly in the scope of the PR as the implicit concatenation was used in __init__.py and I didn't change that.
There was a problem hiding this comment.
Yep, I run test and explitit concatenation is =< 1 * 10^-8 seconds more time consuming than implicit
I don't think that it's a big deal in our case, but i'm good to merge it now as is
There was a problem hiding this comment.
is =< 1 * 10^-8 seconds more time consuming
I don't think that it's a big deal in our case, but i'm good to merge it now as is
Jeez, dude, you're throwing nanoseconds around like a drunken sailor 🤣
MaxymVlasov
left a comment
There was a problem hiding this comment.
I surprised that this time __init__.py can be finally removed and not causes any issues 🎉
|
This PR is included in version 1.97.0 🎉 |
📦 Convert project to src-layout
This is one of the most resilient Python project structures that
offers isolation and prevents accidental local imports during testing
[1].
The change also includes moving the deprecation message into a warning
raised from the affected script in runtime as opposed to import time.
In general, it's harmful to have such logic in
__init__.pysinceit's executed at import time and would get triggered when interacting
with other importables from the same namespace just as well.
Put an
xinto the box if that apply:Description of your changes
$sbj.
How can we test changes
python -Im build