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

Allow overriding templates #146

Open
emmatyping opened this issue Mar 27, 2024 · 3 comments
Open

Allow overriding templates #146

emmatyping opened this issue Mar 27, 2024 · 3 comments

Comments

@emmatyping
Copy link

Hiya! I'm hoping to deploy dumb-pypi at $WORK and I wanted to ask if you would take a PR to allow for overriding templates.

I'm imagining an additional argument to point to another directory, and try to load the templates from there, falling back on the default files. This would obviously be entirely up to the user to make work, but it is slightly cleaner for me than just forking and keeping the fork up to date.

@chriskuehl
Copy link
Owner

What is it you're trying to override in the templates? Is there a way we could add support for new configuration options to make whatever you need possible?

My concern is that if you just replace the templates outright, it makes updates very frail. It would be easy for someone to pull in a new version of dumb-pypi but forget to update the templates. It doesn't seem great for us to promote that kind of pattern.

Another thing to keep in mind is that the generated HTML files are kind of already legacy and will probably be replaced with new PEP691 JSON files at some point, and it won't be possible to customize those with Jinja templates. So if there's something you want to change, it might be better to change it at a different layer.

@emmatyping
Copy link
Author

Oh, sorry for not responding quicker, this got buried in other issue notifications!

I agree custom templates might be too brittle. I think the main ask is custom CSS so that I have greater control of how the generated index looks (branding, handling of the logo, etc).

Another thing to keep in mind is that the generated HTML files are kind of already legacy and will probably be replaced with new PEP691 JSON files at some point

Do you mean that you want to have dumb-pypi not generates these anymore at some point in the future? Or that you think the PEP 503/html based API may be deprecated/unsupported? One thing that I like about dumb-pypi is that the generated HTML gives me a simple index (in the html sense) page, which is a nice UI for people who want to look at the package index.

@emmatyping
Copy link
Author

Also one other related feature request, if you are planning on generating a root index.html going forward, could I add a flag disabling generating the (latest <version>) text in index.html? The goal is to allow concurrent uploads/repo updates across multiple projects while only updating the index page if a new project is added. I'm planning on not uploading packages.json, and instead storing it in a DB, so that wouldn't be an issue.

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

No branches or pull requests

2 participants