Код: Выделить всё
[tool.poetry.scripts]
format-scripts = "black:main scripts/**/*.py"
< /code>
Но это не работает. Я получаю эту ошибку при запуске Poetry Run Format-Scripts Код: Выделить всё
Warning: 'format-scripts' is an entry point defined in pyproject.toml, but it's not installed as a script. You may get improper `sys.argv[0]`.
The support to run uninstalled scripts will be removed in a future release.
Run `poetry install` to resolve and get rid of this message.
File "", line 1
import sys; from importlib import import_module; sys.argv = ['format-scripts']; sys.exit(import_module('black').main scripts/**/*.py())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: invalid syntax. Perhaps you forgot a comma?
[tool.poetry.scripts]
format-scripts = "black:main"
< /code>
Это заставило его работать, но я все еще получаю предупреждение: < /p>
poetry run format-scripts scripts/**/*.py
Warning: 'format-scripts' is an entry point defined in pyproject.toml, but it's not installed as a script. You may get improper `sys.argv[0]`.
The support to run uninstalled scripts will be removed in a future release.
Run `poetry install` to resolve and get rid of this message.
All done!
4 files left unchanged.
< /code>
Однако, не считая пути в определение скрипта, побеждает исходную цель. < /p>
Итак, возможно ли добавить сценарий формата в поэзии Проект, который запускает Черный Форматтер по конкретному каталогу?
Подробнее здесь: https://stackoverflow.com/questions/793 ... matter-ove