I have a poetry script setup as follows:
[tool.poetry.scripts]
something = 'x.q.p:entrypoint'
What I'd like to do is be able to call the entrypoint by running something/blah
I tried
[tool.poetry.scripts]
"something/blah" = 'x.q.p:entrypoint'
but I get
Warning: The current project could not be installed: [Errno 2] No such file or directory: '/home/me/repos/something-blah/.venv/bin/something/blah'
The poetry docs are a bit light on this so I'm wondering what people would suggest to fix it?
I have a poetry script setup as follows:
[tool.poetry.scripts]
something = 'x.q.p:entrypoint'
What I'd like to do is be able to call the entrypoint by running something/blah
I tried
[tool.poetry.scripts]
"something/blah" = 'x.q.p:entrypoint'
but I get
Warning: The current project could not be installed: [Errno 2] No such file or directory: '/home/me/repos/something-blah/.venv/bin/something/blah'
The poetry docs are a bit light on this so I'm wondering what people would suggest to fix it?
Share Improve this question asked Nov 20, 2024 at 18:22 Andre GagneAndre Gagne 315 bronze badges1 Answer
Reset to default 0What I'd like to do is be able to call the entrypoint by running something/blah
If the command contains a slash, the shell will assume it is a file in the current directory (as opposed to a command somewhere in $PATH
), so you cannot have a command name with a slash in it.
in general, Command names are file names, and file names cannot contain slashes.
What you could do if you really want to run your command as something/blah
is
- make a directory called
something
- rename your command to
something_blah
in the poetry file - Create a file called
something/blah
that links to your command (for example containing the following)
#!/bin/bash
something_blah "$@"
But honestly, if your goal is to have a slash in your command name, I recommend against it.. Command names should not contain slashes, it's more of a hassle than it is worth