Naked is a brand new Python application framework that provides a wide range of features for command line application developers. This tutorial will demonstrate how to go from an empty directory to a complete directory structure with file stubs for development and distribution of a command suite application in under five minutes.
The Naked framework is distributed as a command line executable and a library of Python source files. You can install it with pip using the command:
or download the source, unpack it, and navigate to the top level directory. Then run:
The Naked Executable
The naked executable is run with the
naked command. There are a number of useful secondary commands that you can view with
naked --help. We will focus on
make command builds the directory tree and project files for a new Python project and can be configured with a simple YAML settings file.
The file and directory structure for command line parsing logic, command development, testing, profiling/benchmarking, licensing, application documentation, and deployment are included in the new project. Help, version, and usage command handling is automatically implemented for you. This eliminates many of the setup tasks for a new project and should allow you to start coding pronto.
How to Create a Python Project from a YAML File
The syntax of the Naked YAML settings file is:
1 2 3
Here’s an example of my
naked.yaml file from status :
1 2 3
Save this file as
naked.yaml in the directory where you would like to create your project directories. Then navigate into the directory to make it your working directory and run:
Naked will prompt you to confirm your project settings. Here is the prompt screen that I received when I created status:
1 2 3 4 5 6 7 8 9 10 11 12
If your settings are correct, enter ‘y’ and your project is generated in the same directory with the following structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
LICENSE file was populated with the complete text of my MIT license, including the copyright statement and the current year. The
setup.py file is set to automatically import my version number from the
settings.py file and to populate the long description of the project from the
README.rst reStructuredText file in the docs directory (which gets pushed to PyPI as your project description). The
app.py file is the main application script and it is fully tricked out to handle help, version, and usage command parsing. I simply added the text that will be displayed to the user for each of these requests in the
settings.py file as definitions of the respective string variables.
setup.py file is generated in such a way that, when installed on a user’s system (or on your own with a develop install — see below), my project name can be used as the executable:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
In order to begin testing your new project, enter the following in the top level directory that contains your
And in under 5 minutes, you can begin coding and testing your application without the need to manually address these common setup tasks.
Naked is a large project and both the executable as well as the Naked toolshed library contain many more helpful features for command line application developers.
The documentation is available at http://docs.naked-py.com if you’d like to learn more.