Skip to content

Fix container startup crash caused by honcho 1.1.0 + setuptools 82.x incompatibility#529

Merged
xrmx merged 3 commits intomainfrom
copilot/fix-failing-tests
Mar 5, 2026
Merged

Fix container startup crash caused by honcho 1.1.0 + setuptools 82.x incompatibility#529
xrmx merged 3 commits intomainfrom
copilot/fix-failing-tests

Conversation

Copy link
Contributor

Copilot AI commented Mar 4, 2026

honcho 1.1.0 imports from pkg_resources import iter_entry_points, which fails with ModuleNotFoundError after setuptools 82.0.0 removed pkg_resources from the venv. Since the Dockerfile runs pip install -U pip setuptools, fresh builds started getting setuptools 82.x and the container exited with code 1 immediately on startup.

Changes

  • requirements.txt: honcho 1.1.02.0.0 — v2 uses importlib.metadata instead of pkg_resources
  • opbeans/settings.py:
    • Replace deprecated structlog.threadlocal.wrap_dict(dict) with context_class=dict + add structlog.contextvars.merge_contextvars processor (modern structlog API since 21.2.0)
    • Keep elasticapm.contrib.django.handlers.LoggingHandler to preserve original logging behavior
    • Remove USE_L10N = True (dropped in Django 5.0)
  • opbeans/tasks.py: Replace except TransportError as e: if e.status_code == 404 with except NotFoundErrorTransportError.status_code doesn't exist in elasticsearch-py 8.x
  • opbeans/__init__.py: Remove default_app_config (ignored since Django 3.2, removed in 5.0)
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix tests</issue_title>
<issue_description>We'd want to fix the tests because are failing, see https://github.com/elastic/opbeans-python/actions/runs/22688796855/job/65778702958?pr=527

</issue_description>

<agent_instructions>You are a python expert with deep knowledge in testing.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…rch APIs

Co-authored-by: fr4nc1sc0-r4m0n <215478872+fr4nc1sc0-r4m0n@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix tests that are currently failing Fix container startup crash caused by honcho 1.1.0 + setuptools 82.x incompatibility Mar 4, 2026
'class': 'logging.StreamHandler',
'formatter': "json" if "ENABLE_JSON_LOGGING" in os.environ else "console",
},
'elasticapm': {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot is right that this is deprecated but I would like to not change behavior

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot take into account this comment #529 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Restored the elasticapm handler and updated the opbeans logger to use ['console', 'elasticapm'] again in commit 6636788. The original logging behavior is preserved.

Co-authored-by: fr4nc1sc0-r4m0n <215478872+fr4nc1sc0-r4m0n@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • metadata.google.internal
    • Triggering command: /usr/bin/python python manage.py check (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@fr4nc1sc0-r4m0n fr4nc1sc0-r4m0n marked this pull request as ready for review March 5, 2026 10:05
@fr4nc1sc0-r4m0n fr4nc1sc0-r4m0n requested a review from a team as a code owner March 5, 2026 10:05
@xrmx xrmx merged commit f9ccf15 into main Mar 5, 2026
2 checks passed
@xrmx xrmx deleted the copilot/fix-failing-tests branch March 5, 2026 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix tests

3 participants