Zope のインストール

このドキュメントでは zc.buildout (推奨) または pip を使った Zope のインストール方法について説明します。

前提

Zope をインストールするには、次の前提を満たしておく必要があります。

  • Zope がサポートする Python のバージョン。Python がシステムレベルのパッケージからインストールされていれば、開発サポートも含みます。Zope がサポートするバージョンは 3.7 から 3.11 までです。

  • Zope は Python の zlib モジュールをインポートします。Python をソースからビルドするなら、システムの zlib に対応するヘッダが既にインストールされていることを確認してください。

  • Python の拡張モジュールをビルドできる C コンパイラ(gcc 推奨)。

  • Linux に同梱されていた Python のインタプリタを使っているなら、 開発者用パッケージをインストールしてください。例えば、Ubuntu 18.03 の Python 3 であれば、次のように入力してください。

    $ sudo apt-get install python3-dev
    

Choice of installation methods

Zope can be installed using either straight pip or the zc.buildout buildout and deployment tool.

You can use pip and the built-in script mkwsgiinstance for testing or very simple setups that don't require much customization or scripting. It will create a basic set of configurations and a simple start/stop script.

If you need customization and if you don't want to maintain configurations and scripts by hand you should use zc.buildout in conjunction with the buildout add-on plone.recipe.zope2instance instead. This is a powerful combination for creating repeatable builds for a given configuration and environment. The Zope developers use zc.buildout to develop Zope itself as well as the dependency packages it uses. This is the recommended way of installing Zope.

zc.buildout を使った Zope のインストール

zc.buildout を使った Zope ソフトウェアのインストールは次の手順を伴います。

  • 仮想環境を作ります。

  • 仮想環境のなかに zc.buildout をインストールします。

  • Create a buildout configuration file buildout.cfg

  • buildout を実行します。

次の例は Linux で Zope バージョン 5.0 を使うものです。お望みのバージョンで読み替えてください。

$ python3.10 -m venv zope
$ cd zope
<create buildout.cfg in this folder, see examples below>
$ bin/pip install -U pip wheel zc.buildout
$ bin/buildout

Using the simplest possible configuration

Here's a minimum buildout.cfg configuration example that will create the built-in bin/mkwsgiinstance script to create a Zope instance:

[buildout]
extends =
    https://zopefoundation.github.io/Zope/releases/5.0/versions-prod.cfg
parts =
    zopescripts

[zopescripts]
recipe = zc.recipe.egg
interpreter = zopepy
eggs =
    Zope
    Paste

plone.recipe.zope2instance を使う

もっと楽をするために、plone.recipe.zope2instance を使うこともできます。これは次のドキュメント Zope の設定と実行 で語られる設定についてのタスクの多くを自動化します。plone.recipe.zope2instance は無数のオプションを持つので、PyPI のページを見てください。

[buildout]
extends =
    https://zopefoundation.github.io/Zope/releases/5.0/versions-prod.cfg
parts =
    zopeinstance

[zopeinstance]
recipe = plone.recipe.zope2instance
eggs =
user = admin:adminpassword
http-address = 8080
zodb-temporary-storage = off

この種のインストールがもたらす特徴のひとつは、同梱の waitress 以外の WSGI サーバーと簡単に統合できることです。Zope のインスタンスを起動するときに、使いたい WSGI サーバーのコンフィグファイルのパスを指定できます。これは、gunicorn のように PasteDeply と互換性のあるエントリーポイントを提供する WSGI サーバーで動作します。自分自身で .ini ファイルを作る必要があります。そして、WSGI サーバーの egg を、eggs の指定に含めるのを忘れないでください。

[zopeinstance]
recipe = plone.recipe.zope2instance
eggs =
    gunicorn
user = admin:adminpassword
http-address = 8080
zodb-temporary-storage = off
wsgi = /path/to/zope.ini

pip を使った Zope のインストール

pip を使った Zope ソフトウェアのインストールは次の手順を伴います。

  • 仮想環境を作ります(アクティベートする必要はありません)。

  • Zope とそれが依存するものをインストールします。

例は Linux での手順です。バージョン "5.0" を最新のバージョンに置き換えてください。最新のバージョンは https://zopefoundation.github.io/Zope/ で見つけることができます。

$ python3.10 -m venv zope
$ cd zope
$ bin/pip install -U pip wheel
$ bin/pip install Zope[wsgi] \
  -c https://zopefoundation.github.io/Zope/releases/5.0/constraints.txt

requirements ファイルを使って Zope をインストールすることもできます。このインストール方法では実際には必要のないパッケージがインストールされることがあることに注意してください。(言い換えれば、setup.pyinstall_requires セクションにリストされているものよりも多くのものがインストールされることがあります。)

$ bin/pip install \
-r https://zopefoundation.github.io/Zope/releases/5.0/requirements-full.txt

Building the documentation

You can build the documentation locally. Example steps on Linux. Replace the version number "5.0" with the latest version you find on https://zopefoundation.github.io/Zope/:

$ wget https://pypi.org/packages/source/Z/Zope/Zope-5.0.tar.gz
$ tar xfz Zope-5.0.tar.gz
$ cd Zope-5.0
$ python3.10 -m venv .
$ bin/pip install -U pip wheel
$ bin/pip install Zope[docs] -c ./constraints.txt
$ cd docs
$ make html