This patch also fixes import in cbor2/ to make them relative.
Details
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
I think you should send the relative import patches to upstream. Adding from __future__ import absolute_import would also be a nice touch.
I tried that at https://github.com/agronholm/cbor2/pull/20. I might be doing something wrong here but I am not sure what's that.
I started engaging the package author on that PR. I care enough about this issue that I may start a discussion on a Python mailing list about it. Not sure which one though.
@alex_gaynor: if I wanted to convince some heavy hitters in the Python community that relative imports within packages should be a best practice, how would you recommend going about that?
The heaviest stick would be to write a PEP encouraging this practice, that way there'd be a canonical place to point people.
An intermediate step might be starting a thread on python-dev (or maybe python-ideas) about it.
You can also always blog about why it's useful. I think best practices around relative imports (explicit and implicit) were formed in a different era and deserve reconsideration.
The relative imports are now done: https://github.com/agronholm/cbor2/commit/84181540f6eb650437e3f73cd104a65661fe8e67
I vendored upstream commit 84181540f6eb650437e3f73cd104a65661fe8e67. So the relative imports will drop from this commit when it is pushed.