🐛 Differentiate transitive dependencies from direct third-party deps versus local deps

Abierto
#54 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
42/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
tooling

Línea de trabajo

Comienza en parse_requirements y usa el ejemplo proporcionado test_nested_deps para rastrear cómo se clasifican las dependencias directas, transitivas, de terceros y de módulos locales. El trabajo estará terminado cuando pasen las aserciones esperadas de requirements y extras_require, y PyYaml permanezca en los requirements comunes en lugar de en los extras del módulo anidado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

stage/010-actionable stage/stalled

Describe the bug

A clear and concise description of what the bug is.
😆

Ok, this one is gross: With the fix in #49, a direct dependency held on a parent module that was also held on a child module would be correctly placed into the common dependency set because it is needed directly by the parent. This is, unfortunately, only a first-order fix since this same situation can occur when the dependency is needed by a Third Party dependency held directly by the parent rather than a local child sub-module.

This is only a problem if the requirements list given to parse_requirements includes the transitive dependency that is only used by the Third Party dependency and is NOT used anywhere inside of the local library. This is a very unlikely circumstance, but it could conceivably arise if the Third party dependency has an open version range for the transitive dependency, but the local library needs to pin that version for some valid reason (like a security patch)..

Platform

Please provide details about the environment you are using, including the following:

  • Interpreter version:
  • Library version:

Sample Code

def test_nested_deps():
    """Make sure that direct depencencies show up in requirements
    for nested modules
    """
    requirements, extras_require = parse_requirements(
        ["sample_lib", "PyYaml", "alchemy-logging"],
        "direct_dep_nested",
        ["direct_dep_nested.nested", "direct_dep_nested.nested2"]
    )

Expected behavior

The PyYaml dependency should be in the common requirements because it's needed transitively by sample_lib which is needed directly by the top-level direct_dep_nested module.

assert requirements == sorted(["alchemy-logging", "sample_lib"])
assert extras_require == {
    "all": sorted(["sample_lib", "PyYaml", "alchemy-logging", "PyYaml"]),
    "direct_dep_nested.nested": [],
    "direct_dep_nested.nested2": [],
}

Observed behavior

The PyYaml dependency is placed into the extras for direct_dep_nested.nested because it's held as an extra set and PyYaml is not allocated as a direct dependency of the top-level direct_dep_nested module.

assert requirements == sorted(["alchemy-logging", "sample_lib"])
assert extras_require == {
    "all": sorted(["sample_lib", "PyYaml", "alchemy-logging"]),
    "direct_dep_nested.nested": ["PyYaml"],
    "direct_dep_nested.nested2": [],
}

Additional context

Discovered when trying to write a test case for https://github.com/IBM/import-tracker/pull/53 with @prashantgupta24

Lenguaje dominante
Python
Estrellas
460
Forks
17
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de IBM/import-tracker

Todos los issues de IBM/import-tracker

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.