Applying Black formatter on symlink directory

314 views Asked by At

I have the following folder structure:

- etl
    - raw
        - raw.py
        - etl (symlink)
            - raw
                - raw.py
                - etl (symlink)
                    ... (infinite paths)
- config.py

I've created a symlink from the etl folder. I'm using symlink so that I can have absolute imports from raw.py into config.py. For example, in raw.py I have the following import: from etl.config import MY_CONSTANT. This absolute import is made possible due to the symlink.

However, when I try to run Black, as in poetry run black ${INCLUDE_FILES} and INCLUDE_FILES = ./etl I run into a infinite loop, as Black tryies to enter in the symlinks and keep going forever. This infinite loop doesn't happen with, for example, Pylint and Flake8.

I could try running Black on every single specific .py file. However, as I have many files, that'd be time consuming.

Is there a way to make Black ignore the symlinks? Or is there another workaround for my situation?

0

There are 0 answers