最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

pyproject.toml - poetry script containing a slash - Stack Overflow

programmeradmin1浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

What 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

  1. make a directory called something
  2. rename your command to something_blah in the poetry file
  3. 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

发布评论

评论列表(0)

  1. 暂无评论