Edgewall Software

Changes between Initial Version and Version 1 of TracDev/Proposals/Setuptools


Ignore:
Timestamp:
Jan 19, 2007, 1:57:17 AM (17 years ago)
Author:
Christopher Lenz
Comment:

Initial version

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/Proposals/Setuptools

    v1 v1  
     1= Moving to setuptools =
     2
     3This page describes the plan to move to the [http://peak.telecommunity.com/DevCenter/setuptools setuptools] package for deploying Trac.
     4
     5== Benefits ==
     6
     7Adopting setuptools brings a number of benefits, mostly centered around making installation easier and the plugin system more robust.
     8
     9 * Trac will become better suited to be installed using [http://peak.telecommunity.com/DevCenter/EasyInstall EasyInstall], including automatic downloading and installation of dependencies such as Genshi.
     10 * Programs such as `trac-admin` and `tracd` will be installed as wrapper scripts suitable to the installation platform. For example, on Windows the programs will be installed as executables (`.exe`), making them easier to invoke from the command prompt.
     11 * [TracPlugins Plugins] will be able to declare compatibility with a specific version of Trac. Thus you could have a plugin that says it requires e.g. `"Trac>=0.11.3."` (see [http://peak.telecommunity.com/DevCenter/setuptools#declaring-dependencies declaring dependencies]).
     12 * We will be able to provide a common package namespace (called `tracext`) that third-party developers could use for their plugin code, meaning the Python package namespace won't get polluted by those plugins.
     13 * The listing of Trac modules in at the bottom of [source:/branches/0.10-stable/trac/db_default.py db_default.py] will be replaced by entry points declared in the `setup.py` file, and thus registered using the same mechanism already in use by external plugins.
     14 * Optionally, we could support the entry point for WSGI app factories exposed by [http://pythonpaste.org/deploy/ Paste Deploy].
     15
     16== Required Changes ==
     17
     18Some aspects of how Trac is currently packaged and run need to be changed so that it can be deployed with setuptools.
     19
     20=== siteconfig ===
     21
     22The module `trac.siteconfig`, which is currently generated at installation time, will be removed. Its purpose was to tell Trac where to find various installation-wide directories and files such as
     23
     24 * templates,
     25 * static resources (htdocs),
     26 * default wiki pages,
     27 * plugins,
     28 * the configuration file
     29
     30The templates, static resources, and the default set of wiki pages will become [http://peak.telecommunity.com/DevCenter/setuptools#including-data-files package data], meaning they will be installed alongside the application code, and no longer intended to be modified by the site admin. Instead they should be overridden using a site template and a site-specific CSS stylesheet.
     31
     32The other cases are mostly interesting for deployments handling multiple projects, where every project should inherit some aspects from a shared location. This scenario will be handled by allowing [TracIni trac.ini] to inherit configuration values from an explicitly specified “parent” configuration. For example, the `trac.ini` file of an environment might start like this:
     33
     34{{{
     35[inherit]
     36file = /etc/trac.ini
     37}}}
     38
     39The inherited configuration file could then specify global directories for the templates, plugins, and default wiki pages, in addition to most other options already usable with the global `trac.ini` file.
     40
     41This approach is both more explicit and more flexible than the current model. For example, it allows multiple inheritance levels, as opposed to the fixed global->environment levels we currently provide.
     42
     43=== Environment Initialization ===
     44
     45As the location of the global configuration file will no longer be available implicitly, `trac-admin` will need to be modified so that this information can be passed to it using command-line options and/or environment variables.
     46
     47For example:
     48
     49{{{
     50$ trac-admin --inherit-file=/etc/trac.ini /var/trac/myproj initenv
     51}}}
     52
     53or:
     54{{{
     55$ export TRAC_CONFIG=/etc/trac.ini
     56$ trac-admin /var/trac/myproj initenv
     57}}}
     58
     59I'd like to combine this with making `trac-admin` make use of options instead of positional arguments for the `initenv` command, so that even a simple invocation as above would just create the environment, instead of prompting for information that can easily be provided later.
     60
     61== Status ==
     62
     63The [source:sandbox/setuptools] branch contains most of the changes described, but is based on a rather old version of trunk. Because this proposal requires moving many files around (causing pain when merging), I would prefer doing these changes in one big changeset directly on trunk instead of updating the branch.
     64
     65You can view the [diff:trunk@4131//sandbox/setuptools@4134 diff] to get a feeling for the changes required.
     66
     67----
     68See also: [milestone:0.11 Milestone 0.11], TracDev/Proposals