GitXplorerGitXplorer
c

pynew

public
1 stars
0 forks
1 issues

Commits

List of commits on branch master.
Unverified
da741e7ecc0b3543af7d510ebeef1e87a9be7cf2

Fixed config for people with XDG_CONFIG_HOME unset

committed 7 years ago
Unverified
abb79600f09ccde08086b12152d50ddfdfd79445

Updated README.md to add installation from PyPI

committed 7 years ago
Unverified
f770d7f04f6b0180241d8d91bed2b4043985acee

Prepared setup.py for pypi upload

committed 7 years ago
Unverified
713d0b642afa3244512746798a0520be321e4b7b

Added example

committed 7 years ago
Unverified
5537d77da6a05c949effa8af84769205f2e80657

Improved documentation

committed 7 years ago
Unverified
f66a09de878d997c59ac9df146fa021811e2dda0

Initial commit

committed 7 years ago

README

The README file for this repository.

Pynew

Automate the creation of new Python projects.

  • Virtual environment (pipenv) with dev packages installed
  • Git repository with .gitignore and an initial commit
  • Package directory with __init__.py and __main__.py (if not --lib)
  • Basic setup.py
  • Readme.md and LICENSE (choose from 10 available, default is MIT)
  • Default license and dev packages can be set on the configuration file

Requirements:

Installation

I recommend installing with pipsi, but pip is also ok.

~ $ pipsi install pynew

Usage

Usage: 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.

Example

~ $ 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
    ''',
)

Available licenses

  • agpl-3.0
  • apache-2.0
  • bsd-2-clause
  • bsd-3-clause
  • epl-2.0
  • gpl-2.0
  • gpl-3.0
  • lgpl-2.1
  • lgpl-3.0
  • mit
  • mpl-2.0
  • unlicense

Configuration

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"]
}