Every thing on a database

Z

zelegolas

Hi

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?"

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.

Regards
Ze.
 
G

Gabriel Genellina

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...
 
S

Steven D'Aprano

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?"

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.

Would a zip file do?

http://docs.python.org/library/zipimport.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top