Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Snippets management

Reply
Thread Tools

Snippets management

 
 
Edwin
Guest
Posts: n/a
 
      11-06-2008
Hi there,

I've been looking for a snippet manager and found PySnippet but it
requires PyGTK. Do you know any other option that doesn't need much?

I'm sort of new to python and user interfaces seem a bit far for me
right now, that's why I thought having to install PyGTK was
unnecessary.

Would you recommend installing it anyway?

I'm on a Mac, maybe some users of Steve's Unix flavour know about a
snippets software piece? I'm looking for free/open source alternatives.

Thank you!

P.S.: I'm also new to usenet and hope my english is not that bad.
 
Reply With Quote
 
 
 
 
r
Guest
Posts: n/a
 
      11-06-2008
On Nov 5, 7:55*pm, (E-Mail Removed) (Edwin) wrote:
> Hi there,
>
> I've been looking for a snippet manager and found PySnippet but it
> requires PyGTK. Do you know any other option that doesn't need much?
>
> I'm sort of new to python and user interfaces seem a bit far for me
> right now, that's why I thought having to install PyGTK was
> unnecessary.
>
> Would you recommend installing it anyway?
>
> I'm on a Mac, maybe some users of Steve's Unix flavour know about a
> snippets software piece? I'm looking for free/open source alternatives.
>
> Thank you!
>
> P.S.: I'm also new to usenet and hope my english is not that bad.


I don't use one, but why not take a stab at coding one yourself.
Use Tkinter to start, its easy. well documented
gotta learn GUI somehow
if you need links to docs or help let me know

 
Reply With Quote
 
 
 
 
Edwin B.
Guest
Posts: n/a
 
      11-06-2008
r <(E-Mail Removed)> writes:

> On Nov 5, 7:55*pm, (E-Mail Removed) (Edwin) wrote:
>> Hi there,
>>
>> I've been looking for a snippet manager and found PySnippet but it
>> requires PyGTK. Do you know any other option that doesn't need much?
>>
>> I'm sort of new to python and user interfaces seem a bit far for me
>> right now, that's why I thought having to install PyGTK was
>> unnecessary.
>>
>> Would you recommend installing it anyway?
>>
>> I'm on a Mac, maybe some users of Steve's Unix flavour know about a
>> snippets software piece? I'm looking for free/open source alternatives.
>>
>> Thank you!
>>
>> P.S.: I'm also new to usenet and hope my english is not that bad.

>
> I don't use one, but why not take a stab at coding one yourself.
> Use Tkinter to start, its easy. well documented
> gotta learn GUI somehow
> if you need links to docs or help let me know
>


Good idea. It's not that I don't want to learn GUI, but coming from Web
related fields I'm taking it one step at a time, while learning Unix
(editors, shell, filesystem hierarchy, etc.).

All of this had been obscured by 'Apple's lifestyle'. It's been less than a
year since I realized I had so much powerful software around.

I'll start with Python documentation. If in any trouble, I'll get to you.

Cheers!
 
Reply With Quote
 
Glenn Linderman
Guest
Posts: n/a
 
      11-06-2008
On approximately 11/5/2008 8:23 PM, came the following characters from
the keyboard of r:
> I don't use one, but why not take a stab at coding one yourself.
> Use Tkinter to start, its easy. well documented
> gotta learn GUI somehow


Since you are recommending tkinter, maybe you know what is the state of
cross-platform (or even single-platform) printing capabilities in Tk
these days? Last I heard, there was a plan, but it was nowhere near
complete. So I guess the OP is on a mac, so maybe you could reply about
mac printing capabilities, if you know, but I'm interesting in
cross-platform printing.

Because of that, I've started learning PyQt, which seems to be
cross-platform at least for Linux, Mac, and Windows...

--
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking

 
Reply With Quote
 
Robert Lehmann
Guest
Posts: n/a
 
      11-06-2008
On Wed, 05 Nov 2008 19:55:51 -0600, Edwin wrote:

> Hi there,
>
> I've been looking for a snippet manager and found PySnippet but it
> requires PyGTK. Do you know any other option that doesn't need much?

[snip]

If you're looking for a snippet manager for actually *using* it (not
educational purposes or something), I'd recommend your favorite editor
and the version control system of your choice. I found DVCSes to be
rather nice for local ad-hoc repositories (particulary Git_). If you'd
like to modify your snippet system you could take a look at Mercurial or
Bazaar, both being written in Python.

HTH,

... _Git: http://git.or.cz/

--
Robert "Stargaming" Lehmann
 
Reply With Quote
 
Edwin
Guest
Posts: n/a
 
      11-06-2008
Robert Lehmann <(E-Mail Removed)> writes:

> On Wed, 05 Nov 2008 19:55:51 -0600, Edwin wrote:
>
>> Hi there,
>>
>> I've been looking for a snippet manager and found PySnippet but it
>> requires PyGTK. Do you know any other option that doesn't need much?

> [snip]
>
> If you're looking for a snippet manager for actually *using* it (not
> educational purposes or something), I'd recommend your favorite editor
> and the version control system of your choice. I found DVCSes to be
> rather nice for local ad-hoc repositories (particulary Git_). If you'd
> like to modify your snippet system you could take a look at Mercurial or
> Bazaar, both being written in Python.
>
> HTH,
>
> .. _Git: http://git.or.cz/


That sounds interesting. As I'm learning Python sometimes I look for
different approaches to the same problem so I use Git branches in order
to save every try. It's just that I'm looking for a 'global' place in my
system where I can save code ideas and useful snippets not particular to
any project. Quick access could be useful for some copy/paste
operations... I don't know.

How would you set this up? A git folder 'snippets' maybe?

Thanks for your ideas.
 
Reply With Quote
 
Robert Lehmann
Guest
Posts: n/a
 
      11-06-2008
On Thu, 06 Nov 2008 05:23:25 -0600, Edwin wrote:
[snip]
> As I'm learning Python sometimes I look for different approaches to the
> same problem so I use Git branches in order to save every try. It's
> just that I'm looking for a 'global' place in my system where I can
> save code ideas and useful snippets not particular to any project.
> Quick access could be useful for some copy/paste operations...
> I don't know.
>
> How would you set this up? A git folder 'snippets' maybe?
>
> Thanks for your ideas.


I don't think there is a one-size-fits-all solution.

Setting up a 'snippets' repository sounds good if you just want to be
able to look back at what you've done and/or have a place to stash away
quick tests. I have set up a 'sandbox' folder (unrevisioned) and put
together a few shell aliases for easier access and it works pretty well.
I almost never look back at that code though.

If you develop a lot of small scripts you think you'll reuse in your
daily routine, you should add a dedicated 'bin' directory and add it to
your PATH.

I've also seen people put together libraries of "personal helpers", say,
libedwin, but I don't think such mashups offer any particular semantic
gain. They will just bloat over time and be vastly unused in most
projects.

So, I don't really know what you should do. I'd go for a throw away
location for quick tests; *real* libraries/programs where reasonable. If
you need a particular algorithm and know you've used it in project XY,
just go back to this project and copy it. No big deal. If it's a
generally applicable algorithm, extracting a library might be a good idea
then.

Just one last hint: Don't be overly shy in creating new Git repositories.
They're pretty cheap and a shared history for *deeply unrelated projects*
is seldom sensible (IMO). GitHub doesn't restrict you in your number of
public repositories so that's no deal breaker either.

Snippet'ly yours,

--
Robert "Stargaming" Lehmann
 
Reply With Quote
 
Stef Mientki
Guest
Posts: n/a
 
      11-06-2008
Edwin wrote:
> Hi there,
>
> I've been looking for a snippet manager and found PySnippet but it
> requires PyGTK. Do you know any other option that doesn't need much?
>
> I'm sort of new to python and user interfaces seem a bit far for me
> right now, that's why I thought having to install PyGTK was
> unnecessary.
>
> Would you recommend installing it anyway?
>
> I'm on a Mac, maybe some users of Steve's Unix flavour know about a
> snippets software piece? I'm looking for free/open source alternatives.
>
> Thank you!
>
> P.S.: I'm also new to usenet and hope my english is not that bad.
> --
> http://mail.python.org/mailman/listinfo/python-list
>


I developed one in wxPython, you can see some of the features here.
http://mientki.ruhosting.nl/data_www...de_editor.html

Although it's part of a larger part it can be used standalone,
but then it requires two actions copy and paste.
Started from a python application you can do copy+paste with just one
action.
It has integrated a full blown scintilla editor,
with syntax highlighting, code completion, and syntax checker.

If there's interest, I can distribute the files as a separate package.

cheers,
Stef Mientki

 
Reply With Quote
 
Edwin B.
Guest
Posts: n/a
 
      11-07-2008
Robert Lehmann <(E-Mail Removed)> writes:

> I don't think there is a one-size-fits-all solution.


I definetly agree.

> Setting up a 'snippets' repository sounds good if you just want to be
> able to look back at what you've done and/or have a place to stash away
> quick tests. I have set up a 'sandbox' folder (unrevisioned) and put
> together a few shell aliases for easier access and it works pretty well.
> I almost never look back at that code though.
>
> If you develop a lot of small scripts you think you'll reuse in your
> daily routine, you should add a dedicated 'bin' directory and add it to
> your PATH.


This is a nice method. I'm already putting it to use. I've learned about
/usr/bin and /usr/local/bin so I went ahead and created $HOME/bin and
added it to my path for this sort of code.

Now, I was thinking more of a notes+code program. Let me give you an
example:

I use Emacs.app (Emacs compiled with --with-ns) and in order to get a
meta key in the Spanish keyboard on my Mac I had to try different lines
but I didn't want to keep all these tries in my .emacs file. I also
wanted to keep the lines that didn't work for later tests in my Free BSD
PC (also with a Spanish keyboard). So I keep all of them in my notebook.

Then, I start coding Python. This time I try to translate an old PHP
script to Python and want to keep a few important lines visible. It'll
be nice to take some notes of the main differences in my scripts in a
different place. Like a student's notebook. Once again, all this goes to
my little program.

Then, I remember I had to run some Mac maintenance commands... I don't
remember the complete line very well, so I go to my notebook.

My point is that sometimes not every note is useful for a program. I
guess as I gain experience all these little notes will be kept in my
mind . But as a newbie it seems useful.

As r said, I think it'll be good to write this program. If it doesn't
result in a very useful piece, it'll be a good way to practice.

I forgot to mention I don't use a notes program to keep personal and
programming notes separately.

Thanks mate!

P.S.: Man I hope my English doesn't suck too much.

 
Reply With Quote
 
expora
Guest
Posts: n/a
 
      11-07-2008
On Nov 6, 12:38*pm, Stef Mientki <(E-Mail Removed)> wrote:
> Edwin wrote:
> > Hi there,

>
> > I've been looking for a snippet manager and found PySnippet but it
> > requires PyGTK. Do you know any other option that doesn't need much?

>
> > I'm sort of new to python and user interfaces seem a bit far for me
> > right now, that's why I thought having to install PyGTK was
> > unnecessary.

>
> > Would you recommend installing it anyway?

>
> > I'm on a Mac, maybe some users of Steve's Unix flavour know about a
> > snippets software piece? I'm looking for free/open source alternatives.

>
> > Thank you!

>
> > P.S.: I'm also new to usenet and hope my english is not that bad.
> > --
> >http://mail.python.org/mailman/listinfo/python-list

>
> I developed one in wxPython, you can see some of the features here.
> *http://mientki.ruhosting.nl/data_www...de_editor.html
>
> Although it's part of a larger part it can be used standalone,
> but then it requires two actions copy and paste.
> Started from a python application you can do copy+paste with just one
> action.
> It has integrated a full blown scintilla editor,
> with syntax highlighting, code completion, and syntax checker.
>
> If there's interest, I can distribute the files as a separate package.
>
> cheers,
> Stef Mientki


Wicked!
I'm going to check it out Stef.

Is the source available? It's all about learning for me right now.

Cheers!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Committing Code Snippets windsurfing_stew@yahoo.com.au ASP .Net 2 12-17-2005 10:22 PM
Code snippets, tool to convert basic to .snippet xml? Edwin Knoppert ASP .Net 0 11-30-2005 03:45 PM
No code snippets built in yet for C# ASP.NET 2.0 beta? Steve Franks ASP .Net 2 09-11-2005 10:36 AM
Where are my Code Snippets? Pat ASP .Net 4 04-23-2005 01:29 PM
Reusing Code Snippets - Steve - ASP .Net 2 10-01-2004 11:29 AM



Advertisments