Automate the creation of new Python projects.
- Virtual environment (pipenv) with dev packages installed
- Git repository with
.gitignoreand an initial commit - Package directory with
__init__.pyand__main__.py(if not--lib) - Basic
setup.py Readme.mdandLICENSE(choose from 10 available, default is MIT)- Default license and dev packages can be set on the configuration file
I recommend installing with pipsi, but pip is also ok.
~ $ pipsi install pynewUsage: pynew [OPTIONS] PROJECT_NAME
Create a new Python project
Options:
--lib Create a library instead of an executable
-l, --license Specify license to be used. Default: mit
--help Show this message and exit.~ $ pynew example-project
Initializing virtual environment...
Installing dev packages...
Created project at example-project
~ $ exa -T example-project
example-project
├── example_project
│ ├── __init__.py
│ └── __main__.py
├── LICENSE
├── Pipfile
├── Pipfile.lock
├── README.md
└── setup.py
~ $ cat example-project/setup.py
from setuptools import setup, find_packages
setup(
name='example_project',
version='0.1.0',
packages=find_packages(),
install_requires=[],
entry_points='''
[console_scripts]
example-project=example_project.__main__:main
''',
)agpl-3.0apache-2.0bsd-2-clausebsd-3-clauseepl-2.0gpl-2.0gpl-3.0lgpl-2.1lgpl-3.0mitmpl-2.0unlicense
You can create the configuration file at $XDG_CONFIG_HOME/pynew/config.json (~/.config/pynew/config.json).
{
"user_name": "default: git config --get user.name",
"default_license": "mit",
"default_version": "0.1.0",
"dev_packages": ["flake8", "autopep8"]
}