- 
                Notifications
    
You must be signed in to change notification settings  - Fork 22
 
Install black/ruff if not found in current python environment CF-495 #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -578,8 +578,20 @@ def configure_pyproject_toml(setup_info: SetupInfo) -> None: | |
| formatter_cmds = [] | ||
| if formatter == "black": | ||
| formatter_cmds.append("black $file") | ||
| print("checking if black exists") | ||
| try: | ||
| import black | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should do this checking exactly the same way we run black when we do the formatting. I believe it runs as a subprocess. We should detect with that method if black is installed. The same goes for ruff formatter  | 
||
| except ImportError as e: | ||
| print("black not found, installing via pip") | ||
| subprocess.run(["pip", "install", "black"]) | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should not modify the user environment like this, only recommend the user to install black with this command. same for ruff  | 
||
| elif formatter == "ruff": | ||
| formatter_cmds.extend(["ruff check --exit-zero --fix $file", "ruff format $file"]) | ||
| print("checking if ruff exists") | ||
| try: | ||
| import ruff | ||
| except ImportError as e: | ||
| print("ruff not found, installing via pip") | ||
| subprocess.run(["pip", "install", "ruff"]) | ||
| elif formatter == "other": | ||
| formatter_cmds.append("your-formatter $file") | ||
| click.echo( | ||
| 
          
            
          
           | 
    ||
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| # These version placeholders will be replaced by poetry-dynamic-versioning during `poetry build`. | ||
| __version__ = "0.9.2" | ||
| __version_tuple__ = (0, 9, 2) | ||
| __version__ = "0.0.0.post2491.dev0+2f81f2ca" | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file should also be reverted.  | 
||
| __version_tuple__ = (0, 0, 0, "post2491", "dev0", "2f81f2ca") | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this file should be reverted