|
|
Subject: Re: advanced newbie questions - msg#00300
List: python.apple
On Tue, Jan 27, 2004 at 11:58:48AM -0700, steve harley wrote:
> i'm learning Python, evaluating it for replacing a workflow that is now
> half in Visual FoxPro, half in UserLand Frontier (running in Virtual PC
> & Classic respectively under Mac OS X 10.3.2).. given that i find both
> of those environments very fluid and powerful, but dislike having to
> use VPC and Classic, Python looks very promising.. it has a coding feel
> much like Frontier, though i miss coding in an outliner; has anyone
> found a way to do this for Python, which is so obviously suited?
I wish. There are a few editors based on Scintilla which provide code
folding, but it's nothing like Frontier's outline-based editing.
I really miss Frontier, but at least on the Mac, current versions of
Frontier/Radio are buggy and poorly maintained (if at all). I've
moved off it, mainly to Python. A few years ago, around Python
1.5.2/2.0, I wrote an application which was half in Python, using ZODB
and Tkinter, and half in Radio (back when it was free), using XML-RPC
for communication. The main reason for this was that I couldn't find
a scriptable outliner for Python half as good as Radio's.
Unfortunately, nothing has changed since then.
> for relational purposes, easiest for me would be SQL back end; bearing
> in mind i'm used to completely integrated, inline SQL, with little
> fiddling or setup required, are there any gotchas or strong positives
> (from the Python on Mac OS X perspective) for MySQL or Postgres? is
> there some other approach which would let me do complex joins and
> many-to-many relations?
Two Python apps I'm currently maintaining use Metakit and MS SQL
Server for data storage. Obviously the latter is not a good choice
for the Mac - I am using ADODBAPI on Windows, in fact :). Python has
a standard, easy-to-use database API; I hope the multitude of bugs in
ADODAPI I've found aren't shared by the interfaces to PostgreSQL.
(MySQL is a bad choice overall, especially with the recent licensing
changes).
Metakit is a relational-ish database with the ease of construction of
an object database. It doesn't really lend itself to the hierarchical
design you'd find in Frontier's ODB, but it's good for small to medium
size data sets (since it uses memory mapping for speed) and has a
great Python binding on which I've done some work.
> for object storage, i get the impression there are various "object
> serialization" approaches.. since i'd probably eventually use PyObjC to
> build interfaces, i'd also consider a Cocoa-based approach.. from
> either the pure Python or Cocoa sides, is there one that stands out?
> what are the performance considerations? (most of my objects are
> probably smaller than 10KB)
If you choose to go with ZODB, be careful. ZODB's paradigm is much
closer to Frontier's ODB: it's extremely hierarchical and doesn't
really like to make arbitrary connections, unlike true object-oriented
databases (e.g. ObjectStore). But by storing objects rather than a
limited set of data types - I like to think of Frontier's ODB as what
the Mac Resource Manager would be like if it became a database - it's
not so hard to corrupt your data store in subtle and confusing ways.
Just don't expect it to handle indexing well.
> for either of these storage needs, are there good abstraction libraries
> so that i could switch storage types later if needed?
There are a few, but I haven't found any higher-level database
abstraction layers in Python robust enough to use.
You might also consider Squeak Smalltalk (www.squeak.org). I learned
Frontier before Smalltalk, and Smalltalk environments are the closest
I've found to the immersive development experience of Frontier. GLORP
(www.glorp.org) is an object-relational persistence layer which I used
in a much more primitive version, and it looks pretty decent now
despite the version number. GLORP works with Oracle and PostgreSQL.
--
=Nicholas Riley <njriley@xxxxxxxx> | < http://www.uiuc.edu/ph/www/njriley>
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig
Was this page helpful?
Thread at a glance:
Previous Message by Date:
click to view message preview
Re: advanced newbie questions
On Jan 27, 2004, at 1:58 PM, steve harley wrote:
i'm learning Python, evaluating it for replacing a workflow that is
now half in Visual FoxPro, half in UserLand Frontier (running in
Virtual PC & Classic respectively under Mac OS X 10.3.2).. given that
i find both of those environments very fluid and powerful, but dislike
having to use VPC and Classic, Python looks very promising.. it has a
coding feel much like Frontier, though i miss coding in an outliner;
has anyone found a way to do this for Python, which is so obviously
suited?
We don't have an outliner. I've never used one (and I'm not willing to
install Classic :) so if you could explain what an outliner does, how
it works, and what you like most about it.. maybe we can incorporate
that sort of thing into a future IDE for MacPython.
since the Frontier part of this workflow heavily exercises the AE
capabilities of publishing apps, i was curious to see how Python
stacked up.. i read through the recent thread on abstracting the AE
functionality, and a few other threads, and got the impression that
there are multiple paths, and all are essentially in beta.. by the
way, coming from strong familiarity with Mac scripting, that thread
really helped me grasp the richness of Python, as it touched on
several under-the-hood aspects that intro texts ignore
They're not even beta quality, don't try anything complicated yet. Or
at least, if you do, don't spend too much time trying to make it work -
because it probably won't :)
anyhow, AppScript looked like the easiest transition from Frontier's
object model, so i got the latest version and installed it.. i
immediately found a dependency on launchservices.py, so i installed
the latest SourceForge version
The LaunchServices that AppScripting depends on is actually mine, not
the newer standard one. You can get that from
http://undefined.org/python/#LaunchServices
Your best bet is just to wait until AppScripting is fixed, or wait for
the new version of aeve.
i see some people have trouble getting the dictionary from iTunes.. is
AppScript able to do this? if not which AE package should i use? (i'm
using a small iTunes-related project as an evaluation tool)
AppScripting is not able to do this, due to a bug in the way it tries
to get the OSA terminology. aeve does not have this problem, but it
has a different suite of bugs. I'm working on a new version of aeve
that encompasses all of AppScripting's features and then some, but
don't hold your breath waiting for it, it's probably another few weeks
out.
i need some practical advice for persistent storage needs..
unfortunately my workflow depends heavily on both relational and
object paradigms (SQL in Visual FoxPro, object databases in Frontier;
both *highly* integrated)
for relational purposes, easiest for me would be SQL back end; bearing
in mind i'm used to completely integrated, inline SQL, with little
fiddling or setup required, are there any gotchas or strong positives
(from the Python on Mac OS X perspective) for MySQL or Postgres? is
there some other approach which would let me do complex joins and
many-to-many relations?
Don't use MySQL, use PostgreSQL. PostgreSQL has a better license,
supports more SQL, and the Python interface actually works properly.
MySQL loses on all three counts there.
There are other SQL databases that run in-process and have Python
interfaces that might be of interest (but I can't think of their
names), ZODB is a really good transactional versioned object database,
and Metakit is sort of a hybrid between relational and object database.
for object storage, i get the impression there are various "object
serialization" approaches.. since i'd probably eventually use PyObjC
to build interfaces, i'd also consider a Cocoa-based approach.. from
either the pure Python or Cocoa sides, is there one that stands out?
what are the performance considerations? (most of my objects are
probably smaller than 10KB)
Object serialization is a problem if you're mixing PyObjC and Python
classes.. you have to decide one way or the other as to which kind of
objects you're going to serialize. In the only-python route you can
use regular 'ol pickle and possibly shelve or something more advanced
like ZODB.. otherwise you're using plists with the Cocoa classes. It's
probably even possible to add pickle integration to the plist stuff, by
having Python objects support the coding protocols -- or add __reduce__
functionality to Cocoa classes to allow them to be pickled. I don't
think either of these has been looked into, though.
for either of these storage needs, are there good abstraction
libraries so that i could switch storage types later if needed?
Relational databases in Python all use the DB-API spec, so switching
can be as simple as changing the module and connect string. There are
higher level things you can shim on top, such as PEAK, but you probably
don't need them. Learn Python first, then worry about the big
frameworks that make it easier for large applications :)
The best way to do it is to figure out what you need to do first,
before getting mixed up in relational vs object vs hybrid databases and
picking a particular product to do it with. SQL certainly feels like a
kludge after a while with ZODB or MetaKit, because you can eschew the
whole ORM layer (object-relational mapping) and Just Use Objects.
Python is a terse enough language to write queries yourself, working
with the native object structures, and can even be faster than SQL (if
a query doesn't lend itself to a relational representation, or if
you're smarter than the SQL database's optimizer).
-bob
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig
Next Message by Date:
click to view message preview
Re: advanced newbie questions
steve harley wrote:
> though i miss coding in an outliner; has anyone found a way to do
this for Python, which is so obviously suited?
Check out Leo:
http://leo.sourceforge.net/
It uses Tkinter, so I'm not sure how well it runs on OS-X at the moment.
Sorry, I'm not much use with your other questions.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@xxxxxxxx
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig
Previous Message by Thread:
click to view message preview
Re: advanced newbie questions
steve harley wrote:
thanks to Chris Barker, i would say Leo has some of what i'm talking
about:
<http://webpages.charter.net/edreamleo/front.html>
it's intriguing, but tk is very primitive Aqua, it's missing
way too many UI bells and whistles like command-key, drag & drop, wheel
scrolling, window switching, etc.. with a real Mac OS X interface, Leo
could be amazing
From what I understand, Edward Ream is re-working Leo to be more
GUI-independent, the first step being writing a wxPython GUI for it.
That should improve things a lot, and if he realy does make it GUI
independent, maybe someone would write a Cocoa GUI for it, and that
could take it the final step to "Real Mac App"
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@xxxxxxxx
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig
Next Message by Thread:
click to view message preview
Re: advanced newbie questions
At 2:49 PM -0600 1/27/04, Nicholas Riley wrote:
On Tue, Jan 27, 2004 at 11:58:48AM -0700, steve harley wrote:
, though i miss coding in an outliner; has anyone
> found a way to do this for Python, which is so obviously suited?
I wish. There are a few editors based on Scintilla which provide code
folding, but it's nothing like Frontier's outline-based editing.
If by "outline-based editing" you mean you can do things like "fold"
lines based on indentation, then the next version of PyOXIDE will
support this (it's not perfect, since it's based _entirely_ on the
indentation of the file, and not on any language based information,
but it's at least a step).
If that's not what you mean, then, well, it won't.
--
Glenn Andreas gandreas@xxxxxxxxxx
Theldrow, Blobbo, Cythera, oh my!
Be good, and you will be lonesome
_______________________________________________
Pythonmac-SIG maillist - Pythonmac-SIG@xxxxxxxxxx
http://mail.python.org/mailman/listinfo/pythonmac-sig
|
|