Changes between Version 24 and Version 25 of DevGuide


Ignore:
Timestamp:
Dec 17, 2016, 2:33:54 AM (7 years ago)
Author:
Ryan J Ollos
Comment:

Clarify recommendations.

Legend:

Unmodified
Added
Removed
Modified
  • DevGuide

    v24 v25  
    8585== Assert Minimum Trac Version Requirement
    8686
    87 A common method of specifying a minimum required Trac version is to add an installation requirement in `setup.py`, for example: `install_requires = ['Trac >= 0.12']`. However, this causes numerous problems, some of which are documented in #9800, and is not recommended. One of the most negative consequences is that setuptools may download and install a newer version of Trac. The result can be an unintended upgrade of a user's installation (#10607).
     87A common method of specifying a minimum required Trac version is to add an installation requirement in `setup.py`, for example: `install_requires = ['Trac >= 0.12']`. However, this causes numerous problems, some of which are documented in #9800, and is not recommended. One of the most negative consequences is that setuptools may download and install a newer version of Trac during installation of a plugin. The result can be an unintended upgrade of a user's installation (#10607).
    8888
    8989A better approach is to place the following in the package `__init__.py`, modifying `min_trac_version` as appropriate for your plugin:
    9090{{{#!python
    9191import pkg_resources
    92 min_trac_version = '0.12'
    93 pkg_resources.require('Trac >= %s' % min_trac_version)
     92pkg_resources.require('Trac >= 1.0')
    9493}}}
    9594
    96 You may still want to specify that Trac is an installation requirement, but without enforcing a version requirement: `install_requires = ['Trac']`.
     95You should still specify that Trac is an installation requirement, but without enforcing a version requirement: `install_requires = ['Trac']`.
    9796
    9897The check in `__init__.py` is performed at runtime, so the egg can be built in an environment that does not satisfy the installation requirements. One use-case for this behavior is building the egg on a development computer and uploading it through the plugin admin page. An error such as the following will be seen in the logs if the plugin fails to load due to a failed requirement: