Every thing on a database

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Sep 2 06:20:16 CEST 2009


En Tue, 01 Sep 2009 23:16:29 -0300, zelegolas <zelegolas at gmail.com>  
escribió:

> I guess it's may be a strange idea that I will explain:
>
> I really like python but I have one thing that I don't like: Every
> packages are defined with folder tree. To deploy an application it's
> not really clean.
>
> It's why I thought about "Is that possible to put everything that I
> need for my python application under one file?"

Yes. py2exe, cx_freeze, and others do that. Basically, you put everything  
in a zip file, and insert its filename in sys.path

> Base on this idea: If all packages are under one file. Like this each
> time an import is executing it will automatically extract packages,
> library or any files from this file first and if doesn't find it from
> the standard way. This file could a SQLite file for example.
>
> I don't know if it's possible to overwrite the import behavior.
> And may be what I describe is already develop by someone, if it's the
> case just let me know.

Yes, you can customize how import works in several ways. Look for "import"  
in the PEP index http://www.python.org/dev/peps/ (in chronological order!  
import semantics is currently a mess, due to successive patches over  
patches; hard to understand without a historical perspective)

Brett Cannon is working on a pure Python implementation for import, and I  
think some kind of sqlite importer is in the plans...

-- 
Gabriel Genellina




More information about the Python-list mailing list