I would like to add a script to my Poetry project that runs the Black formatter over a specific directory. I wrote this:
[tool.poetry.scripts]
format-scripts = "black:main scripts/**/*.py"
But it doesn't work. I am getting this error when running 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 "<string>", 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 fot a comma?
I tried removing the scripts/**/*.py
path from the script, like so:
[tool.poetry.scripts]
format-scripts = "black:main"
This made it work, but I'm still getting the warning:
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! ✨
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745298301a4621278.html
评论列表(0条)