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 a loader for loading resources #140

Closed
chaseastewart opened this issue Jan 22, 2024 · 4 comments
Closed

Add a loader for loading resources #140

chaseastewart opened this issue Jan 22, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@chaseastewart
Copy link

Maybe something like this

@jg-rp jg-rp added the enhancement New feature or request label Jan 22, 2024
@jg-rp
Copy link
Owner

jg-rp commented Jan 22, 2024

I like this one too. And I'm OK with adding the importlib.resources backport as a dependency.

@jg-rp jg-rp self-assigned this Jan 29, 2024
@jg-rp
Copy link
Owner

jg-rp commented Jan 31, 2024

I've gone ahead and merged PR #147, which implements PackageLoader (docs), named to be consistent with Jinja.

As well as a package name, PackageLoader accepts a package_path argument, being one or more paths to load templates from, relative to the package root. package_path defaults to "templates", so would need to be explicitly set to the empty string if loading templates from the package root.

@chaseastewart
Copy link
Author

Looks good to me.

@jg-rp
Copy link
Owner

jg-rp commented Feb 1, 2024

PackageLoader is available in Python Liquid version 1.11.0, now released.

docs, source

@jg-rp jg-rp closed this as completed Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants