generator-python-cmd
v0.1.0
Published
Generator for a Python app with a command-line interface using cmd
Downloads
1
Maintainers
Readme
Python cmd App Generator
Yeoman generator for a Python app with a command-line interface using cmd
Installation
- Install Node.js.
- Run
npm install -g yo
to install Yeoman using npm. - Run
npm install -g generator-python-cmd
to install generator-python-cmd.
Usage
This readme covers the generator. See the README.md in your generated project for information on using the project's code.
Generating a Project
- Create a new directory for your project, and enter it.
- From the new project directory, run
yo python-cmd
to generate your new project. - Answer the questions at the prompts to customize your project.
- Run
pip install -r requirements-dev.txt
to install the project's initial development tools, such as Sphinx (see the next section).
Setting up Documentation
Your new project will be set up to use the automatic documentation generator Sphinx. If you stick with this option, you'll do the initial setup with Sphinx's own script.
- If you haven't already, install Sphinx using the
pip
command from the previous section. - Follow the Sphinx tutorial, except for the installation.
- If you run the
sphinx-quickstart
script from your project's root directory, set the "Root path for the documentation" todocs
. - I recommend saying
y
to at least the following extensions (these and other extensions described here):- autodoc - Lets you avoid maintaining duplicate documentation between your code and the Sphinx documents. Also lets you format your docstrings nicely.
- doctest - Tests all the code examples in your documentation, if you put them in doctest blocks.
- coverage - Checks whether your documentation covers your project's whole public API.
- viewcode - Links the documentation of each object to a highlighted version of the object's source code so users can easily examine its implementation.
Features
The generator creates
- an app.py script for running your application
- an in-app command-line prompt using the cmd library
- a setup.py script for optionally installing your application's package as a library
- a directory (renamed to your package name) to contain your application's package files
- a config directory to house the app's configuration files
- a tests directory for unit tests using nose2
- a docs directory to contain your documentation, ready to be set up by Sphinx
- a readme file to hold basic information on installing, using, and contributing to the project
- an MIT license file
- a Git ignore file
The generator puts all of that into the following folder structure:
.
|____config
|____docs
|____<package>
| |______init__.py
| |____cli.py
| |____config.py
| |____controller.py
|____tests
| |____context.py
| |____test.py
|____app.py
|____.gitignore
|____LICENSE.md
|____README.md
|____setup.py
Generators
Available generators:
- python-cmd (aka python-cmd:app)
App
Sets up a new Python cmd app, generating all the boilerplate you need to get started.
yo python-cmd
Options
There are currently no command-line options for the generator.
The prompts ask for the following information:
projectName
Default: [Name of project folder in title case and with non-word characters replaced by spaces]
The project name. Used in the documentation files and setup.py.
packageName
Default: [Name of project folder with non-word characters removed]
The package name. Used in app.py, test files, and setup.py.
projectDesc
Default: UNDEFINED
The project description. Used in the documentation files and setup.py.
author
Default: UNDEFINED
The author's name. Used in the documentation files and setup.py.
authorEmail
Default: UNDEFINED
The author's email address. Used in the documentation files and setup.py.
Roadmap
To the generator:
- Add configuration saving.
- Add command-line options.
- Add EditorConfig configuration for synchronizing coding style.
To the app templates:
- Enable app commands from the command line.
- Add user configuration.
- Add EditorConfig configuration for synchronizing coding style.
- Add pylama configuration for code linting.
- Switch to pytest for testing.
- Add Wheel configuration for packaging.
- Add conda configuration for package and environment management.
- Add pyup configuration for dependency management.
- Add Codecov configuration for code coverage reporting.
- Add Tox configuration for managing test environments.
- Add Travis CI configuration for automatic testing and deployment.
Contributing
See contributing.md to learn how to contribute to this project. Contributions include bug reports, feature requests, code, and documentation.
Changelog
See the Releases page for this project on GitHub.
Author
License
MIT © Andy Culbertson
For details see the LICENSE file.