Replies: 3 comments 1 reply
-
Hi @ssuchter, It looks like you need to use the Poe the Poet poetry plugin, but you're missing a couple of steps. Firstly you need to add the Poe the Poet plugin to poetry: poetry self add 'poethepoet[poetry_plugin]' Then you need to define the task you want to have run as part of the build process: [tool.poe.tasks]
_pre_build = "mkdir helloworld" Then you can reference that task from the pre_build hook: [tool.poe.poetry_hooks]
pre_build = "_pre_build" Note: the underscore prefix on the task name is optional, but suggested to make that task "private" in the sense that it doesn't appear in the generated documentation (when you run |
Beta Was this translation helpful? Give feedback.
-
This is very helpful, thank you!
The 'poetry self add' step - is it possible to declare that poetry should
have poethepoet as a plugin in the pyproject.toml file, obviating this
step? Or must this be performed imperatively before the 'poetry build' or
'python -m build' steps?
…On Wed, Apr 12, 2023 at 12:58 AM Nat Noordanus ***@***.***> wrote:
Hi @ssuchter <https://github.com/ssuchter>,
It looks like you need to use the Poe the Poet poetry plugin
<https://poethepoet.natn.io/poetry_plugin.html>, but you're missing a
couple of steps.
Firstly you need to add the Poe the Poet plugin to poetry:
poetry self add 'poethepoet[poetry_plugin]'
Then you need to define the task you want to have run as part of the build
process:
[tool.poe.tasks]_pre_build = "mkdir helloworld"
Then you can reference that task from the pre_build hook:
[tool.poe.poetry_hooks]pre_build = "_pre_build"
Note: the underscore prefix is optional, but suggested on the task name to
make that task "private" in the sense that it doesn't appear in the
generated documentation (when you run poe without any tasks) and can't be
run directly.
—
Reply to this email directly, view it on GitHub
<#140 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAOYJW2V6ZHDPMICJTPWFULXAZODVANCNFSM6AAAAAAW3AKXGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thanks very much to nat-n, his answers were all correct. However, I also found that one can do the exact thing I was trying to do with pure poetry, by putting this in pyproject.toml: [tool.poetry.build] |
Beta Was this translation helpful? Give feedback.
-
I'm working on a project that has this in pyproject.toml:
I'm wanting to run some arbitrary code during that build process (I want to autogenerate some .py files that go into the package)
Can I use poethepoet to do this? I tried using this:
but it didn't seem to do anything. Is this a supported use case?
Beta Was this translation helpful? Give feedback.
All reactions