Snippets management

E

Edwin

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

r

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
 
E

Edwin B.

r said:
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!
 
G

Glenn Linderman

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

Robert Lehmann

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/
 
E

Edwin

Robert Lehmann said:
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.
 
R

Robert Lehmann

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

Stef Mientki

Edwin said:
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 developed one in wxPython, you can see some of the features here.
http://mientki.ruhosting.nl/data_www/pylab_works/pw_code_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
 
E

Edwin B.

Robert Lehmann said:
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.
 
E

expora

I developed one in wxPython, you can see some of the features here.
 http://mientki.ruhosting.nl/data_www/pylab_works/pw_code_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!
 
S

Stef Mientki

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

Is the source available? It's all about learning for me right now.
I've to extract the right libs from the larger program,
as I'm in an import crisis right now,
it may take a couple of days.
If it's not here by the end of next week,
mail be directly, because I forget a lot :)

cheers,
Stef
 
E

Edwin

Since you are in Linux you should definitely check "Basket". Go to it's
website and you'll be hooked, just what you need.

Actually I use Mac OS and Free BSD but I'll check it out mate.
Thanks for the tip!!
 
E

Edwin

I've to extract the right libs from the larger program,
as I'm in an import crisis right now,
it may take a couple of days.
If it's not here by the end of next week,
mail be directly, because I forget a lot :)

cheers,
Stef

Take your time mate. Thank you in advance.
In the meantime. I'm going to check BasKet as Ricardo recommended.
I'm also starting some sketches to make my own, ala Python. I don't
know how much will it take me but if anyone is interested I can send
you a message as soon as I've got something working.

Cheers,
 
R

Ricardo Aráoz

Edwin said:
I definetly agree.


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.

Since you are in Linux you should definitely check "Basket". Go to it's
website and you'll be hooked, just what you need.
 

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

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top