Introduction¶
Requisites¶
autopilot requires Python >= 3.5
Installation¶
pip install autopilot
Basic usage¶
Autopilot provides 2 commands, new
and release
. You can call them from
the command line:
$ ap new
$ ap release
ap new
command creates a new project. You can pass optionally the new
project name:
$ ap new cool-project
ap release
creates a new release for a project. If you want to upload it to
a PyPI server, you need to create a configuration file to tell autopilot which
are your username and password. See next section for more info.
Configuration¶
We choose the yaml format for the configuration. This is the default configuration file:
author: name: '' # Take it from git config if empty email: '' # Take it from git config if empty new_project: default_dir: '' # Uses current working directory license: gplv2 commit: true # Do the initial commit? editor: '' # Use $EDITOR, fallback to vim release: upload: PyPI push: true pypi_servers: PyPI: user: '' passeval: '' # Executable command url: 'https://pypi.python.org/pypi' PyPI Test: user: '' passeval: '' # Executable command url: 'https://testpypi.python.org/pypi'
For some options, if they are empty, autopilot will try to fill the data with information from your system, see comments in the default configuration file.
It is possible to override the default configuration. To do it, create a file
at XDG_CONFIG_HOME/autopilot/config.yml
(or ~/.config/autopilot/config.yml
if XDG_CONFIG_HOME
is not defined). You can override just some of the
options. For every option, the logic is to look for the option in the user
configuration file, if it’s not there, search in autopilot default
configuration, and if the option has an empty value, try to get the value from
the system.
An example of a custom configuration file:
new_project:
license: mit
editor: vim -R
release:
upload: nope
push: false
pypi_servers:
pypi:
user: my_pypi_user
passeval: pass pypi
local devpi:
user: devpi_user
passeval: pass devpi_local
url: 'http://localhost:8080'
As you see, is possible to add more servers to pypi_servers
. In this
example, a new PyPI server (local devpi
) would be added to the list of
options on the UI.
Version handling¶
According to PEP 396, the version should
be available in the __version__
attribute, should be a string, and have
only one source and all the others should be derived from it.
When you do a new release, with the ap release
command, autopilot will
generate two new version numbers, the number for the release you are doing, and
the next development version.
For the new release number, autopilot just remove the pre-release part from the
version number. For example, if your current version is 1.0.0a1
or
1.0.0.dev0
, the next version number will be 1.0.0
.
For the next development version number, autopilot just increments the minor
number of the release and adds a .dev0. For example, if you are going to
release version 1.0.0
, your next development version will be
1.0.1.dev0
.
The new version numbers generated by autopilot are just a suggestion, you can always change the version numbers through the user interface. If you update the version number manually, autopilot will check that the number is a valid number according to PEP 440
Also notice that when you update your release version number, autopilot will automatically update the next development version number.
Command line options¶
You can append –help to any command to get a description of the command.
$ ap --help
Usage: ap [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
--help Show this message and exit.
Commands:
new Creates a new project
release Releases a new version
$ ap new --help
Usage: ap new [OPTIONS] [PROJECT_NAME]
Creates a new project
Options:
--help Show this message and exit.
$ ap release --help
Usage: ap release [OPTIONS]
Releases a new version
Options:
--no-master By default, releases are allowed only from
`master` branch. This option disables that check
--type [major|minor|patch] Release type [default: patch]
--help Show this message and exit.
The --type
option is used to generate the next version number, but you can
always modify this number on the ncurses interface, before the new release is
created.