Forge Activity (rever.activities.forge)

Activity for updating a forge feedstock.

class rever.activities.forge.Forge(*, deps=frozenset({'push_tag', 'tag'}), **kwargs)

Updates a forge feedstock.

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

$FORGE_FEEDSTOCK

str or None, feedstock name or URL, default $PROJECT-feedstock.

$FORGE_PROTOCOL

str, one of 'ssh', 'http', or 'https' that specifies how the activity should interact with github when cloning, pulling, or pushing to the feedstock repo. Note that 'ssh' requires you to have an SSH key registered with github. The default is 'ssh'.

$FORGE_SOURCE_URL

str, the URL that the recipe will use to download the source code. This is needed so that we may update the hash of the downloaded file. This string is evaluated with the current environment. Default 'https://github.com/$GITHUB_ORG/$GITHUB_REPO/archive/$VERSION.tar.gz'.

$FORGE_HASH_TYPE

str, the type of hash that the recipe uses, eg 'md5' or 'sha256'. Default 'sha256'.

$FORGE_PATTERNS

list or 3-tuples of str, this is list of (filename, pattern-regex, replacement) tuples that is evaluated inside of the recipe directory. This is similar to the version bump pattern structure. Both the pattern-regex str and the replacement str will have environment variables expanded. The following environment variables are added for this evaluation (only if $FORGE_USE_GIT_URL is False):

  • $SOURCE_URL: the fully expanded source code URL.

  • $HASH_TYPE: the hash type used to hash $SOURCE_URL.

  • $HASH: the hexdigest of $SOURCE_URL.

The default patterns match most standard recipes.

$FORGE_PULL_REQUEST

bool, whether the activity should open a pull request to the upstream conda-forge feestock, default True.

$FORGE_RERENDER

bool, whether the activity should rerender the feedstock using conda-smithy, default True.

$FORGE_FEEDSTOCK_ORG

str, specify the feedstock organization. Must be set.

$FORGE_FORK

bool, whether the activity should create a new fork of the feedstock if it doesn’t exist already, default True.

$FORGE_FORK_ORG

str, the org to fork the recipe to or which holds the fork, if '' use the registered gh username, defaults to ''

$FORGE_USE_GIT_URL

bool, whether or not to use git_url in the recipe source url, default True.

$FORGE_RECIPE_DIR

str, the name of the recipe folder, default is ‘recipe’.

Other environment variables that affect the behavior are:

$GITHUB_CREDFILE

the credential file to use. This should NOT be set in the rever.xsh file

$GITHUB_ORG

the github organization that the project belongs to.

$GITHUB_REPO

the github repository of the project.

$TAG_TEMPLATE

str, the template string used to tag the version, by default this is ‘$VERSION’. Used to download project source.

$PROJECT

the name of the project being released.

$REVER_CONFIG_DIR

the user’s config directory for rever, which is where the GitHub credential files are stored by default.

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()

Checks that we can rerender and login

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.

DEFAULT_HASH_TYPE = 'sha256'
DEFAULT_PROTOCOL = 'ssh'
DEFAULT_RECIPE_DIR = 'recipe'
property env_names

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

rever.activities.forge.get_feedstock_repo_name(feedstock)

Gets the name of the feedstock repository.

rever.activities.forge.get_feedstock_url(feedstock, feedstock_org, protocol='ssh')

Returns the URL for a forge feedstock.

rever.activities.forge.get_fork_url(feedstock_url, username, feedstock_org)

Creates the URL of the user’s fork.

rever.activities.forge.get_source_url(source_url)