Closed
Description
Describe the bug
The package depends on deprecation
but doesn't specify it as a dependency.
To Reproduce
Steps to reproduce the behaviour:
- install the package
- attempt to use it (see logs below)
Expected behavior
Functional dependencies to be specified on install of the package.
Logs or Screenshots
# python -m virtualenv python-sdk-2.0
created virtual environment CPython3.12.2.final.0-64 in 220ms
creator CPython3Posix(dest=/Users/yaleman/Projects/python-sdk-2.0, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(download=False, pip=bundle, via=copy, app_data_dir=/Users/yaleman/Library/Application Support/virtualenv)
added seed packages: pip==24.0
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
# source python-sdk-2.0/bin/activate
# which python
./python-sdk-2.0/bin/python
# pip install splunk-sdk
Collecting splunk-sdk
Downloading splunk-sdk-2.0.0.tar.gz (99 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 99.4/99.4 kB 2.2 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: splunk-sdk
Building wheel for splunk-sdk (pyproject.toml) ... done
Created wheel for splunk-sdk: filename=splunk_sdk-2.0.0-py3-none-any.whl size=115450 sha256=7f0d3badeb3f01f4fe8926914404b7db8a8cba717719da149bcff0090eacdb52
Stored in directory: ~/Library/Caches/pip/wheels/ae/55/6e/a00a84c54550ff94208060e44889ea333fa834a1e6ff33f40e
Successfully built splunk-sdk
Installing collected packages: splunk-sdk
Successfully installed splunk-sdk-2.0.0
# python
Python 3.12.2 (main, Mar 7 2024, 16:38:23) [Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import splunklib.results
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/yaleman/Projects/python-sdk-2.0/lib/python3.12/site-packages/splunklib/results.py", line 49, in <module>
import deprecation
ModuleNotFoundError: No module named 'deprecation'
Splunk (please complete the following information):
n/1
SDK (please complete the following information):
- Version: 2.0.0
- Language Runtime Version: python 3.x
- OS: any
Additional context
The tox
tests explicitly install the dependencies, but this shouldn't be required, as the install_requires
option should be used in setuptools.
This is the only non-core-python dependency required by the package.
Metadata
Metadata
Assignees
Labels
No labels
Activity
573927 commentedon Mar 26, 2024
Since Python that is bundled with the Splunk Enterprise installation doesn't contain
deprecation
, how should this requirement be satisfied when using the SDK in a Splunk app? Similarly,packaging
is also not bundled with Splunk Enterprise and is a dependency ofdeprecation
.yaleman commentedon Mar 27, 2024
2.0.1 was released today with the update from the above PR.
pioootrek commentedon Jul 1, 2024
When I try to:
from splunklib.results import ResultsReader
in my modular input (I need splunk to connect and get data from antoer splunk via api)
i get error like:
Traceback (most recent call last): File "../etc/apps/show_activity_analyser/bin/get_audit_GDI.py", line 9, in <module> from splunklib.results import ResultsReader File "../etc/apps/show_activity_analyser/bin/../lib/splunklib/results.py", line 49, in <module> import deprecation ModuleNotFoundError: No module named 'deprecation' <stderr> Introspecting scheme=get_audit_GDI: Traceback (most recent call last): <stderr> Introspecting scheme=get_audit_GDI: File "/Users/pmotloch/Applications/splunk/etc/apps/show_activity_analyser/bin/get_audit_GDI.py", line 9, in <module> <stderr> Introspecting scheme=get_audit_GDI: from splunklib.results import ResultsReader <stderr> Introspecting scheme=get_audit_GDI: File "/Users/pmotloch/Applications/splunk/etc/apps/show_activity_analyser/bin/../lib/splunklib/results.py", line 49, in <module> <stderr> Introspecting scheme=get_audit_GDI: import deprecation <stderr> Introspecting scheme=get_audit_GDI: ModuleNotFoundError: No module named 'deprecation' Introspecting scheme=get_audit_GDI: script running failed (exited with code 1).
@yaleman 100% sure its fixed? Or do you think my error is unrelated?
yaleman commentedon Jul 1, 2024
That sure does look like you're running an old version
pioootrek commentedon Jul 1, 2024
i know. That's why i think I'm missing sth "easy". But when I look into my changelog.md:
pmeyerson commentedon Jul 1, 2024
Try:
import splunklib
print(splunklib.version)
dir(splunklib)
sorry I'm on mobile. Maybe your code is using a cached version somewhere
yaleman commentedon Jul 2, 2024
The only other thing I could really suggest is installing the missing package or commenting out the offending code. There's no easy wins when there's a missing dependency.
(edit: removed some formatting)