tsfpga.tools package


tsfpga.tools.sphinx_doc module

class tsfpga.tools.sphinx_doc.Release(repo: Repo, release_notes_file: Path)

Bases: object

Used to represent a release.

__init__(repo: Repo, release_notes_file: Path) None
static get_git_date_from_tag(repo: Repo, tag: str) str

Get a formatted date string, gathered from git log based on tag name.

tsfpga.tools.sphinx_doc.build_sphinx(build_path: Path, output_path: Path) None

Execute sphinx on command line to build HTML documentation.

  • build_path – The location that contains conf.py and index.rst.

  • output_path – Where to place the generated HTML.

tsfpga.tools.sphinx_doc.generate_release_notes(repo_root: Path, release_notes_directory: Path, project_name: str) str

Generate release notes in RST format based on a directory full of release note files. Will match each file to a git tag.

  • repo_root – Git commands will be executed here.

  • release_notes_directory – Location of release notes files.

  • project_name – Name of project will be used for the GitHub link.


RST code with release notes.

tsfpga.tools.version_number_handler module

class tsfpga.tools.version_number_handler.VersionNumberHandler(repo: Repo, version_file_path: Path)

Bases: object

Class for handling the version number in __init__.py.

__init__(repo: Repo, version_file_path: Path) None
  • repo – The git repository to work with.

  • version_file_path – The __init__.py file that shall be modified.

bump_to_prelease() None

Bump to next version number. E.g. go from 8.0.2 to 8.0.3-dev.

update(new_version: str) None

Set a new version number.


new_version – New version number as a string, e.g. “2.3.1”.

tsfpga.tools.version_number_handler.commit_and_tag_release(repo: Repo, version: str, git_tag: str) None

Make a git commit with a “release” message, and tag it.

  • repo – The git repository to work with.

  • version – New version.

  • git_tag – New git tag.

tsfpga.tools.version_number_handler.make_commit(repo: Repo, commit_message: str) None

Make a git commit, and check that it worked.

  • repo (git.Repo) – The git repository to work with.

  • commit_message (str) – Commit message to use.

tsfpga.tools.version_number_handler.verify_new_version_number(repo: Repo, pypi_project_name: str, new_version: str, unreleased_notes_file: Path) str

Verify that the new version number is sane for this project. Will check git log and PyPI release history.

  • repo – The git repository to work with.

  • pypi_project_name – The name of this project on PyPI.

  • version – New version.

  • unreleased_notes_file – Path to the “unreleased.rst” release notes file. Must not be empty.


The name of the git tag that corresponds to the new version number.