pbauer

Four options to try Plone 5.2 on Python 3

Try these different options to get started with Plone on Python 3.

Demo pages

There are nightly build of the current Plone 5.2 coredev (the development version) with Python 2 and 3:

Minimal Buildout

Here is a minimal buildout to run Plone 5.2rc1 on Python 3:

[buildout]
parts = instance
extends = https://dist.plone.org/release/5.2rc1-pending/versions.cfg

[instance]
recipe = plone.recipe.zope2instance
eggs =
Plone
Pillow

You set it up like this:

$ python3.7 -m venv .
$ ./bin/pip install -r https://dist.plone.org/release/5.2rc1-pending/requirements.txt
$ ./bin/buildout

And start it as usual with ./bin/instance fg

Standalone Development buildout

[buildout]
extends = https://dist.plone.org/release/5.2rc1-pending/versions.cfg

parts =
    instance
    zopepy
    packages
    test
    robot

eggs =
    Plone
    Pillow
    collective.easyform

test-eggs =
    collective.easyform [test]

auto-checkout =
    collective.easyform

extensions =
    mr.developer

show-picked-versions = true

[instance]
recipe = plone.recipe.zope2instance
user = admin:admin
eggs = ${buildout:eggs}
debug-mode = on
verbose-security = on

[zopepy]
recipe = zc.recipe.egg
eggs =
    ${buildout:eggs}
interpreter = zopepy
scripts =
    zopepy
    plone-compile-resources

[packages]
recipe = collective.recipe.omelette
ignore-develop = False
eggs = ${buildout:eggs}
ignores = roman

[test]
recipe = collective.xmltestreport
eggs = ${buildout:test-eggs}
defaults = ['--auto-color', '--auto-progress']

[robot]
recipe = zc.recipe.egg
eggs =
    ${buildout:test-eggs}
    Pillow
    plone.app.robotframework[reload,debug]

[sources]
collective.easyform = git git@github.com:collective/collective.easyform.git branch=python3

[versions]

Starzel buildout

The buildout that we at Starzel.de use supports Plone 5.2rc1 with Python 2 and 3.

https://github.com/starzel/buildout

It has some nice features:

  • It extends to config- and version-files on github shared by all projects that use the same version of Plone.
  • It allows to update a project simply by changing the version it extends.
  • It allows to update all projects of one version by changing remote files (very useful for HotFixes).
  • It is minimal work to setup a new project.
  • It has presets for development, testing, staging and production.
  • It has all the nice development-helpers we use.

Quickstart:

$ git clone -b 5.2rc1.x https://github.com/starzel/buildout <SOME_PROJECT> $ cd <MY_PROJECT>

Remove all files that are not needed for a project but are only used for the buildout itself.

$ rm -rf linkto README.rst README.txt .travis.yml secret.cfg_tmpl VERSION.txt local_coredev.cfg CHANGES.rst

If you're not developing the buildout itself you want a create a new git repo.

$ rm -rf .git && git init

Add a file that contains a passwort. Do not use admin as a password in production!

$ echo -e "[buildout]\nlogin = admin\npassword = admin" > secret.cfg

Symlink to the file that best fits you local environment. At first that is usually development. Later you can use production or test. This buildout only uses local.cfg and ignores all local_*.cfg.

$ ln -s local_develop.cfg local.cfg

Create a virtualenv in Python 2.7 or Python 3.7 (Plone 5.2 only).

$ virtualenv . # for Python 2.7 $ python3.7 -m venv . # for Python 3 (Plone 5.2 only)

Install and configure Plone

$ ./bin/pip install -r requirements.txt $ ./bin/buildout

Wrapup

I hope these options help you get started with Python 3. For serious projects you will likely create you own buildout.

Update (4.2.2019)

You should use the Plone coredev for developing Plone itself:

$ git clone git@github.com:plone/buildout.coredev.git coredev
$ cd coredev
$ git checkout 5.2
$ python3.7 -m venv .
$ ./bin/pip install -r requirements.txt
$ ./bin/buildout
$ ./bin/instance fg

Update 2 (24.2.2019)

Since Plone 5.2b2 wsgi is the default, even when running Python 2. See https://github.com/plone/Products.CMFPlone/issues/2763

This means you do not need to enable wsgi = on since it will be enabled automatically. You can still choose to switch wsgi = off in Python 2 if you have a good reason to do so (e.g. you need FTP or WebDAV). I updated the examples accordingly.

Update 3 (8.3.2019)

Release candidate 1 of Plone 5.2 is pending. See https://community.plone.org/t/plone-5-2rc1-soft-released/8163. I updated the examples accordingly.