question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Update %-format call to use str.format

See original GitHub issue

What’s the problem this feature will solve?

Currently in src/pip/_internal/operations/prepare.py, we use %-style string formatting.

Describe the solution you’d like

We should use the .format method for consistency with the rest of the code base.

We should also consider doing the same for the rest of the code base. Whoever takes care of this specific issue should make a general issue for that!

Posted in its original form by @pradyunsg in #6968 (comment)


This issue is a good starting point for anyone who wants to help out with pip’s development – it’s simple and the process of fixing this should be a good introduction to pip’s development workflow.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
pfmoorecommented, Sep 12, 2019

I do wonder if there’s some way to make the format strings for logging calls to use the new-style formatting

The style parameter documented here allows this. But it’s Python 3 only. Can we stop supporting Python 2 now, please? 🙂

2reactions
atugushevcommented, Mar 10, 2020

Could be related to this issue. I see now these logs on pip install ...:

Collecting pytest==3.8.2
  Downloading pytest-3.8.2-py2.py3-none-any.whl (209 kB)
     |████████████████████████████████| {downloaded} {download_speed} {pretty_eta}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Python String Formatting Best Practices
Learn the four main approaches to string formatting in Python, as well as their strengths and weaknesses. You'll also get a simple rule...
Read more >
How To Use String Formatters in Python 3 - DigitalOcean
Formatters in Python allow you to use curly braces as placeholders for values that you'll pass through with the str.format() method.
Read more >
Python String format() Method - GeeksforGeeks
Python string format() function has been introduced for handling complex string ... The only change is using a colon (:) instead of %....
Read more >
Format function in Python - Towards Data Science
Formatters work by fixing one or a lot of replacement fields or placeholders outlined by a pair of curled brackets “{}” — into...
Read more >
Python String format() Explain with EXAMPLES - Guru99
Example: Empty Placeholder replaced with a numeric value; Example: Using variable or keyword arguments inside the Placeholder; Example: Using ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found