Speed up `import pokedex.db` slightly.
authora_magical_me <andrew@turnipmints.mooo.com>
Tue, 29 Mar 2011 03:49:17 +0000 (20:49 -0700)
committera_magical_me <andrew@turnipmints.mooo.com>
Sun, 3 Apr 2011 10:13:07 +0000 (03:13 -0700)
Importing pokedex can take several seconds due to its rather large
dependencies—in particular, sqlalchemy, whoosh, and pkg_resources seem
to be the largest offenders. Normally, it would be possible to import
only the submodules one needs (pokedex.db, say), but pokedex.__init__
brings in all the submodules, for use by the command-line interface.

The fix is rather obvious:

- Move the command-line stuff into pokedex.main.

  Note: because the submodules are no longer imported by default, any
  script which expects `import pokedex` to be useful will likely break.

  Note: the `pokedex` command will not work until you re-run `python
  setup.py develop`, to update entry_points.txt.

- Don't import pkg_resources until necessary.


No differences found