Nick Coghlan <ncoghlan <at> gmail.com> writes:

> The other area where I think such an "embedded JSON" approach could
> work is coming up with a clean format for an Entry-Points field.
> Specifically, I am thinking of proposing the setuptools.setup
> inspired:
> 
>     Entry-Points: {
>         "console_scripts": {
>             "foo": "my_package.some_module:main_func",
>             "bar": "other_module:some_func"
>         },
>         "gui_scripts": {
>             "baz": "my_package_gui.start_func"
>         }
>     }
> 

What is the reason for this half-way-house, rather than going straight to JSON?
I suppose one could argue backward compatibility, but since we are moving quite
a distance from a plain old key-value here, we may as well embrace JSON 
properly.
Perhaps we should embrace the dict rather than any specific file format, as I
did with dictConfig in logging.

Note that distlib already supports entry points, though these are called
"exports" because they may or may not be callable code. (The name "exports"
was suggested by PJE and, IMO, is better/more general than "entry points").

For example, for Babel-0.9.6:

  "exports": {
    "babel.extractors": [
      "ignore = babel.messages.extract:extract_nothing", 
      "python = babel.messages.extract:extract_python", 
      "javascript = babel.messages.extract:extract_javascript"
    ], 
    "distutils.commands": [
      "compile_catalog = babel.messages.frontend:compile_catalog", 
      "extract_messages = babel.messages.frontend:extract_messages", 
      "init_catalog = babel.messages.frontend:init_catalog", 
      "update_catalog = babel.messages.frontend:update_catalog"
    ], 
    "babel.checkers": [
      "num_plurals = babel.messages.checkers:num_plurals", 
      "python_format = babel.messages.checkers:python_format"
    ], 
    "distutils.setup_keywords": [
      "message_extractors = babel.messages.frontend:check_message_extractors"
    ], 
    "scripts": {
      "console": [
        "pybabel = babel.messages.frontend:main"
      ]
    }
  }

This is currently used, for example, in distlib's script generation logic (for
example, to generate the pybabel script for Babel).

Regards,

Vinay Sajip

_______________________________________________
Distutils-SIG maillist  -  Distutils-SIG@python.org
http://mail.python.org/mailman/listinfo/distutils-sig

Reply via email to