Skip to content

Commit beb7c21

Browse files
committed
Release 1.6.13
2 parents e14f48c + b788598 commit beb7c21

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1163
-849
lines changed

.coveragerc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[run]
2+
omit =
3+
.tox/*
4+
tests/*

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ examples/searchcommands_app/package/default/commands.conf
2828
examples/searchcommands_app/package/lib/splunklib
2929
tests/searchcommands/apps/app_with_logging_configuration/*.log
3030
*.observed
31-
venv/
31+
venv/
32+
.tox
33+
test-reports/

.travis.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,18 @@ before_install:
2929
- export SPLUNK_HOME=`pwd`/splunk_home
3030
- mkdir -p $SPLUNK_HOME/var/log/splunk
3131

32+
language: python
33+
3234
env:
33-
- SPLUNK_VERSION=7.0-sdk
34-
- SPLUNK_VERSION=7.2-sdk
35+
- SPLUNK_VERSION=7.3-sdk
3536
- SPLUNK_VERSION=8.0-sdk
3637

37-
language: python
38-
3938
python:
4039
- "2.7"
41-
- "3.5"
40+
- "3.7"
4241

43-
install: "pip install unittest2"
42+
install: pip install tox-travis
4443

4544
before_script: python setup.py build dist
4645

47-
script: python setup.py test
46+
script: tox

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# text reset
2+
NO_COLOR=\033[0m
3+
# green
4+
OK_COLOR=\033[32;01m
5+
# red
6+
ERROR_COLOR=\033[31;01m
7+
# cyan
8+
WARN_COLOR=\033[36;01m
9+
# yellow
10+
ATTN_COLOR=\033[33;01m
11+
12+
ROOT_DIR := $(shell git rev-parse --show-toplevel)
13+
14+
VERSION := `git describe --tags --dirty 2>/dev/null`
15+
COMMITHASH := `git rev-parse --short HEAD 2>/dev/null`
16+
DATE := `date "+%FT%T%z"`
17+
18+
.PHONY: all
19+
all: build_app test
20+
21+
init:
22+
@echo "$(ATTN_COLOR)==> init $(NO_COLOR)"
23+
24+
.PHONY: build_app
25+
build_app:
26+
@echo "$(ATTN_COLOR)==> build_app $(NO_COLOR)"
27+
@python setup.py build dist
28+
29+
.PHONY: test
30+
test:
31+
@echo "$(ATTN_COLOR)==> test $(NO_COLOR)"
32+
@tox -e py27,py37
33+
34+
.PHONY: test_specific
35+
test_specific:
36+
@echo "$(ATTN_COLOR)==> test_specific $(NO_COLOR)"
37+
@sh ./scripts/test_specific.sh
38+
39+
.PHONY: test_smoke
40+
test_smoke:
41+
@echo "$(ATTN_COLOR)==> test_smoke $(NO_COLOR)"
42+
@tox -e py27,py37 -- -m smoke
43+
44+
.PHONY: test_no_app
45+
test_no_app:
46+
@echo "$(ATTN_COLOR)==> test_no_app $(NO_COLOR)"
47+
@tox -e py27,py37 -- -m "not app"
48+
49+
.PHONY: test_smoke_no_app
50+
test_smoke_no_app:
51+
@echo "$(ATTN_COLOR)==> test_smoke_no_app $(NO_COLOR)"
52+
@tox -e py27,py37 -- -m "smoke and not app"
53+
54+
.PHONY: splunkrc
55+
splunkrc:
56+
@echo "$(ATTN_COLOR)==> splunkrc $(NO_COLOR)"
57+
@echo "To make a .splunkrc:"
58+
@echo " [SPLUNK_INSTANCE_JSON] | python scripts/build-splunkrc.py ~/.splunkrc"

README.md

Lines changed: 77 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
#### Version 1.6.12
77

8-
The Splunk Software Development Kit (SDK) for Python contains library code and
8+
The Splunk Software Development Kit (SDK) for Python contains library code and
99
examples designed to enable developers to build applications using Splunk.
1010

1111
Splunk is a search engine and analytic environment that uses a distributed
12-
map-reduce architecture to efficiently index, search and process large
12+
map-reduce architecture to efficiently index, search and process large
1313
time-varying data sets.
1414

1515
The Splunk product is popular with system administrators for aggregation and
@@ -25,31 +25,31 @@ are enabled by Splunk's unique capabilities.
2525
## Getting started with the Splunk SDK for Python
2626

2727
The Splunk SDK for Python contains library code and examples that show how to
28-
programmatically interact with Splunk for a variety of scenarios including
29-
searching, saved searches, data inputs, and many more, along with building
30-
complete applications.
28+
programmatically interact with Splunk for a variety of scenarios including
29+
searching, saved searches, data inputs, and many more, along with building
30+
complete applications.
3131

3232
The information in this Readme provides steps to get going quickly, but for more
33-
in-depth information be sure to visit the
34-
[Splunk Developer Portal](http://dev.splunk.com/view/SP-CAAAEBB).
33+
in-depth information be sure to visit the
34+
[Splunk Developer Portal](http://dev.splunk.com/view/SP-CAAAEBB).
3535
### Requirements
3636

3737
Here's what you need to get going with the Splunk SDK for Python.
3838

3939
#### Python
4040

41-
The Splunk SDK for Python requires Python 2.7+, including Python 3. The Splunk SDK for Python has been tested with Python v2.7 and v3.5.
41+
The Splunk SDK for Python requires Python 2.7+, including Python 3. The Splunk SDK for Python has been tested with Python v2.7 and v3.5.
4242

4343
#### Splunk
4444

45-
If you haven't already installed Splunk, download it
46-
[here](http://www.splunk.com/download). For more about installing and running
47-
Splunk and system requirements, see
45+
If you haven't already installed Splunk, download it
46+
[here](http://www.splunk.com/download). For more about installing and running
47+
Splunk and system requirements, see
4848
[Installing & Running Splunk](http://dev.splunk.com/view/SP-CAAADRV). The Splunk SDK for Python has been tested with Splunk Enterprise 7.0 and 7.2.
4949

5050
#### Splunk SDK for Python
51-
Get the Splunk SDK for Python; [download the SDK as a ZIP](http://dev.splunk.com/view/SP-CAAAEBB)
52-
and extract the files. Or, if you want to contribute to the SDK, clone the
51+
Get the Splunk SDK for Python; [download the SDK as a ZIP](http://dev.splunk.com/view/SP-CAAAEBB)
52+
and extract the files. Or, if you want to contribute to the SDK, clone the
5353
repository from [GitHub](https://github.com/splunk/splunk-sdk-python).
5454

5555

@@ -85,17 +85,17 @@ home folder and are running OS X or Linux, add the following line to your
8585
export PYTHONPATH=~/splunk-sdk-python
8686

8787
The SDK command-line examples require a common set of arguments
88-
that specify things like the Splunk host, port, and login credentials. For a
89-
full list of command-line arguments, include `--help` as an argument to any of
90-
the examples.
88+
that specify things like the Splunk host, port, and login credentials. For a
89+
full list of command-line arguments, include `--help` as an argument to any of
90+
the examples.
9191

9292
#### .splunkrc
9393

9494
To connect to Splunk, many of the SDK examples and unit tests take command-line
9595
arguments that specify values for the host, port, and login credentials for
9696
Splunk. For convenience during development, you can store these arguments as
97-
key-value pairs in a text file named **.splunkrc**. Then, the SDK examples and
98-
unit tests use the values from the **.splunkrc** file when you don't specify
97+
key-value pairs in a text file named **.splunkrc**. Then, the SDK examples and
98+
unit tests use the values from the **.splunkrc** file when you don't specify
9999
them.
100100

101101
To use this convenience file, create a text file with the following format:
@@ -115,39 +115,39 @@ To use this convenience file, create a text file with the following format:
115115

116116
Save the file as **.splunkrc** in the current user's home directory.
117117

118-
* For example on OS X, save the file as:
118+
* For example on OS X, save the file as:
119119

120120
~/.splunkrc
121121

122-
* On Windows, save the file as:
122+
* On Windows, save the file as:
123123

124124
C:\Users\currentusername\.splunkrc
125125

126126
You might get errors in Windows when you try to name the file because
127127
".splunkrc" looks like a nameless file with an extension. You can use
128-
the command line to create this file—go to the
129-
**C:\Users\currentusername** directory and enter the following command:
128+
the command line to create this file—go to the
129+
**C:\Users\currentusername** directory and enter the following command:
130130

131131
Notepad.exe .splunkrc
132132

133133
Click **Yes**, then continue creating the file.
134134

135-
**Note**: Storing login credentials in the **.splunkrc** file is only for
136-
convenience during development. This file isn't part of the Splunk platform and
137-
shouldn't be used for storing user credentials for production. And, if you're
138-
at all concerned about the security of your credentials, just enter them at
139-
the command line rather than saving them in this file.
135+
**Note**: Storing login credentials in the **.splunkrc** file is only for
136+
convenience during development. This file isn't part of the Splunk platform and
137+
shouldn't be used for storing user credentials for production. And, if you're
138+
at all concerned about the security of your credentials, just enter them at
139+
the command line rather than saving them in this file.
140140

141141

142142
#### Examples
143143

144-
Examples are located in the **/splunk-sdk-python/examples** directory. To run
145-
the examples at the command line, use the Python interpreter and include any
144+
Examples are located in the **/splunk-sdk-python/examples** directory. To run
145+
the examples at the command line, use the Python interpreter and include any
146146
arguments that are required by the example:
147147

148148
python examplename.py --username="admin" --password="changeme"
149149

150-
If you saved your login credentials in the **.splunkrc** file, you can omit
150+
If you saved your login credentials in the **.splunkrc** file, you can omit
151151
those arguments:
152152

153153
python examplename.py
@@ -158,23 +158,36 @@ To get help for an example, use the `--help` argument with an example:
158158

159159
#### Unit tests
160160

161-
The Splunk SDK for Python contains a collection of unit tests. To run them, open a
161+
The Splunk SDK for Python contains a collection of unit tests. To run them, open a
162162
command prompt in the **/splunk-sdk-python** directory and enter:
163163

164-
python setup.py test
164+
make
165165

166-
You can also run individual test files, which are located in
167-
**/splunk-sdk-python/tests**. For example, to run the apps test, open a command
168-
prompt in the **/splunk-sdk-python/tests** subdirectory and enter:
166+
You can also run individual test files, which are located in
167+
**/splunk-sdk-python/tests**. The following command explains how to run
168+
a specific test:
169169

170-
python test_app.py
170+
make test_specific
171171

172-
The test suite uses Python's standard library and the built-in `unittest`
173-
library.
172+
The test suite uses Python's standard library, the built-in `unittest`
173+
library, `pytest`, and `tox`.
174+
175+
**Important Notes:**
176+
177+
The test run will fail unless the
178+
[SDK App Collection](https://github.com/splunk/sdk-app-collection) is installed.
179+
180+
You can exclude app-specific tests with the following command:
181+
182+
make test_no_app
174183

175184
You can read more about our testing framework on
176185
[GitHub](https://github.com/splunk/splunk-sdk-python/tree/master/tests).
177186

187+
In addition, the test run requires the searchcommands app to be built. The `make`
188+
command runs the tasks to do this, but more complex testing may require you to
189+
rebuild using `make build_app`.
190+
178191
## Repository
179192

180193
<table>
@@ -209,34 +222,34 @@ You can read more about our testing framework on
209222
### Changelog
210223

211224
The **CHANGELOG.md** file in the root of the repository contains a description
212-
of changes for each version of the SDK. You can also find it online at
225+
of changes for each version of the SDK. You can also find it online at
213226
[https://github.com/splunk/splunk-sdk-python/blob/master/CHANGELOG.md](https://github.com/splunk/splunk-sdk-python/blob/master/CHANGELOG.md).
214227

215228
### Branches
216229

217230
The **master** branch always represents a stable and released version of the SDK.
218-
You can read more about our branching model on our Wiki at
231+
You can read more about our branching model on our Wiki at
219232
[https://github.com/splunk/splunk-sdk-python/wiki/Branching-Model](https://github.com/splunk/splunk-sdk-python/wiki/Branching-Model).
220233

221234
## Documentation and resources
222-
If you need to know more:
235+
If you need to know more:
223236

224-
* For all things developer with Splunk, your main resource is the
237+
* For all things developer with Splunk, your main resource is the
225238
[Splunk Developer Portal](http://dev.splunk.com).
226239

227-
* For conceptual and how-to documentation, see the
240+
* For conceptual and how-to documentation, see the
228241
[Overview of the Splunk SDK for Python](http://dev.splunk.com/view/SP-CAAAEBB).
229242

230-
* For API reference documentation, see the
243+
* For API reference documentation, see the
231244
[Splunk SDK for Python Reference](http://docs.splunk.com/Documentation/PythonSDK).
232245

233-
* For more about the Splunk REST API, see the
246+
* For more about the Splunk REST API, see the
234247
[REST API Reference](http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI).
235248

236-
* For more about about Splunk in general, see
249+
* For more about about Splunk in general, see
237250
[Splunk>Docs](http://docs.splunk.com/Documentation/Splunk).
238251

239-
* For more about this SDK's repository, see our
252+
* For more about this SDK's repository, see our
240253
[GitHub Wiki](https://github.com/splunk/splunk-sdk-python/wiki/).
241254

242255
## Community
@@ -284,24 +297,24 @@ If you would like to contribute to the SDK, go here for more information:
284297

285298
### Support
286299

287-
1. You will be granted support if you or your company are already covered
288-
under an existing maintenance/support agreement.
289-
Submit a new case in the [Support Portal][contact] and include "Splunk SDK for Python"
290-
in the subject line.
291-
2. If you are not covered under an existing maintenance/support agreement, you
292-
can find help through the broader community at:
293-
<ul>
294-
<li><a href='http://splunk-base.splunk.com/answers/'>Splunk Answers</a> (use
295-
the <b>sdk</b>, <b>java</b>, <b>python</b>, and <b>javascript</b> tags to
296-
identify your questions)</li>
297-
</ul>
298-
3. Splunk will NOT provide support for SDKs if the core library (the
299-
code in the <b>/splunklib</b> directory) has been modified. If you modify an
300-
SDK and want support, you can find help through the broader community and
301-
Splunk answers (see above). We would also like to know why you modified the
302-
core library&mdash;please send feedback to [email protected].
300+
1. You will be granted support if you or your company are already covered
301+
under an existing maintenance/support agreement.
302+
Submit a new case in the [Support Portal][contact] and include "Splunk SDK for Python"
303+
in the subject line.
304+
2. If you are not covered under an existing maintenance/support agreement, you
305+
can find help through the broader community at:
306+
<ul>
307+
<li><a href='http://splunk-base.splunk.com/answers/'>Splunk Answers</a> (use
308+
the <b>sdk</b>, <b>java</b>, <b>python</b>, and <b>javascript</b> tags to
309+
identify your questions)</li>
310+
</ul>
311+
3. Splunk will NOT provide support for SDKs if the core library (the
312+
code in the <b>/splunklib</b> directory) has been modified. If you modify an
313+
SDK and want support, you can find help through the broader community and
314+
Splunk answers (see above). We would also like to know why you modified the
315+
core library&mdash;please send feedback to [email protected].
303316
4. File any issues on [GitHub](https://github.com/splunk/splunk-sdk-python/issues).
304-
317+
305318
### Contact Us
306319

307320
You can [contact support][contact] if you have Splunk related questions.

0 commit comments

Comments
 (0)