You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package.UserDefinedMapping: Include source of mapping in Package objects
When accumulating a user-defined Package object from multiple files
(e.g. a [tool.fawltydeps.custom_mapping] section in pyproject.toml
together with a --custom-mapping-file=mapping.toml), include the
ultimate source of the mapping into the .debug_info member of the
Package object. This makes it easier to debug the source of these
user-defined meppings.
In other words, given a mapping.toml with:
apache-airflow = ["airflow"]
and a pyproject.toml with:
[tool.fawltydeps.custom_mapping]
apache-airflow = ["foo", "bar"]
we used to generate this Package object:
Package(
package_name="apache_airflow",
import_names={"airflow", "foo", "bar"},
resolved_with=UserDefinedMapping,
debug_info=None,
)
but with this commit we instead get:
Package(
package_name="apache_airflow",
import_names={"airflow", "foo", "bar"},
resolved_with=UserDefinedMapping,
debug_info={
"mapping.toml": {"airflow},
"from settings": {"foo", "bar"},
},
)
Also refactor the accumulate_mappings() helper out of the
UserDefinedMapping class as we will soon start to use it from
LocalPackageResolver as well.
0 commit comments