Best practices for single file modules Inspired by: Best Practices for Internal Package Structure

Ethan Furman ethan at stoneleaf.us
Tue Apr 5 16:06:33 EDT 2016


On 04/05/2016 12:49 PM, Eric S. Johansson wrote:

> I was inspired by the thread on packaging practices discussion with
> bidict to ask a related question which is what are the best practices
> with packaging/releasing a single file Python module ?
>
> Back story: I'm always creating little bits of useful code that I want
> to reuse (for example, recursive expansion template module). It seems
> like the overhead of setting up a module is a bit high for a single file
> module but maybe this modern nation I'm not aware of or template based
> techniques that would lower the setup overhead.

The problem I have found with single file PyPI packages is what to do 
with the related files?  README, LICENSE, doc, test, ... ?

I ended up with (for example): dbf.py, dbf_test.py, dbf.README, ..., and 
it was a mess.

So, even for single-purpose utilities I just make a package and stuff 
the main content into __init__.py, my tests in test.py, and other 
supporting files in that same folder.

So far it has worked well for me.

--
~Ethan~



More information about the Python-list mailing list