MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / DependentPackage

Class DependentPackage

src/packagedcode/models.py:332–395  ·  view source on GitHub ↗

An identifiable dependent package package object.

Source from the content-addressed store, hash-verified

330
331@attr.attributes(slots=True)
332class DependentPackage(ModelMixin):
333 """
334 An identifiable dependent package package object.
335 """
336
337 purl = String(
338 repr=True,
339 label='Dependent package URL',
340 help='A compact purl package URL. Typically when there is an '
341 'unresolved requirement, there is no version. '
342 'If the dependency is resolved, the version should be added to '
343 'the purl')
344
345 extracted_requirement = String(
346 repr=True,
347 label='extracted version requirement',
348 help='String for the original version requirements and constraints. '
349 'Package-type specific and as found originally in a datafile.')
350
351 # ToDo: add `vers` support. See https://github.com/nexB/univers/blob/main/src/univers/version_range.py
352
353 scope = String(
354 repr=True,
355 label='dependency scope',
356 help='The scope of this dependency, such as runtime, install, etc. '
357 'This is package-type specific and is the original scope string.')
358
359 is_runtime = Boolean(
360 default=True,
361 label='is runtime flag',
362 help='True if this dependency is a runtime dependency.')
363
364 is_optional = Boolean(
365 default=False,
366 label='is optional flag',
367 help='True if this dependency is an optional dependency')
368
369 is_pinned = Boolean(
370 default=False,
371 label='is pinned flag',
372 help='True if this dependency version requirement has '
373 'been pinned and this dependency points to an '
374 'exact version.')
375
376 is_direct = Boolean(
377 default=True,
378 label='is direct flag',
379 help='True if this is a direct, first-level dependency, '
380 'defined in the manifest of a package. False if this '
381 'is an indirect, transitive dependency resolved from '
382 'first level dependencies.'
383 )
384
385 resolved_package = Mapping(
386 label='resolved package data',
387 help='A mapping of resolved package data for this dependent package, '
388 'either from the datafile or collected from another source. Some '
389 'lockfiles for Composer or Cargo contain extra dependency data.'

Callers

nothing calls this directly

Calls 3

StringFunction · 0.90
BooleanFunction · 0.90
MappingFunction · 0.90

Tested by

no test coverage detected