From: a_magical_me Date: Tue, 29 Mar 2011 03:49:17 +0000 (-0700) Subject: Speed up `import pokedex.db` slightly. X-Git-Tag: veekun-promotions/2011041101~6^2~14 X-Git-Url: http://git.veekun.com/zzz-pokedex.git/commitdiff_plain/6df90db0baf023ab59a21f1ca73b79fb04f9e22b?hp=6df90db0baf023ab59a21f1ca73b79fb04f9e22b 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. ---