rubenf
rubenf4w ago

how does one pin the python dependencies

@Ask Inkeep how does one pin the python dependencies
3 Replies
Ask Inkeep
Ask Inkeep4w ago
Thanks for tagging me @rubenf. I'll look through relevant sources and get back to you shortly. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Dependencies in Python * Jobs * Python Quickstart * python dependencies version -----------------------------
Ask Inkeep
Ask Inkeep4w ago
Answer To pin Python dependencies in Windmill, you can use the #requirements: or #extra_requirements: comments at the top of your script. Here's how you can do it: 1. Using #requirements:: If you want to override the inferred imports or pin specific versions, you can use the #requirements: comment. Here's an example:
#requirements:
#dependency
#version_pinned_dependency==0.4
import dependency
def main(...):
...
#requirements:
#dependency
#version_pinned_dependency==0.4
import dependency
def main(...):
...
(1) 2. Using #extra_requirements:: If you want to combine Windmill's automatic inference with pinned dependencies, use the #extra_requirements: comment:
#extra_requirements:
#dependency==0.4
import pandas
import dependency
def main(...):
...
#extra_requirements:
#dependency==0.4
import pandas
import dependency
def main(...):
...
These methods allow you to specify exact versions of dependencies or add extra dependencies that might not be automatically inferred by Windmill. It's worth noting that Windmill automatically manages dependencies for you in standard mode. When you import libraries in your Python script, Windmill parses these imports upon saving the script and automatically generates a list of dependencies. (2) If you need to use a specific version of a library that's different from what Windmill infers, or if you're encountering conflicts between dependencies, these pinning methods can be particularly useful. (3)
Ask Inkeep
Ask Inkeep4w ago
Feel free to tag @Ask Inkeep with additional questions.