Can we flatten `pip._internal` into something else?
See original GitHub issueCan we flatten
pip._internal
into something else?_Originally posted by @pradyunsg in https://github.com/pypa/pip/pull/8466#issuecomment-646159513_
I’m thinking of basically doing str.replace("internal.", "")
on our imports:
pip._internal.network
->pip._network
pip._internal.cache
->pip._cache
- (you get the idea)
pip._vendor
stays as is.
It’ll make them a bit… nicer. It’ll be easier to write these imports, to read them and so on.
Before someone suggests a pip
-> _pip
, that transition would eat into a lot more of our churn budget and we’ll need to keep the pip
package anyway, if we don’t want a repeat of #5599. (did you forget that’s a thing? Ubuntu users haven’t.)
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Flattening a shallow list in Python [duplicate] - Stack Overflow
Is there a simple way to flatten a list of iterables with a list comprehension, or failing that, what would you all consider...
Read more >Flattening JSON objects in Python - Towards Data Science
Pandas provides a nice utility function json_normalize for flattening semi-structured JSON objects. The array was not flattened.
Read more >3 Ways To Flatten Any List In Python - YouTube
Learn how you can flatten any list in Python. We will be exploring 3 different ways to do this. First will be through...
Read more >How to Flatten a Dictionary in Python in 4 Different Ways
In this post, we'll look at 4 different ways to flatten a dict in Python. For each method I'll point out the pros...
Read more >Welcome to Flatten Tool's documentation! — Flatten Tool 0.0.0 ...
Flatten Tool is a Python library and command line interface for converting single or multi-sheet spreadsheets to a JSON document and back again....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Personally I feel this is little merit. The import names are cumbersome, but removing
_internal
isn’t helping much. OTOH this would break literally everything using pip internals, again. I know pip doesn’t really have an API and you’re at your own risk doing it etc, but it is still not a nice thing to do simply because pip maintainers think it looks better. (And also note that this change would not really help prevent #8466.)We used to not have any prefix at all and it caused a lot of confusion where people wouldn’t realize pip doesn’t have an api because it was following a convention that says “hey these names are public”. I don’t think we should lose some sort of prefix.
I think the _internal name is clearer and makes it far more obvious to people not to touch it. If we want imports to be nicer we could use relative imports instead.
Sent from my iPhone