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.

Run on a file or directory

See original GitHub issue

Thanks for this handy tool!

It would be nice to be able to run pyupgrade on a directory, and have it process all .py files in that directory and subdirectories.

For example:

pyupgrade .

This would be similar to other tools like Flake8 and Black.

In the meantime, this works:

pyupgrade `find . -name "*.py"`

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
cdeilcommented, Feb 6, 2019

@asottile - thank you for this wonderful tool!

I would also find this option useful to pass a folder. Yes, it’s a bit of code to walk the directories, but black has a very good implementation that could be copied.

It’s not obvious to me why one would use pre-commit to upgrade a given codebase. Upgrading is a one-time action, at least that’s how I want to use it. So why make this a pre-commit hook? – @asottile maybe you could clarify a bit at the start of the readme.

1reaction
bagerardcommented, Mar 11, 2020

Hi @asottile I understand that you are advocating for pre-commit but I believe it would be good to mention the trick with pyupgrade find . -name “*.py” -type f`` in a “Usage” section of the readme as well. What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to run a file in a different directory - Ask Ubuntu
No you don't need to use: cd home/directoryA/directoryB/directoryC/DirectoryD ./somefile. You can simply run the command by prefixing it ...
Read more >
chmod - Change the mode of a file or directory - IBM
A superuser or the file owner can use a chmod command or chmod() function to change two options for an executable file. The...
Read more >
How to Run Files in Linux: 9 Steps (with Pictures) - wikiHow
1. Open a file manager application. Most Linux distributions come with a default file manager program. This may be Nautilus, Thunar, Dolphin, Krusader...
Read more >
Chapter 7 - FILE PERMISSIONS
Read, write and execute permissions are set for directories as well as files. Read permission means that the user may see the contents...
Read more >
Execute a Command Whenever File or Directory Changes
Learn how to monitor a directory recursively and execute a command whenever the files and directories within it change.
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