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)
commit6df90db0baf023ab59a21f1ca73b79fb04f9e22b
treefb956ae868e7814b1e510925a1926f146ef89ae8
parentfe7fe27d1e5df6918fb9cf11d64686f85948c564
Speed up `import pokedex.db` slightly.

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.
pokedex/__init__.py
pokedex/defaults.py
pokedex/main.py [new file with mode: 0644]
setup.py