prometa.package.python package

Submodules

prometa.package.python.codemeta module

CodeMeta functions.

class prometa.package.python.codemeta.PyprojectCodeMeta(project)[source]

Bases: CodeMeta

Update CodeMeta files from pyproject.toml files.

modify_codemeta_data(codemeta_data)[source]

Modify the CodeMeta data. Override this method is a subclass to apply custom modifications.

Parameters:

codemeta_data – The input CodeMeta data.

Returns:

The possibly modified CodeMeta data.

update(version=None, cwd=None, venv=None)[source]

Update the CodeMeta file.

Parameters:
  • version – The version to set. This is sometimes necessary to force a version due to SCM incrementing the version for unclean directories.

  • cwd – The directory in which to run the codemeta command. If None, it will default to the parent directory of the target codemeta.json path.

  • venv – An instance of VirtualEnvironment with the context currently open. If None, a new instance will be created.

prometa.package.python.package module

Functionality for Python packages.

class prometa.package.python.package.PythonPackage(*args, **kwargs)[source]

Bases: Package

Functionality for Python packages.

__init__(*args, **kwargs)[source]
Parameters:

project – A Project instance.

property description[source]

The package description.

get_tool_configuration(tool)[source]

Attempt to get a tool’s configuration from the pyproject.tom file.

Parameters:

tool – The name of the tool, e.g. “black” or “isort”.

Returns:

The tool’s configuration if found, else None.

get_version()[source]

Get the version of a project from its directory.

This will create a temporary virtual environment and install the project in it to get the version. This ensures that VCS-versions are correctly handled.

This should not be necessary but at the time or writing the current version of CodeMetaPy fails to detect versions.

property is_valid[source]

True if the project appears to be a valid Python package.

An iterable of name-URL pairs to create relevant package links in the README.

property name[source]

The package name.

property pypi_url[source]

The URL to the project on PyPI.

property pyproject_toml_data[source]

The parsed pyproject.toml data. Internal caching is use to only reload the file when it is modified.

property pyproject_toml_path[source]

The path to the pyproject.toml file.

update()[source]

Update Python package metadata.

update_pyproject_toml()[source]

Update the URLs in a pyproject.toml file.

Parameters:

project – The Project instance.

Module contents

Package stub.