Python Package Index Activity (rever.activities.pypi)

Activity for uploading to the Python Package Index.

class rever.activities.pypi.PyPI(*, deps=frozenset({'version_bump'}))

Uploads a package to the Python Package Index.

The behaviour of this activity may be adjusted through the following environment variables:

$PYPI_RC

str, path to the pypirc file, default ~/.pypirc.

$PYPI_BUILD_COMMANDS

list of str, The commands to run in setup.py that will build the project, default ['sdist']. Other examples include 'bdist' or 'bdist_wininst'.

$PYPI_UPLOAD

bool, whether or not to upload PyPI, default True.

$PYPI_NAME

str or None, The name of the package on PyPI. If None, This will default to the result of python setup.py --name

$PYPI_SIGN

bool or None, whether the packages should be signed (with gpg) when uploaded. If None (default), packages will be signed if a gpg key is available and skipped otherwise.

Other environment variables that affect the behavior are:

$PYTHON

the path to the Python interpreter.

Parameters
namestr, optional

Name of the activity.

depsset of str, optional

Set of activities that must be completed before this activity is executed.

funccallable, optional

Function to perform as activity when this activities is executed (called).

undocallable, optional

Function to undo this activities behaviour and reset the repo state.

setupcallable, optional

Function to help initialize the activity.

checkcallable, optional

Function to check if the activity can be run sucessfully on the user’s machine, with their credentials, etc. This function should return True if the activity can be run, and False otherwise.

requiresdict or None, optional

A dict of dicts of the following form that specifies the command line utility and import requirements for this activity.

{
    "commands": {"<cli name>": "<package name>", ...}
    "imports": {"<module name>": "<package name>", ...}
}

The top-level keys are both optional, and this will default to an empty dict.

argstuple, optional

Arguments to be supplied to the func(*args), if needed.

kwargsmapping, optional

Keyword arguments to be supplied to the func(**kwargs), if needed.

descstr, optional

A short description of this activity

all_kwargs()

Returns all kwargs for this activity.

check()

Calls this activity’s check() function.

check_func()
check_requirements()

Checks that an activities requirements are actually available.

checker(check)

Decorator that sets the check function for this activity.

clear_kwargs_from_env()

Removes kwarg from the environment, if they exist.

kwargs_from_env()

Obtains possible func() kwarg from the environment.

setup()

Calls this activity’s setup() initialization function.

setupper(setup)

Decorator that sets the setup function for this activity.

undo()

Reverts to the last instance of this activity. This default implementation uses the revision in the log file from the last time that the activity was started. This may be overridden in a subclass.

undoer(undo)

Decorator that sets the undo function for this activity.

property env_names

Dictionary mapping parameter names to the names of environment varaibles that the activity looks for when it is executed.

rever.activities.pypi.create_rc(rc, username=None, password=None)

Creates a pypirc file.

rever.activities.pypi.validate_rc(rc)

Validate a pypirc file, returns True/False and a message