Ask Inkeep
Ask Inkeep
WWindmill
Created by Mearthy on 12/31/2024 in #help
problem importing azure.storage.filedatalake
Please tag me in threads that I was a part of from the start.
4 replies
WWindmill
Created by Ahysen on 8/20/2024 in #help
AG Grid API
Please tag me in threads that I was a part of from the start.
4 replies
WWindmill
Created by rubenf on 8/18/2024 in #general
how does one pin the python dependencies
Feel free to tag @Ask Inkeep with additional questions.
4 replies
WWindmill
Created by rubenf on 8/18/2024 in #general
how does one pin the python dependencies
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)
4 replies
WWindmill
Created by rubenf on 8/18/2024 in #general
how does one pin the python dependencies
----------------------------- While I generate an answer, here are some sources that might be helpful: * Dependencies in Python * Jobs * Python Quickstart * python dependencies version -----------------------------
4 replies
WWindmill
Created by rubenf on 8/18/2024 in #general
how does one pin the python dependencies
Thanks for tagging me @rubenf. I'll look through relevant sources and get back to you shortly.
4 replies
WWindmill
Created by rubenf on 7/24/2024 in #general
how do I share logic between scripts
Feel free to tag @Ask Inkeep with additional questions.
5 replies
WWindmill
Created by rubenf on 7/24/2024 in #general
how do I share logic between scripts
You can use both relative and absolute imports, but relative imports are preferred for compatibility with local editors. Important Considerations 1. In both the web editor and CLI, scripts don't necessarily need a main function. If they don't have one, they're assumed to be shared logic and not runnable scripts. (1) 2. When using relative imports, make sure you have view rights on the scripts you're importing at the time of execution. (2) 3. The folder layout for sharing logic is identical to the one used with the CLI for syncing scripts locally and on Windmill. 4. For TypeScript, path depths can vary, and relative imports will work at any level, ensuring consistency between local and Windmill environments. (3) By using these methods, you can effectively share common logic between your scripts in Windmill, improving code reusability and maintainability. (1) (2) (3)
5 replies
WWindmill
Created by rubenf on 7/24/2024 in #general
how do I share logic between scripts
Answer Windmill allows you to share common logic between your scripts using relative imports in both Python and TypeScript. (1) This feature works well with local development and can be easily synced using the CLI. Python Relative Imports For Python scripts, you can import directly from other scripts by following the path layout. (2) Here's an example:
# u/user/common_logic
def foo():
print('Common logic!')

# u/user/custom_script
from u.user.common_logic import foo

def main():
return foo()
# u/user/common_logic
def foo():
print('Common logic!')

# u/user/custom_script
from u.user.common_logic import foo

def main():
return foo()
You can use relative imports for scripts in the same folder or user-space, or access scripts in different folders. TypeScript Relative Imports For TypeScript scripts using Deno or Bun, you can similarly import from other scripts. (3) Here's an example:
import { main as foo, util } from '../my_script_path.ts';
import { main as foo, util } from '../my_script_path.ts';
5 replies
WWindmill
Created by rubenf on 7/24/2024 in #general
how do I share logic between scripts
----------------------------- While I generate an answer, here are some sources that might be helpful: * Sharing Common Logic * Dependency Management & Imports * Dependencies in Python * Dependencies in TypeScript -----------------------------
5 replies
WWindmill
Created by rubenf on 7/24/2024 in #general
how do I share logic between scripts
Thanks for tagging me @rubenf. I'll look through relevant sources and get back to you shortly.
5 replies
WWindmill
Created by rubenf on 7/5/2024 in #general
how do I get and set custom flow states
Feel free to tag @Ask Inkeep with additional questions.
6 replies