Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logfire 0.50 requires pytest #367

Closed
baggiponte opened this issue Aug 6, 2024 · 6 comments · Fixed by #368
Closed

logfire 0.50 requires pytest #367

baggiponte opened this issue Aug 6, 2024 · 6 comments · Fixed by #368
Assignees
Labels
bug Bug related to the Logfire Python SDK

Comments

@baggiponte
Copy link

Description

When I launch a service instrumented with logfire I get this error:

dice-player-1  | Traceback (most recent call last):
dice-player-1  |   File "/usr/local/bin/uvicorn", line 8, in <module>
dice-player-1  |     sys.exit(main())
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
dice-player-1  |     return self.main(*args, **kwargs)
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
dice-player-1  |     rv = self.invoke(ctx)
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
dice-player-1  |     return ctx.invoke(self.callback, **ctx.params)
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
dice-player-1  |     return __callback(*args, **kwargs)
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 410, in main
dice-player-1  |     run(
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/main.py", line 577, in run
dice-player-1  |     server.run()
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 65, in run
dice-player-1  |     return asyncio.run(self.serve(sockets=sockets))
dice-player-1  |   File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
dice-player-1  |     return loop.run_until_complete(main)
dice-player-1  |   File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
dice-player-1  |     return future.result()
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 69, in serve
dice-player-1  |     await self._serve(sockets)
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 76, in _serve
dice-player-1  |     config.load()
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/config.py", line 434, in load
dice-player-1  |     self.loaded_app = import_from_string(self.app)
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 22, in import_from_string
dice-player-1  |     raise exc from None
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/uvicorn/importer.py", line 19, in import_from_string
dice-player-1  |     module = importlib.import_module(module_str)
dice-player-1  |   File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
dice-player-1  |     return _bootstrap._gcd_import(name[level:], package, level)
dice-player-1  |   File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
dice-player-1  |   File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
dice-player-1  |   File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
dice-player-1  |   File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
dice-player-1  |   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
dice-player-1  |   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
dice-player-1  |   File "/app/app.py", line 4, in <module>
dice-player-1  |     import logfire
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/logfire/__init__.py", line 9, in <module>
dice-player-1  |     from ._internal.config import METRICS_PREFERRED_TEMPORALITY, ConsoleOptions, PydanticPlugin, configure
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/logfire/_internal/config.py", line 55, in <module>
dice-player-1  |     from ..testing import TestExporter
dice-player-1  |   File "/usr/local/lib/python3.10/site-packages/logfire/testing.py", line 14, in <module>
dice-player-1  |     import pytest
dice-player-1  | ModuleNotFoundError: No module named 'pytest'

Which can be solved by adding pytest in the list of dependencies.

Python, Logfire & OS Versions, related packages (not required)

❯ logfire info
logfire="0.48.1"
platform="macOS-14.4.1-arm64-arm-64bit"
python="3.11.9 (main, Apr 15 2024, 17:28:11) [Clang 17.0.6 ]"
[related_packages]
requests="2.32.3"
protobuf="4.25.4"
rich="13.7.1"
executing="2.0.1"
opentelemetry-api="1.26.0"
opentelemetry-exporter-otlp-proto-common="1.26.0"
opentelemetry-exporter-otlp-proto-http="1.26.0"
opentelemetry-instrumentation="0.47b0"
opentelemetry-proto="1.26.0"
opentelemetry-sdk="1.26.0"
opentelemetry-semantic-conventions="0.47b0"
@baggiponte baggiponte added the bug Bug related to the Logfire Python SDK label Aug 6, 2024
@edvgui
Copy link

edvgui commented Aug 6, 2024

Easy to reproduce:

guillaume@fedora:~$ mktmpenv -p 3.11
...
(tmp-cd0188cbff3e538) guillaume@fedora:~/.virtualenvs/tmp-cd0188cbff3e538$ pip install logfire
...
(tmp-cd0188cbff3e538) guillaume@fedora:~/.virtualenvs/tmp-cd0188cbff3e538$ python -c "import logfire"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/guillaume/.virtualenvs/tmp-cd0188cbff3e538/lib/python3.11/site-packages/logfire/__init__.py", line 9, in <module>
    from ._internal.config import METRICS_PREFERRED_TEMPORALITY, ConsoleOptions, PydanticPlugin, configure
  File "/home/guillaume/.virtualenvs/tmp-cd0188cbff3e538/lib/python3.11/site-packages/logfire/_internal/config.py", line 55, in <module>
    from ..testing import TestExporter
  File "/home/guillaume/.virtualenvs/tmp-cd0188cbff3e538/lib/python3.11/site-packages/logfire/testing.py", line 14, in <module>
    import pytest
ModuleNotFoundError: No module named 'pytest'

@edvgui
Copy link

edvgui commented Aug 6, 2024

cc @alexmojaki release 0.50 should probably be yanked
(mentioning you because you are tagged as the release person: https://github.com/pydantic/logfire/releases/tag/v0.50.0, so you probably know what to do about it)

@Kludex
Copy link
Member

Kludex commented Aug 6, 2024

This was introduced by #351.

We'll make a 0.50.1 release soon.

Thanks for the report.

@alexmojaki
Copy link
Contributor

Thanks, working on a fix

@alexmojaki
Copy link
Contributor

Thanks for reporting! A fix has been released.

@edvgui
Copy link

edvgui commented Aug 7, 2024

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug related to the Logfire Python SDK
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants