benwebber / cookiecutter-standalone

Cookiecutter template designed for self-contained command-line tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cookiecutter-standalone

Cookiecutter template designed for self-contained command-line tools.

Requires Cookiecutter 1.1 or later.

Usage

Install Cookiecutter, then run:

cookiecutter https://github.com/benwebber/cookiecutter-standalone.git

Features

Flexible entry points

Cover all the bases with setuptools and runpy:

  • Install and run from your setuptools install path:

    $ pip install tool
    $ tool
    
  • Install and run as a module:

    $ python -m tool
    
  • Run from the source directory:

    $ python tool/
    
  • Run from a self-contained zip archive:

    $ ./tool
    

Flexible packaging

Supports:

  • source distribution
  • wheel
  • self-contained executable archive
  • RPM containing isolated virtual environment

Asset management

Optionally bundle assets with your application.

If enabled, the cookiecutter will create an assets package and assets.asset() context manager. Install your assets to the sub-package:

example
├── __init__.py
├── __main__.py
├── assets
│   ├── __init__.py
│   └── example.txt
└── cli.py

Then access them like so:

from .assets import asset

with asset('example.txt') as f:
    print(f.read())

Thanks to the magic of pkg_resources, this even works inside standalone archives.

Note that this technique adds setuptools as an install dependency. You probably want to pin setuptools to a specific version.

License

MIT

About

Cookiecutter template designed for self-contained command-line tools

License:MIT License


Languages

Language:Python 68.3%Language:Shell 16.8%Language:Makefile 14.9%