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

sdk/__init__.py not correctly packaged #1078

Closed
ffe4 opened this issue Sep 4, 2020 · 4 comments · Fixed by #1091
Closed

sdk/__init__.py not correctly packaged #1078

ffe4 opened this issue Sep 4, 2020 · 4 comments · Fixed by #1091
Labels
bug Something isn't working

Comments

@ffe4
Copy link
Contributor

ffe4 commented Sep 4, 2020

Describe your environment
macOS-10.15.5
Python 3.8
opentelemetry-sdk==0.12b0

Steps to reproduce

$ pip install opentelemetry-sdk
$ python -c 'import site, os; path = site.getsitepackages()[0]; print(os.path.exists(path + "/opentelemetry/sdk/"))'
True
$ python -c 'import site, os; path = site.getsitepackages()[0]; print(os.path.exists(path + "/opentelemetry/sdk/__init__.py"))'
False

What is the expected behavior?
I expected the __init__.py from opentelemetry-sdk/src/opentelemetry/sdk/__init__.py in the repository to be present.

What is the actual behavior?
The file was not there.

@ffe4 ffe4 added the bug Something isn't working label Sep 4, 2020
@ocelotl
Copy link
Contributor

ocelotl commented Sep 10, 2020

Sorry, I remembered something about a way to include files in the package but it was for additional files, as explained here.

@ffe4
Copy link
Contributor Author

ffe4 commented Sep 10, 2020

For context:

I encountered this issue while testing PR #1069. The tests pass when running python eachdist.py test, but fail in the CI, as well as when running tox -e py38-test-core-sdk locally.

Tox installs the package without the -e flag to test the actual installation.

@aabmass
Copy link
Member

aabmass commented Sep 10, 2020

Looks like this line is the issue:

include = opentelemetry.sdk.*

The reason it fails passes in tox is because tox.ini is using not an editable install (which doesn't uses the setuptools configuration afaik):

test: pip install {toxinidir}/opentelemetry-api {toxinidir}/opentelemetry-sdk {toxinidir}/tests/util

@aabmass
Copy link
Member

aabmass commented Sep 10, 2020

Strangely, it also looks like the version.py files are missing in a fresh install.

python3 -m venv venv
source venv/bin/activate
pip install opentelemetry-api opentelemetry-sdk
tree -I *.pyc -I __pycache__ venv/lib/python3.8/site-packages/opentelemetry

venv/lib/python3.8/site-packages/opentelemetry
├── configuration                                                                                                                                                                                      │   ├── __init__.py
│   └── py.typed                                                                                                                                                                                       ├── context
│   ├── aiocontextvarsfix.py                                                                                                                                                                           │   ├── context.py
│   ├── contextvars_context.py
│   ├── __init__.py
│   ├── py.typed
│   └── threadlocal_context.py
├── correlationcontext
│   ├── __init__.py
│   └── propagation
│       └── __init__.py
├── distributedcontext
│   └── py.typed
├── metrics
│   ├── __init__.py
│   └── py.typed
├── propagators
│   ├── composite.py
│   └── __init__.py
├── sdk
│   ├── metrics
│   │   ├── export
│   │   │   ├── aggregate.py
│   │   │   ├── batcher.py
│   │   │   ├── controller.py
│   │   │   ├── __init__.py                                                                                                                                                                            │   │   │   └── in_memory_metrics_exporter.py
│   │   ├── __init__.py
│   │   └── view.py
│   ├── resources
│   │   └── __init__.py
│   ├── trace
│   │   ├── export
│   │   │   ├── __init__.py
│   │   │   └── in_memory_span_exporter.py
│   │   ├── __init__.py
│   │   └── propagation
│   │       ├── b3_format.py
│   │       └── __init__.py
│   └── util
│       ├── __init__.py
│       └── instrumentation.py
├── trace
│   ├── __init__.py
│   ├── propagation
│   │   ├── httptextformat.py
│   │   ├── __init__.py
│   │   └── tracecontexthttptextformat.py
│   ├── py.typed
│   ├── sampling.py
│   ├── span.py
│   └── status.py
└── util
    ├── __init__.py
    ├── py.typed
    └── types.py

18 directories, 41 files

Is this by design? It is included in the package resources so this still works:

>>> import pkg_resources
>>> pkg_resources.get_distribution("opentelemetry-sdk").version
'0.12b0'

srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this issue Nov 1, 2020
…y#1078)

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants