Profile reference

class nusex.api.Profile(name: str, **kwargs: str | None)

A class representing a profile.

All keyword arguments are different attributes which nusex will use when deploying templates. They all default to None if not passed.

Parameters

name (str) – The name of the profile.

Keyword Arguments
  • author_name (str | None) – The name with which you wish to be attributed in new projects. This should be your real name, a nickname, or your organisation’s name.

  • author_nick (str | None) – The username you normally use for services related to your development projects.

  • author_email (str | None) – The email address through which users can contact you or your organisation.

  • preferred_language (str | None) – The language you would normally be developing with when using this profile.

  • preferred_license (str | None) – The license you would normally use when using this profile. When deploying a template nusex will use this as a key, and attempt to resolve it against a list of open-source licenses.

  • starting_version (str | None) – The version to deploy templates with. By default nusex will use this value as-is, but if you set this to “CALVER” nusex will use the current date in YYYY.MM.DD format when deploying the template.

  • version_control_url (str | None) – The URL of your version control host (i.e. GitHub), including your username. By default nusex will append the name of the project to the end of this URL when deploying, but you can override this behaviour by including “PROJECTNAME” anywhere in this URL.

  • docs_url (str | None) – The URL of the documentation hosting service you normally use. Different documentation hosting services handle URLs differently – by default nusex will append the name of the project to the end of the URL, but you can override this behaviour by inserting “PROJECTNAME” anywhere in the URL. If you use ReadTheDocs for example, you will need to do this.

  • ci_url (str | None) – The URL of the continuous integration suite you normally use. By default nusex will append the name of the project to the end of this URL when deploying, but you can override this behaviour by including “PROJECTNAME” anywhere in this URL.

copy(*, name: str | None = None) Profile

Create a new instance of this profile with the same attributes.

Keyword Arguments

name (str | None) – The name to attribute to the copy. If this is None, “_copy” will be appended to the name. Defaults to None.

Returns

The copied profile.

Return type

Profile

delete(*, missing_ok: bool = False) Path | None

Delete this profile from disk.

Keyword Arguments

missing_ok (bool) – Whether to ignore errors upon a missing profile. If this is False, an FileNotFoundError error will be raised if the profile has not been saved. Defaults to False.

Returns

A pathlib.Path object with the full path to the profile, or None if it was not saved.

Return type

pathlib.Path

classmethod from_disk(name: str, *, from_dir: Path | str) Profile

Load a saved profile.

Parameters

name (str) – The name of the profile to load.

Keyword Arguments

from_dir (pathlib.Path | str) – The directory to load the profile from.

Returns

A profile instance.

Return type

Profile

property path: Path | None

The filepath to this profile. This is None if the profile has not been saved.

Returns

The filepath to this profile, or None is this profile has not been saved.

Return type

pathlib.Path

save(*, to_dir: Path | str, overwrite: bool = False) Path

Save this profile to disk.

Keyword Arguments
  • to_dir (pathlib.Path, str) – The directory to save the profile to.

  • overwrite (bool) – Whether to overwrite an existing profile. If this is False, an FileExistsError error will be raised if a profile with the same name already exists. Defaults to False.

Returns

A pathlib.Path object with the full path to the profile.

Return type

pathlib.Path

to_dict() dict[str, str | None]

Export this profile’s attributes to a dict object.

Returns

This profile’s attributes, with the attribute name as the key, and the attribute value as the value.

Return type

dict [str, str | None]