API Reference

Changed in version 0.3.0: All methods now take and return github3.py objects in place of their PyGithub counterparts.

octocheese.__main__

Entry points when running as a script.

Functions:

run(github_token, github_username, …[, …])

Helper function for when running as script or action.

run(github_token, github_username, repo_name, pypi_name, self_promotion=True, max_tags=- 1)[source]

Helper function for when running as script or action.

Parameters
  • github_token (Secret) – The token to authenticate with the GitHub API with. See https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token for instructions on generating a token.

  • github_username (str) – The username of the GitHub account that owns the repository.

  • repo_name (str) – The name of the GitHub repository.

  • pypi_name (str) – The name of the package on PyPI.

  • self_promotion – Show information about OctoCheese at the bottom of the release message. Default True.

  • max_tags (int) – The maximum number of tags to process, starting with the most recent. Set to -1 to process all tags. Default -1.

Changed in version 0.1.0: Added the self_promotion option.

Changed in version 0.3.0: Added the max_tags option.

octocheese.colours

Functions for printing coloured text.

Functions:

error(text)

Prints the given text in red to stderr.

success(text)

Prints the given text in green to stdout.

warning(text)

Prints the given text in yellow to stderr.

error(text)[source]

Prints the given text in red to stderr.

Parameters

text (str) – The text to print.

success(text)[source]

Prints the given text in green to stdout.

Parameters

text (str) – The text to print.

warning(text)[source]

Prints the given text in yellow to stderr.

Parameters

text (str) – The text to print.

octocheese.core

The main logic of octocheese.

Functions:

copy_pypi_2_github(g, repo_name, …[, …])

The main function for OctoCheese.

make_release_message(name, version, release_date)

Create a release message.

update_github_release(repo, tag_name, pypi_name)

Update the given release on GitHub with the new name, message, and files.

copy_pypi_2_github(g, repo_name, github_username, *, changelog='', pypi_name=None, self_promotion=True, max_tags=- 1, traceback=False)[source]

The main function for OctoCheese.

Parameters
  • g (GitHub)

  • repo_name (str) – The name of the GitHub repository.

  • github_username (str) – The username of the GitHub account that owns the repository.

  • changelog (str) – Default ''.

  • pypi_name (Optional[str]) – The name of the project on PyPI. Default The value of repo_name.

  • self_promotion – Show information about OctoCheese at the bottom of the release message. Default True.

  • max_tags (int) – The maximum number of tags to process, starting with the most recent. Set to -1 to process all tags. Default -1.

  • traceback (bool) – Show the full traceback on error. Default False.

Changed in version 0.1.0: Added the self_promotion option.

Changed in version 0.3.0:
  • Added the optional max_tags option.

  • Added the optional traceback parameter.

make_release_message(name, version, release_date, changelog='', self_promotion=True)[source]

Create a release message.

Parameters
  • name (str) – The name of the software.

  • version (Union[str, float]) – The version number of the new release.

  • release_date (date) – The date of the release.

  • changelog (str) – Optional block of text detailing changes made since the previous release.

  • self_promotion – Show information about OctoCheese at the bottom of the release message. Default True.

Return type

str

Returns

The release message.

Changed in version 0.1.0: Added the self_promotion option.

update_github_release(repo, tag_name, pypi_name, changelog='', self_promotion=True, file_urls=(), traceback=False)[source]

Update the given release on GitHub with the new name, message, and files.

Parameters
  • repo (Repository)

  • tag_name (str)

  • pypi_name (str) – The name of the project on PyPI.

  • changelog (str) – The changelog entry for the release. Default ''.

  • self_promotion (bool) – Show information about OctoCheese at the bottom of the release message. Default True.

  • file_urls (Union[Iterable[str], Iterable[FileURL]]) – The files to download from PyPI and add to the release. Either the files URLs themselves, or mappings giving the URL and its sha256 checksum. Default ().

  • traceback (bool) – Show the full traceback on error. Default False.

Return type

Release

Returns

The release, and a list of URLs for the current assets.

Changed in version 0.3.0: Now takes a very different set of parameters to the previous version. Please read the current documentation carefully.