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

Make it pluggable #3620

Open
barseghyanartur opened this issue Mar 2, 2022 · 4 comments
Open

Make it pluggable #3620

barseghyanartur opened this issue Mar 2, 2022 · 4 comments

Comments

@barseghyanartur
Copy link
Contributor

Description

This project is awesome. I like it as is, but there's a tiny feature I want to add...

I think amount of forks speaks for itself.

Rationale

  • Nobody likes maintaining a fork (hell).
  • Everybody likes to customize things.

The proposal

  • Turn features into plugins. If plugin is enabled, you will be asked about it in the project setup wizard.
  • Have a default set of plugins enabled.
  • Make it possible to override the settings (either in some global YAML or INI config).
@luzfcb
Copy link
Collaborator

luzfcb commented Mar 2, 2022

@barseghyanartur It's an interesting idea, but the real question is how to implement, test all possible combinations to make sure that's everything works as expected and maintain it for an undefined time.

This project is maintained by volunteers, who make use of their precious free time to try to help other people for free to have a good base to start a project.

The cookiecutter itself does not have a concept of pluggable templates and because of that, although I think it's an interesting idea but unfeasible due to lack of tools.

@Andrew-Chen-Wang
Copy link
Contributor

I've been thinking of something similar. But instead of having to test all these combinations it would probably just be better to have pluggable plug-ins such that these plug-ins do not interfere with any combinations and are independent

@browniebroke
Copy link
Member

That's an old feature request, yes (see #784) but as @luzfcb said, it's more of a limitation of the cookiecutter tool itself. Unless you have a practical suggestion to overcome this?

do not interfere with any combinations and are independent

Even if we are limited by the tool, it would be nice to make each option a bit more independant, I agree. It would help with maintainability in the long run, and if cookiecutter one day supports plugin, it would make things easier to migrate (although that's a long shot).

One typical example is our options related to the front-end asset pipeline: we currently have 3 seemingly independant options which may actually lead to a broken setup in some cases (see #3535 for a suggestion to improve it - feedback welcome).

@Andrew-Chen-Wang
Copy link
Contributor

We could use the post hook? So one of our options is "plugins" and we list all plugins we're aware of. The user doesn't need to choose any and provide one that isn't listed. The user will provide the plugins by name (only if it's an option in the cookiecutter.json file) or by link in CSV fashion.

The way plugins should work is similar to Middleware. As they are independent, they will have their own cookiecutter project configuration that we run in the post hook installation. The plug-in generates its code. Where does the code go? If it's a new file, it just adds the file to the already generated cookiecutter django project. If the plug-in code needs to be in an existing file, since it's an independent plug-in, it appends to the end of an existing file.

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

No branches or pull requests

4 participants