Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to import filters #86

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

mattrobenolt
Copy link
Owner

Fixes #85

@braindevices
Copy link

I like this one a lot. Why is is not merged?

@mattrobenolt
Copy link
Owner Author

I think it was just waiting on some outside confirmation. Wanna try it out? :)

@jjsp556
Copy link

jjsp556 commented Sep 8, 2020

I think it was just waiting on some outside confirmation. Wanna try it out? :)

I've been testing out this update, and it works as expected. I successfully tested both single and multiple filters (e.g. jinja2 -f myfilter.myfunction -f ansible.plugins.filter.core.combine test.txt).

@rpersee rpersee mentioned this pull request Jun 21, 2022
@velle
Copy link

velle commented Sep 8, 2022

I hope you will merge this, since I really need this feature :)
I looked through the code, and its very simple and elegant, and its hard for me to see how anything could go wrong.
Sincerely.

@tierpod
Copy link

tierpod commented Nov 23, 2022

Is there any chance to see this PR merged into main branch? It can drastically extend jina2-cli capabilities.

I tested this patch and it works fine. For example, we have hostname and want to add ip address in rendered config file, so it can be one simple filter (filters/ip.py):

import socket

def get_ip(hostname):
    return socket.gethostbyname(hostname)

and in template it can be

{{ hostname }}: {{ hostname | get_ip }}
jinja2 -f filters.ip.get_ip test.j2 test.yaml

@sfc-gh-turbaszek
Copy link

@mattrobenolt any chances to merge this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: ipaddr filter
6 participants