Here's a Python project template I think of. I have never actually formed a team to develop a project, so I don't know the site. ** Please let us know if you have any suggestions.
First is the structure of the directory. The name when importing with Python will be modulename. There is no need to prepare build or venv, but build is created to encourage the use of setup.py, and venv is created to encourage the use of virtualenv. You may write these in the README.md.
Direcotry
Project\
modulename\
hoge.py
build\
test\
test_hoge.py
docs\
venv\
requirements.txt
setup.py
LICENCSE
README.md
MANIFEST.in
requirements.txt Let's export the development environment to requirements.txt.
pip3 freeze > requirements.txt
# install : pip3 install -r requirements.txt
setup.py
setup.py
#!/usr/bin/env python3
# coding:utf-8
from setuptools import setup
setup(name='Hoge_Project',
version='0.0.1',
description='Python Hoge_Project.',
author='spam',
author_email='[email protected]',
url='http://hoge.com',
packages=['modulename'],
#install_requires=['hoge','spam','hoge_spam'],
)
MANIFEST.in Since hatchinee pointed out, I will add it. If you use setup.py when packaging, by default only the python source files will be added. Therefore, when packaging, files other than python must be explicitly specified.
#Packaging
python setup.py sdist
#or
python setup.py bdist_wheel
MANIFEST.in
include MANIFEST.in
include *.txt
# Top-level
include setup.py README.md LICENCSE
# All-source file
recursive-include modulename *
# All documentation
recursive-include docs *
# Exclude what we don't want to include
global-exclude *.pyc *~ *.bak *.swp *.pyo
It's easy, but that's it.
Recommended Posts