Skip to content

Missing dist: package in appmap.yml raises PackageNotFoundError and stops the test run #387

Open

Description

@devin-ai-integration

Summary

If appmap.yml lists a dist: package that is not installed in the environment, the
agent raises importlib.metadata.PackageNotFoundError while loading the config. The
test run stops before any test executes and no recordings are written.

Environment

  • appmap (Python agent) 3.0.1
  • Python 3.10, Ubuntu, virtual environment
  • pytest

Steps to reproduce

mkdir repro && cd repro
python3 -m venv .venv
.venv/bin/pip install appmap pytest
mkdir demo tests
printf 'def f():\n    return 1\n' > demo/__init__.py
printf 'from demo import f\n\ndef test_f():\n    assert f() == 1\n' > tests/test_demo.py
cat > appmap.yml <<'YML'
name: demo
language: python
appmap_dir: tmp/appmap
packages:
- path: demo
- dist: requests
YML
.venv/bin/python -c "import requests"   # ModuleNotFoundError, requests is not installed
.venv/bin/appmap-python .venv/bin/python -m pytest -q
ls tmp/appmap/pytest

Expected

The tests run and demo is recorded. The missing distribution is reported, and the run
carries on without that entry.

Actual

  File ".../site-packages/_appmap/importer.py", line 198, in do_import
  File ".../site-packages/_appmap/configuration.py", line 481, in __init__
  File ".../site-packages/_appmap/configuration.py", line 464, in matcher_of_config
  File ".../site-packages/_appmap/configuration.py", line 398, in __init__
  ...
importlib.metadata.PackageNotFoundError: No package metadata was found for requests

No test runs and tmp/appmap/pytest does not exist. DistMatcher.__init__ calls
importlib.metadata.files(dist), which raises for a distribution that is not
installed.

This happens easily when one appmap.yml is shared between environments that install
different optional dependencies.

Activity

  1. gnarendra9014-user commented on Nov 12, 2026

    @gnarendra9014-user

    Hi! I'd like to work on this issue. I can reproduce the PackageNotFoundError when a configured distribution is missing. I'd like to fix the handling of missing distributions and add regression tests. Is this issue available for me to work on?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions