• Stars
    star
    200
  • Rank 194,071 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 10 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A minimal template for python packages

cookiecutter-pypackage-minimal

An opinionated, minimal cookiecutter template for Python packages, and some guidelines for Python packaging.

Usage

pip install cookiecutter
git clone https://github.com/kragniz/cookiecutter-pypackage-minimal.git
cookiecutter cookiecutter-pypackage-minimal/

You should then change the classifiers in {{ package_name }}/setup.py - it is assumed that the project will run on the latest versions of Python 2 and 3, so you should remove any classifiers that do not apply. The full list of PyPI classifiers can be found here.

Fill out the README, and - if necessary - choose a license for the project.

Explanation

The decisions cookiecutter-pypackage-minimal makes should all be explained here.

README

  • README should use reStructuredText format This is the format used by most Python tools, is expected by setuptools, and can be used by Sphinx.
  • As few README files as possible Additional README files (AUTHORS, CHANGELOG, etc) should be left to the user to create when necessary.

LICENSE

  • MIT license by default This template provides you the classic MIT licence: it lets people do almost anything they want with your project, including to make and distribute closed source versions. If you choose another license, you also need to update the {{ package_name }}/setup.py file: adjust the classifiers and license fields accordingly.
  • A license is a requirement Nowadays, people who want to use your library/application want to make sure they can do it legally. If your library is a private library, you can use a private license. In the {{ package_name }}/setup.py file, set license="Proprietary", and choose 'License :: Other/Proprietary License' in the trove classifiers.

setup.py

  • Use setuptools It's the standard packaging library for Python. distribute has merged back into setuptools, and distutils is less capable.
  • setup.py should not import anything from the package When installing from source, the user may not have the packages dependencies installed, and importing the package is likely to raise an ImportError.
  • setup.py should be the canonical source of package dependencies There is no reason to duplicate dependency specifiers (i.e. also using a requirements.txt file). See the testing section below for testing dependencies.

Testing

  • Use Tox to manage test environments Tox provides isolation, runs tests across multiple Python versions, and ensures the package can be installed.
  • Uses pytest as the default test runner This can be changed easily, though pytest is a easier, more powerful test library and runner than the standard library's unittest.
  • Define testing dependencies in tox.ini Avoid duplicating dependency definitions, and use tox.ini as the canonical description of how the unittests should be run.
  • tests directory should not be a package The tests directory should not be a Python package unless you want to define some fixtures. But the best practices are to use PyTest fixtures which provides a better solution. Therefore, the tests directory has no __init__.py file.

More Repositories

1

json-sempai

Use JSON files as if they are python modules
Python
1,253
star
2

tor-controller

Run Tor onion services on Kubernetes
Go
534
star
3

python-etcd3

Python client for the etcd API v3
Python
422
star
4

anyprint

Use any* language's print statements in Python
Python
403
star
5

omochabako

Toy container runtime, capable of running docker images
Python
67
star
6

pam-2fa-scream

Highly secure second factor auth by screaming at your computer.
C
17
star
7

typejudge

Automated semver compliance based on type hints
Python
16
star
8

whalie

Jimble your while loops.
Python
15
star
9

python-pixiv

Pixiv API client for python
Python
13
star
10

tor-ingress-controller

An ingress controller to expose kubernetes services as onion services on the tor network
Go
12
star
11

reddit-auto-respond

Responds to privates messages on reddit
Python
11
star
12

doot

💀 t̷h͝e̴ s̶ke̡l͜tal͞ 💀 of ke̢rn̕e͢l 💀
C
10
star
13

nixbot

Python
8
star
14

configuration.nix

NixOS configuration files
Nix
8
star
15

CMPS10

Arduino library for the CMPS10 compass
C++
5
star
16

toot

Mastodon API client for Go
Go
5
star
17

inidiff

Find the differences between two ini files
Python
4
star
18

dot-files

Some config files
Perl
4
star
19

librowind

C library for the RO Wind sensor
C
4
star
20

amnesiafs

C
3
star
21

containers

Easily manipulate app containers
Python
2
star
22

soilmaker

Makes pictures of soil
Python
2
star
23

anon-ircd

Python
2
star
24

comfc

The comfy compositor
C
2
star
25

lode

Tiny and minimalistic logging utility module
Python
2
star
26

java-player

Mirror of the javaclient3 branch of java-player
Java
2
star
27

hyoki

Go
2
star
28

christmas-eval

Python
2
star
29

piebook

A small console-based ebook reader written in python
Python
2
star
30

computing

Random stuff with python
Python
1
star
31

github-setup-irc-notifications

Configure all repositories in an organization with irc notifications
Python
1
star
32

musc

Small music playing server
Python
1
star
33

fpc-stuff

some rather rancid fpc projects
Pascal
1
star
34

betamax-yaml-serializer

YAML serializer for betamax
Python
1
star
35

gpsts

Attempts to sync system and GPS time
Python
1
star
36

m8

1
star
37

pypmon

ip address monitor
Python
1
star
38

mushroom

Mirror of https://git.sr.ht/~kragniz/mushroom
C
1
star
39

llgc

Python
1
star
40

nyaa-scrobble

Scrobbles music from nyaa-radio
Python
1
star
41

prettytable

Automatically exported from code.google.com/p/prettytable
Python
1
star
42

sails-fedora

1
star
43

wch

Small mplayer wrapper which allows restarting from the episode last watched
Python
1
star
44

proxy

Go
1
star
45

hexogen

tile based declarative texture synthesis
Python
1
star
46

sudoku-solver

Simple non-backtracking sudoku solver
Java
1
star
47

pygamebook

Makes nice looking game books
Python
1
star
48

pixiv-bot-demo

Python
1
star
49

pychi

py can has internet - check if this machine is connected to the world wide web
Python
1
star
50

nduko

n by n suduko
Python
1
star