In my project I have to run the docker build and run commands very frequently to build and run the container respectively. I'm using Poetry as the package manager. I'm looking for a counterpart of npm run <custom-command> to execute my command in project in Python using Poetry. Please help.
You could use the scripts section of the pyproject.toml file to define the custom command: https://python-poetry.org/docs/pyproject/#scripts
It would look something like:
[tool.poetry.scripts]
mycommand = 'mypackage.mymodule:mycommand'
...where 'mypackage.mymodule:mycommand' is the reference to the location of the function in the project python code where the command is implemented.
The command itself would be then be run using poetry run <mycommand>
The solution was found when the project was initialized through poetry init, followed by writing code and installing dependencies. As a result, poetry install still throws an error about system arguments.
The solution for my case was:
poetry new <your_project_name>cd[tool.poetry.scripts]If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With