pynamer.builder

Collection of functions to build a minimal package and publish on PyPI.

Functions

create_setup(→ None)

Utility script to create a setup.py file.

rename_project_dir(→ None)

Utility script to rename a directory.

delete_director(→ None)

Utility function to delete files and directories.

cleanup(→ None)

Builds a manifest of artifacts to delete into a list of Path objects.

run_command(→ None)

Utility designed to execute a command line utility.

upload_dist(→ None)

Builds the twine command line to upload the minimalist project to PyPI.

build_dist(→ None)

Builds the sdist and wheel of the minimalist project to upload to PyPI.

Module Contents

pynamer.builder.create_setup(new_project_name: str, new_meta: bool = False) None[source]

Utility script to create a setup.py file.

The object being to create a setup.py file from a ‘template’ file for the purpose of creating a minimalist package for upload to PyPI.

Parameters:
  • new_project_name – name used to render the template.

  • new_meta – generate new package metadata.

pynamer.builder.rename_project_dir(old_name: str, new_name: str) None[source]

Utility script to rename a directory.

The object being to rename a ‘template’ directory for the purpose of creating a minimalist package for upload to PyPI.

Parameters:
  • old_name – source name.

  • new_name – dst name.

Raises:

FileNotFoundError

pynamer.builder.delete_director(items_to_delete: Any) None[source]

Utility function to delete files and directories.

Parameters:

items_to_delete – A list of Path like objects to delete.

pynamer.builder.cleanup(project_name: str) None[source]

Builds a manifest of artifacts to delete into a list of Path objects.

Parameters:

project_name – the name of the project currently under test.

pynamer.builder.run_command(*arguments: str, shell: bool = True, working_dir: pathlib.Path | str | None = None, project: None | str = None) None[source]

Utility designed to execute a command line utility.

Parameters:
  • arguments – Comma separated strings- “utility”, “arg1”, “arg2”, etc.

  • shell – command executed by the shell or directly by the operating system.

  • working_dir – specifies the current working directory to use when starting the subprocess. e.g. “/home/user/mydir”

  • project – the name of the project currently being tested

pynamer.builder.upload_dist(project_name: str) None[source]

Builds the twine command line to upload the minimalist project to PyPI.

Parameters:

project_name – the name of the project currently under test.

Notes

twine expects a filesystem path not Path object so use os.fspath()

pynamer.builder.build_dist() None[source]

Builds the sdist and wheel of the minimalist project to upload to PyPI.