Package object

class dependency_comb.package.PackageRequirement(source, environment=None)[source]

Bases: object

Package requirement object parse given requirement item to get relevant informations.

A package object information is fullfilled in two cycles, firstly the requirement parser that is done in PackageRequirement itself then with the data collection and computation from the Analyzer. When parsing has failed, all attributes depending from collection and computation will be None.

Parameters:

source (string) – A requirement line to parse.

Keyword Arguments:

environment (dict) – Optionnal dictionnary of environment variables to use with possible specifier marker resolution.

source

Given requirement source. The source string is expected to be stripped from leading whitespaces else it could causes unexpected parsing false positive.

Type:

string

environment

Given environment dictionnary

Type:

dict

status

Computed requirement status from parsing process. Status can be:

  • parsed: requirement has been properly parsed as supported syntax;

  • analyzed: requirement has been parsed and has been processed by the Analyzer;

  • unsupported-argument: unsupported Pip argument, aborted parsing;

  • unsupported-localpath: unsupported local path to package, aborted parsing;

  • unsupported-url: unsupported package url, aborted parsing;

  • invalid: invalid requirement syntax (as from PEP425 and PEP440), aborted computation from parsed source;

  • marker-reject: Requirement did have marker that does not match required environment variables when given, aborted computation from parsed source;

Commonly to get all valid requirements that have been properly analyzed, you will just seek for items with status analyzed. parsed status should never occurs when analyzer has been involved.

Type:

string

marker

Marker object parsed from source.

Type:

packaging.markers.Marker

name

Package name parsed from source.

Type:

string

parsed

Requirement object parsed from source.

Type:

packaging.requirements.Requirement

pypi_url

Possible package URL collected from API after the parsed source.

Type:

string

repository_url

Possible repository URL collected from API after the parsed source.

Type:

string

highest_published

Date of the highest release version available on Pypi.

Type:

datetime.datetime

highest_version

Collected highest release version available on Pypi.

Type:

packaging.version.Version

lateness

List of tuples of version string and datetime for each released version that are higher than the resolved version. This means all available package versions that could upgraded to.

Type:

list

resolved_version

Resolved release version from specifiers in parsed source. Specifiers are used against collected release version available on Pypi. This value will be null if no specifier can be found. Internally a null value is assumed the requirement can use the latest version and so there is no lateness to compute.

Type:

string

resolved_published

Date of the resolved release.

Type:

datetime.datetime

specifier

Possible version specifiers parsed from source.

Type:

packaging.requirements.SpecifierSet

url

Possible mirror URL parsed from source.

Type:

string

extras

Possible parsed set of extras environ names from source.

Type:

set

parsing_error

The exception object raise from packaging.Requirement when there was a parsing error.

Type:

object

property is_valid

Express if package has been properly parsed and result to a proper package and not unsupported or invalid parsed rule.

data()[source]

Return public attributes into a dictionnary.

Returns:

The public attributes to publish.

Return type:

dict