-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
How to deploy extensions for Cement with own apps #743
Comments
@TomFreudenberg I think that approach would work fine. You are building a parallel project that other projects will build upon, so it is basically another layer on top of Cement. Having a separate package/distribution for every extension multiplies the management overhead so it is better for you if you can continue to maintain them all as one project. You can always break them out into separate projects/packages later. As for The idea there is, you can My only suggestion is, test it from the perspective of a developer who wants to use something like Example Dependencies:
That should upll in the dependencies for |
@derks thanks for your response. It is exactly as you have written above. I am checking out And yes, I am looking from a developers perspective who is not developing tokeo but his own app. That is how I use the parts already. I have build now 4 apps running on the stack Cement + Tokeo extensions. It's fun to work on this and I guess the extensions are helping others to get fast progress on their work. The most important will be a good documentation to get things out. Question on that: What do you use for the documentation site of Cement? I like your doc site very much. |
https://docs.builtoncement.com/getting-started/developer-tools#customizing-templates how to customize templates |
Hi @derks I am doing the template for tokeo to generate a custom project. .generate.yml - name: feature_dramatiq
prompt: "Enable dramatiq [(Y)es/(N)o]"
validate: "^[YN]$"
case: "upper"
default: "Y" I use that in {% if feature_dramatiq == "Y" %}
'tokeo.ext.dramatiq',
{% endif -%} So far so good. But I want to generate additional files in case of feature enabled or not. Do you have a tipp for me how to solve that, e.g.
should only get created when Thanks |
@TomFreudenberg that is a good question. I have not run into that use-case on my own yet, but it definitely makes sense what you're looking for here. For what it is worth, that logic happens here in the base template handler: I don't think there is a clean way to do it currently, however I have a question... aren't the files part of the extension? I assume that
Basically, whatever you have in In that way, the file is part of the extension, and not "core" which is what I assume you want. There wouldn't be any reason to not create the file as part of generate. |
Hi @derks I am not sure if I got your advise correctly but I try to explain how I run it currently: Understand So the current enabled extensions for running # load additional framework extensions
extensions = [
'colorlog',
'generate',
'tokeo.ext.print',
'tokeo.ext.jinja2',
'tokeo.ext.yaml',
] ext.jinja2: because of 'keep_trailing_newline': True,
'trim_blocks': True, you have not currently exposed in Cement jinja2 ext.yaml: because of deep merging and overlaying values and configs ext.print: because of The rest is you delivering the new extensions as a package. If you install you can run: cement generate
# or
tokeo generate That's it. Starting your own project you can use by now: # load additional framework extensions
extensions = [
'colorlog',
'generate',
'tokeo.ext.print',
'tokeo.ext.jinja2',
'tokeo.ext.yaml',
'tokeo.ext.appshare',
] a mix of extensions for the framework Cement coming from cement or tokeo. That's it I have created a The extension code still stays in the installed tokeo package like cement package and is NOT part of the new custom project. They just get enabled by the avtivate So I do not understand what might change and help if I use What I am looking for is: If a 3rd party dev says: "Dramatiq = No" on generate project prompt, then I do not activate the extensions, I do not add the package to Does this all makes sense to you? In the last time, there is another issue with templates just why they are (jinja2) templates. I can't run You opened the box of pandorra while letting Cement into the wild :-) I am just a user of this :-D |
@TomFreudenberg I get it now. What if we supported "features" like this? Example:
Features could auto prompt: "Enable Feature: <feature_name> [Yn]" Basically, features could just wrap around the same functionality but guarded by a boolean that triggers additional actions. Thoughts? |
Hi @derks that sounds fine to me. Same functionality just by additional level for features. |
Hi @derks
I come up here to make our discussion streamlined from here #741 (comment). You wrote:
I did a little research how to deploy Tokeo Toolset best for others. First I built a wheel package and run that in my projects instead a duplicate from tokeo. That's fine by now and helps me to do the things easy.
So for now I removed all the packages I wrote from my main.py (do not activate by default) and just deploy the ext code inside the tokeo package. So some can install
tokeo
andcement
and use for e.g.tokeo.ext.appshare
inside their main.py as extension to export theapp
object application wide. That's fine.Activating other extensions like
tokeo.ext.nicegui
will need to activate the extension by developer but also there should be some starter as already developed in tokeo like here (https://github.com/tokeo/tokeo/tree/master/tokeo/core/pages). To give the developer access to my "Hints" or "Starters", I think about creating atokeo setup
(just working name) command, where templates can run then to create such things in the developers app. Having only all the extension code inside the package does at least not enforce the developer to install all other components while they are not in use.So, I am not sure if there is really more necessary else in Cement than already exist? I think, that I could deploy all my work as seperate package in parallel to cement. What do you thing about that.
Cheers
Tom
The text was updated successfully, but these errors were encountered: