Handy utilities = Friday Filosofical Finking
cs at cskk.id.au
Mon Apr 1 18:57:35 EDT 2019
On 29Mar2019 09:32, DL Neil <PythonList at DancesWithMice.info> wrote:
>How do you keep, use, and maintain those handy snippets, functions,
>classes... - units of code, which you employ over-and-over again?
>Having coded 'stuff' once, most of us will keep units of code,
>"utilities", which we expect will be useful in-future (DRY principle),
>eg functions to rename files, choose unique back-up/new fileNMs,
>accessing a DB, journalling (logging) start/stop msgs, building specs
>from YAML/JSON/XML/.ini config files (tongue~cheek), etc.
>Do you 'keep' these, or perhaps next time you need something you've
>'done before' do you remember when/where a technique was last
>used/burrow into 'history'?
>(else, code it from scratch, all over again)
I put them into modules for import. I've got a tree of Python modules
named "cs.this", "cs.that" for various things. Then just import stuff
like any other library module.
For personal projects (if they aren't just part of that tree) I just
need to symlink the tree into the local Python library as "cs".
If I get something well enough defined and sufficiently cleaned up for
use beyond my own code (or just good enough that others might want it),
up it goes to PyPI so that it can just be "pip install"ed.
So I've got this huge suite of modules with stuff in them, and a subset
of those modules are published to PyPI for third party reuse.
Happy to elaborate on the details.
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list