question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom build scipt

See original GitHub issue
  • I have searched the issues of this repo and believe that this is not a duplicate.

General introduction

During the investigation whether poetry is the right tool for our company, I have bumped into undocumented build option. It seems that I can do something like this:

[tool.poetry]
build = "my_custom_build.py"

When I do, poetry adds following two lines to generated setup.py in sdist:

from my_custom_build import *
build(setup_kwargs)

When creating wheel, poetry executes the build function in my_custom_build.py.

Issue

I really like this behaviour, because it allows me to execute custom build steps like compilation of translations, generating python modules from grpc protobuf files and so on.

However, the build option is undocumented. I propose that we document this behaviour, because it can be really useful.

Also, parsing of this option baffles me, because it’s splitted by the dots and only the first part is used as the module name. Which means that I can only use python modules in the root directory. This is confusing and it could be improved (accepting a dotted path to python module seems like a logical choice).

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
stinovlascommented, Oct 9, 2019

@sdispater: Thank you for elaborating! I’m looking forward to the new solution. I’d just like it to support generating python modules during the build and including those generated modules to the (wheel) distribution. This is something I currently do with custom setup.py build step and this functionality is really important for me. If needed, I can lend a hand in implementation.

0reactions
maelpcommented, Oct 30, 2022

Is there a way to run a pre-build script?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Writing custom build scripts | Apple Developer Documentation
Custom build scripts can perform critical tasks like installing dependencies or uploading build artifacts to storage. Write resilient code that handles errors ...
Read more >
Custom Build Scripts - MyGet Documentation
Compile the solution using msbuild · Run unit tests using a custom test runner provided through the project's source control repository · Create...
Read more >
Build Scripts - Visual Studio App Center - Microsoft Learn
You can add custom build scripts that run at pre-defined stages during build time: post-clone, pre-build, post-build. Place the scripts with ...
Read more >
Custom Build Script - Skaffold
Custom build scripts allow Skaffold users the flexibility to build artifacts with any builder they desire. Users can write a custom build ...
Read more >
Build Scripts - The Cargo Book
All the lines printed to stdout by a build script are written to a file like target/debug/build/<pkg>/output (the precise location may depend on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found