Skip to content
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

Question: how to exclude virtual environment? #63

Open
jamesbraza opened this issue Jan 3, 2024 · 1 comment
Open

Question: how to exclude virtual environment? #63

jamesbraza opened this issue Jan 3, 2024 · 1 comment

Comments

@jamesbraza
Copy link

When adding the below to my .libcst.codemod.yaml:

blacklist_patterns: ['repo\/venv\/']

I get a bunch of FileNotFoundErrors:

Codemodding /Users/user/code/repo/venv/lib/python3.10/site-packages/Bio/Entrez/__init__.py
Traceback (most recent call last):
  File "/Users/user/code/repo/venv/lib/python3.10/site-packages/libcst/codemod/_cli.py", line 314, in _execute_transform
    newcode = invoke_formatter(config.formatter_args, newcode)
  File "/Users/user/code/repo/venv/lib/python3.10/site-packages/libcst/codemod/_cli.py", line 56, in invoke_formatter
    subprocess.check_output(
  File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/subprocess.py", line 421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/subprocess.py", line 503, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/subprocess.py", line 971, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Users/user/.pyenv/versions/3.10.13/lib/python3.10/subprocess.py", line 1863, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/Users/user/code/repo/black'

I currently have Python 3.10.13 with:

autotyping==23.3.0
libcst==1.1.0

How can I exclude a virtual environment from autotyping when running:

python -m libcst.tool codemod autotyping.AutotypeCommand . --aggressive
@jamesbraza
Copy link
Author

jamesbraza commented Jan 3, 2024

Actually, I realized the FileNotFoundError comes from the fact that black is being used with the default libCST config under the formatter item. After pip install black, the FileNotFoundError goes away.

However, autotyping still keeps formatting the venv. How can one exclude a virtual environment when running autotyping?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant