Giter VIP home page Giter VIP logo

bobtemplates.plone's Introduction

image

image

Latest Version

Egg Status

Supported - Python Versions

License

bobtemplates.plone

bobtemplates.plone provides mr.bob templates to generate packages for Plone projects.

Note

With the plonecli, we have a nice command line client for bobtemplates.plone. We highly recommend to use the plonecli, because it adds auto completion and some nice helpers to bobtemplates.plone.

Features

Package created with bobtemplates.plone use the current best-practices when creating an add-on. It also support's GIT by default, to keep track of changes one is doing with the bobtemplates.

Provided templates

  • addon
  • buildout (useful setup a development buildout or to test new pending Plone versions)

Provided subtemplates

These templates are meant to be used inside a package which was created by the addon template.

  • behavior
  • content_type
  • controlpanel
  • form
  • indexer
  • mockup_pattern
  • portlet
  • restapi_service
  • subscriber
  • svelte_app
  • theme
  • theme_barceloneta
  • theme_basic
  • upgrade_step
  • view
  • viewlet
  • vocabulary

Compatibility

Add-on's created with bobtemplates.plone are tested to work in Plone >= 5.2 and Python >= 3.7. the only exceptions are the theming templates. Those are Plone 6 only, because the markup and Diazo rules have changed.

If you need to create Plone packages for older versions of Plone and Python, please use bobtemplates.plone 5.x. It should work on Linux, Mac and Windows.

Documentation

Full documentation for end users and template developers can be found on bobtemplatesplone.readthedocs.io.

plonecli

For easy usage see: plonecli

Installation

You can install bobtemplates.plone as every other normal Python package with pip user global or inside a virtualenv or better with pipx.

Installation with pip global for a user

pip install bobtemplates.plone --user

Installation with pipx

pipx installs bobtemplates.plone and all dependencies in a global isolated virtualenv.

pipx install bobtemplates.plone

Installation with pip in a virtualenv

You can also install bobtemplates.plone with pip in a virtualenv. If you don't have an active virtualenv, you can create one inside your project directory.

python3 -m venv venv

Then either activate the virtualenv:

source ./venv/bin/activate

or just use the binaries directly inside the bin folder as below:

./venv/bin/pip install bobtemplates.plone

Usage

As bobtemplates.plone is a template for mr.bob, we use mrbob to run the templates.

If you are using pipx or have bobtemplates.plone globally installed, you can just use mrbob directly.

mrbob bobtemplates.plone:addon -O src/collective.foo

If you are using an unactivated virtualenv, you can use mrbob like this:

./venv/bin/mrbob bobtemplates.plone:addon -O src/collective.foo

If you are using an activated virtualenv, you can use mrbob like this:

Activate your virtualenv:

source venv/bin/activate
mrbob bobtemplates.plone:addon -O src/collective.foo

This will create your Plone package inside the src directory.

See the documentation of mr.bob for further information.

Configuration

You can set all mr.bob configuration parameters in your ~/.mrbob file.

Here is an example:

[mr.bob]
verbose = False

[variables]
author.name = Maik Derstappen
author.email = [email protected]
author.github.user = MrTango
plone.version = 5.1.3-pending
#package.git.init = y
#package.git.autocommit = n
#package.git.disabled = n

[defaults]
dexterity_type_global_allow = n
dexterity_type_filter_content_types = y
dexterity_type_activate_default_behaviors = n
dexterity_type_supermodel = n

Contribute

Support

If you are having issues, please let us know. Just open an issue here.

bobtemplates.plone's People

Contributors

agitator avatar ale-rt avatar balavec avatar cedricmessiant avatar do3cc avatar erral avatar fulv avatar gforcada avatar hvelarde avatar jensens avatar kakshay21 avatar loechel avatar mamico avatar mauritsvanrees avatar me-kell avatar mrtango avatar pbauer avatar petschki avatar pigeonflight avatar santonelli avatar sneridagh avatar staeff avatar svx avatar tdesvenain avatar thet avatar thomasmassmann avatar tisto avatar vincentfretin avatar wesleybl avatar yurj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bobtemplates.plone's Issues

Use supermodel instead of interface for Dexterity schema

Currently in the Dexterit schema the interface is referenced for the schema (see https://github.com/plone/bobtemplates.plone/blob/master/bobtemplates/plone_addon/src/%2Bpackage.namespace%2B/%2Bpackage.name%2B/profiles/default/types/%2Bpackage.dexterity_type_name%2B.xml.bob#L27)
To enhance TTW exchangeability and remove a potential error cause (if you add a supermodel and don't remove the schema interface Plone will still use the schema interface) it would be good to ship the template with a supermodel-xml prepared.

Missing includeDependencies.

We are missing an includeDependencies in configure zcml:

<includeDependencies package="." />

Any test setup with a dependency that is not explicitly declared will fail.

Robot tests for generated addon aren't included in testsuite

cd src
../bin/mrbob -O my.addon bobtemplates:plone_addon
[answer questions]
cd ..
update buildout.cfg 
bin/buildout
$ bin/test -s my.addon --list-tests
Listing my.addon.testing.MyAddonLayer:IntegrationTesting tests:
test_browserlayer (my.addon.tests.test_setup.TestSetup)
test_product_installed (my.addon.tests.test_setup.TestSetup)
test_uninstall (my.addon.tests.test_setup.TestSetup)

As you can see the robot test in test_example.robot is missing, but I can't see why?

updates to buildout.cfg were the obvious 3 lines....

[sources]
+my.addon = fs my.addon
collective.behavior.banner = git https://github.com/collective/collective.behavior.banner.git

[buildout]
test-packages =

  • my.addon[test]

eggs =
collective.behavior.banner

  • my.addon

Drop testing question.

Having tests is considered best practice. People can just ignore them or nor run them if the choose to. Therefore I would remove this question in order to keep things simple.

Opinions?

package.theme = False does not work

If you specify "package.theme = False" in an ini file it will ask the question anyways. We should make sure that "False", "false", "0" all work (maybe even "no"/"No").

python question?

I see that we ask about which python version you want to use defaulting to 2.7.

Is there a need to keep 2.6 around? Specially as Plone 5.0 does only have jenkins jobs for 2.7 (so we are not checking any regression with 2.6) and that since 4.x we are already supporting officially 2.7?

Really stable linux distributions (read RedHat/CentOS) are the only ones still keeping us to really remove python 2.6 support? Although you can still install 2.7 on them easily...

Uninstall Profile would encourage good practise

Hi, I'm willing to do some work on this, but before I go to far, can I test opinion here?

I think it would be good to have uninstall profiles by default (at least when gs profiles are asked for).
This would help people create products that really cleanly uninstall.
And is especially useful as there are3 or 4 "hoops" to jump thru to get uninstall profiles working which folk won't bother with figuring out.
I also would plan to add a test that checks that installing & uninstalling a product leaves the same (number of):

  • Skin layers
  • Browser layers
  • CSS files in registry
  • JS files in registry

I guess this won't work in all cases, but it would be a good baseline to further enourage clean uninstalls, right?

Your thoughts?

Drop version question.

Do we really need to ask for a version? We are always creating the first version of a package. This means it is will always be 0.1 or 1.0a1. I would drop the question. Opinions?

the buildout for a generated basic dexterity add'on package pulls in plone.app.event 2.0.X

When I generate a dexterity add'on using bobtemplates.plone 1.0b1 the vanille buildout pulls in plone.app.event 2.X (for Plone 5) which breaks the buildout.

plone.app.event is pulled in by plone.app.contenttypes, and there I've lost which package in the current setup is pulling in p.a.contenttypes (if that's the cause).

Quick fix is adding pins for plone.app.event and other packages that plone.app.contenttypes needs that work for Plone 4, but p.a.event and it's dependers shouldn't be in here at all.

# for plone.app.contenttypes 1.1b5
plone.app.contenttypes = 1.1b5
plone.app.event = 1.1.5
icalendar = 3.9.0
plone.event = 1.1
plone.formwidget.datetime = 1.1
plone.formwidget.recurrence = 1.2.5

4.3.4 is not a valid trove classifier

With the default options bobtemplates.plone creates a setup.py with the following classifiers:

    # Get more from http://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        "Environment :: Web Environment",
        "Framework :: Plone",
        "Framework :: Plone :: 4.3.4",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2.7",
    ],

According to the cited list
4.3.4 is not valid but 4.3 is:

Framework :: Plone
Framework :: Plone :: 3.2
Framework :: Plone :: 3.3
Framework :: Plone :: 4.0
Framework :: Plone :: 4.1
Framework :: Plone :: 4.2
Framework :: Plone :: 4.3
Framework :: Plone :: 5.0

Does not deal well when creating Dexterity content types with two words

How to replicate this issue.

Create a new package using mr.bob, when asked select "Dexterity" then name the content type something like "Car Part".

After adding it to you buildout and relaunching Plone you'll get an error like this:

 SyntaxError: invalid syntax (interfaces.py, line 14)

You will see that interfaces.py contains a class with a space in it (ICar Part) in this case, which is not valid for Python.

Write proper unit tests, aim for 100% unit test coverage.

https://github.com/plone/bobtemplates.plone/blob/master/tests.py is a good start, but we are far away from testing every possible combination of questions.

We already have functional acceptance tests for the main package types (regular, nested, in the future: theme, dexterity), which are the most important tests in my opinion.

Nonetheless, I think we should aim for 100% test coverage (for just unit tests) as well. Acceptance test coverage should not count. First step would be to refactor tests.py to not rely on external question.ini files. It is also essential to keep things simple, otherwise we will not be able to reach 100% test coverage with reasonable effort.

Design Goals (Discussion)

Design Goals

  • Simple is better than complex.
  • Cover 80% of use cases, don’t become too complex.
  • Provide a good starting point for development, not a swiss army knife for the entire development cycle.
  • Code and tests should reflect the current coding best practice.
  • Generated code should have 100% test coverage.

Concrete Decisions

  • Do not use local commands. They significantly increase complexity and mr.bob has no support for them anyways. We tried this with ZopeSkel/Templer and it did not work out that well.
  • Limit the overall number of questions to not confuse people too much. Having separate packages or providing commented out code sections might be a good alternative.
  • Fix problems in Plone itself rather than providing workarounds in our templates. (see #27)
  • Provide skeletons for the most important Plone package use cases, not for every possible scenario:
    • Add-on product (collective, plone, custom project, policy product)
    • Content Types (Dexterity, Archetypes?)
    • Theme

This is just a draft and open for discussion. Feel free to comment or propose additions. I would especially like to hear the opinion of @cewing and @smcmahon. If we can reach an agreement we can add those design goals to the docs.

Buildout configuration is spread over different files.

While it is generally a good idea to have a buildout.d directory with multiple files for a deployment buildout, I don't think this makes any sense for a Plone add-on product. The buildout in an add-on product will always be quite simple and this has the potential to confuse people.

I plan to use bobtemplates.plone for a training and I would prefer if I wouldn't to have to explain the entire buildout.d structure.

I would propose to merge all buildout.d files into a single top-level buildout.cfg. We can always create a second template for a deployment buildout for instance, where a buildout.d directory would make sense. Opinions?

BTW: buildout.d/jenkins.cfg is really really outdated and should not be used at all.

Can we rationalize the plone.version question?

Currently it is:

plone.version.question = Plone version
plone.version.help = Which Plone version would you like to use?
plone.version.default = 4.3.4
plone.version.post_ask_question = bobtemplates.hooks:post_plone_version

This is fed into:
i) Pypi Trove classifers (even though 4.3.4 is invalid)
ii) plone.is_plone5 variable

What niggles me is that the implication that an addon IS plone 5 is incorrect, we should say supports plone 5 - and perhaps more importantly we should work the same out for plone 4.

I'd like to see the above question (& help) changed to something like "Target Plone version" & then follow up with:

 plone.support_version4.question = Support Plone 4?
 plone.support_version4.default = True
 plone.support_version4.pre_ask_question = bobtemplates.hooks:skip_support_qu_if_we_know

 plone.support_version5.question = Support Plone 5?
 plone.support_version5.default = True
 plone.support_version5.pre_ask_question = bobtemplates.hooks:skip_support_qu_if_we_know

(With a slightly shorter hook function name ;-) )

This would help make code tidier for Plone 5 if we knew the product wasn't planning to support Plone4

Any objections/thoughts?

Drop profile question.

A profile is usually what newbies want anyways, so let's get rid of that question to simplify things.

Drop locales question.

Locales should be considered best practice. Even if they are not used. I would drop this question and always include a locales folder.

Opinions?

Drop keywords question.

Does anybody really care about those keywords? We could just set it to "Plone Python" and people can always add their keywords later. I would like to get rid ot this question.

Opinions?

Package not installable via pip from github

I've tried to recreate the readme at the end of the text:
and since this package is not released on pypi I used the git url trick for pip:

pip install git+https://github.com/collective/bobtemplates.plone.git

After this, I could create the template.
Further analysis of the log showed this helpful log message:

...
Installing collected packages: bobtemplates.plone
  Running setup.py install for bobtemplates.plone

    warning: no previously-included files matching '*pyc' found anywhere in distribution
    Skipping installation of /home/do3cc/.dev/example/lib/python2.7/site-packages/bobtemplates/__init__.py (namespace package)
    Installing /home/do3cc/.dev/example/lib/python2.7/site-packages/bobtemplates.plone-0.7.dev0-py2.7-nspkg.pth
Successfully installed bobtemplates.plone

So because it declared a namespace, it did not add an __init__.py file.
Then the code fails because, it expects to be able to to
import bobtemplates
bobtemplates.__file__

__file__ is only available if there is an __init__.py file in the module.
Should this actually be a namespace package?

Licensing?

this package now creates software with default GPLv2 "or later". To bring it in line with Plone standard, shouldn't that be GPLv2?

I've created a pull request for that at #59

Drop licence question.

Even for internal packages I do not bother to change the licence question to something other than GPL. We should get rid of that question as well. People can always change that if they want.

Opinions?

package not used by buildout when creating a existing plone-package

Steps to reproduce:

$ ./bin/mrbob -O plone.app.contenttypes bobtemplates:plone_addon
$ cd plone.app.contenttypes
$ virtualenv-2.7 .
$ ./bin/python bootstrap-buildout.py
$ ./bin/buildout

bin/instanceand bin/test now contain the '/Users/philip/.cache/buildout/eggs/plone.app.contenttypes-1.2b3-py2.7.egg', instead of the new egg.

Why is this a issue? I want to test the 4.3-compatible version of plone.app.contenttypes because I'm backporting some features (https://github.com/plone/plone.app.contenttypes/tree/backport). For this I modified to buildout to follow the best-practices of bobtemplates.plone.

But now (and I guess for quite some time travis and local tests always test the released version and the package itself is ignored. I had the same problem with plone.app.linkintegrity.
The only way to get these instances to work is to use the coredev.

I remember that used to work at some point and cannot seem to figure out what is wrong. 😒

Add code-analysis to travis and fail the build on violations.

I usually run code-analysis with plone.recipe.codeanalysis on travis as a first step. This way the build fails as early as possible on pep8 violations etc.. This might sound strict but 100% compliance with code-analysis is the only way to make it work in my experience. People can always remove that if they don't agree but I would consider that our best practice. Opinions?

Here is an example implementation:

https://github.com/plone/plone.restapi/blob/master/.travis.yml
https://github.com/plone/plone.restapi/blob/master/travis.cfg#L19

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.