PJE's feedback on PEP 426 exports

This commit is contained in:
Nick Coghlan 2013-08-03 23:42:56 +10:00
parent 91f171864b
commit 605e86dca8
2 changed files with 42 additions and 26 deletions

View File

@ -1454,10 +1454,6 @@ The meaning of the subfields is as follows:
* ``requires_extra``: indicates the export will only work correctly if the
additional dependencies named in the given extra are available.
Note that installation of extras is not tracked directly: they are merely
a convenient way to refer to a set of dependencies that will be checked for
at runtime.
.. note::
I tried this as a mapping with subfields, and it made the examples below
@ -1520,19 +1516,21 @@ The ``commands`` mapping contains three subfields:
* ``prebuilt``: scripts created by the distribution's build process and
installed directly to the configured scripts directory
``wrap_console`` and ``wrap_gui`` are both mappings of relatively arbitrary
script names to export specifiers. The script names must follow the rules
for distribution names. The export specifiers must refer to
either a package with a __main__ submodule (if no ``name`` subfield is
given in the export specifier) or else to a callable inside the named
module.
``wrap_console`` and ``wrap_gui`` are both mappings of script names to
export specifiers. The script names must follow the same naming rules as
distribution names.
The export specifiers for wrapper scripts must refer to either a package
with a __main__ submodule (if no ``name`` subfield is given in the export
specifier) or else to a callable inside the named module.
Installation tools should generate appropriate wrappers as part of the
installation process.
.. note::
Still needs more detail on what "appropriate wrapper" means.
Still needs more detail on what "appropriate wrapper" means. For now,
refer to what setuptools and zc.buildout generate as wrapper scripts.
``prebuilt`` is a list of script paths, relative to the scripts directory in
a wheel file or following installation. They are provided for informational
@ -1553,17 +1551,22 @@ Example::
Exports
-------
The ``exports`` mapping contains relatively arbitrary subfields, each
defining an export group. Each export group is then a mapping of relatively
arbitrary subfields to export specifiers.
The ``exports`` field is a mapping containing dotted names as keys. Each
key defines an export group. Export group names SHOULD correspond to
module names in the distribution responsible that defines the meaning
of the export group.
Each export group is then a mapping of arbitrary non-empty string keys
to export specifiers. The interpretation of the individual export keys is
defined by the distribution that i
Both export group names and export names must follow the rules for
distribution identifiers. It is suggested that export groups be named
after distributions to help avoid name conflicts.
The meaning of exports within an export group is up to those defining the
export group. One common use case is to advertise plugins for use by other
software.
The meaning of exports within an export group is up to the distribution
that defines the export group. One common use case is to allow other
distributions to advertise plugins for use by the defining distribution.
Install hooks
@ -1703,13 +1706,19 @@ Extras (optional dependencies)
==============================
Extras are additional dependencies that enable an optional aspect
of the distribution, generally corresponding to a ``try: import
of the distribution, often corresponding to a ``try: import
optional_dependency ...`` block in the code. To support the use of the
distribution with or without the optional dependencies they are listed
separately from the distribution's core dependencies and must be requested
explicitly, either in the dependency specifications of another distribution,
or else when issuing a command to an installation tool.
Note that installation of extras is not tracked directly by installation
tools: extras are merely a convenient way to indicate a set of dependencies
that is needed to provide some optional functionality of the distribution.
If selective *installation* of components is desired, then multiple
distributions must be defined rather than relying on the extras system.
The names of extras MUST abide by the same restrictions as those for
distribution names.

View File

@ -17,7 +17,7 @@
"name": {
"description": "The name of the distribution.",
"type": "string",
"$ref": "#/definitions/valid_name"
"$ref": "#/definitions/distribution_name"
},
"version": {
"description": "The distribution's public version identifier",
@ -252,11 +252,11 @@
"properties": {
"wrap_console": {
"type": "object",
"$ref": "#/definitions/export_map"
"$ref": "#/definitions/command_map"
},
"wrap_gui": {
"type": "object",
"$ref": "#/definitions/export_map"
"$ref": "#/definitions/command_map"
},
"prebuilt": {
"type": "array",
@ -271,22 +271,29 @@
"exports": {
"type": "object",
"patternProperties": {
"^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$": {
"^[A-Za-z]([0-9A-Za-z_])*([.][A-Za-z]([0-9A-Za-z_])*)*$": {
"type": "object",
"$ref": "#/definitions/export_map"
"patternProperties": {
".": {
"type": "string",
"$ref": "#/definitions/export_specifier"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
"export_map": {
"command_map": {
"type": "object",
"patternProperties": {
"^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$": {
"type": "string",
"$ref": "#/definitions/export_specifier"
}
},
"valid_name": {
"additionalProperties": false
},
"distribution_name": {
"type": "string",
"pattern": "^[0-9A-Za-z]([0-9A-Za-z_.-]*[0-9A-Za-z])?$"
},