Developing for Splunk Platform

How to distribute Python dependencies as part of a Splunk TA ?

Edward1234
Engager

Hello,

 

I am working on a Python script that uses the gitPython package and I am trying to distribute the app as a TA. But I'm having a hard time with how I distribute the dependency (gitPython). I checked out the code another TA and it seemed like they had all of their dependencies in a local file and were able to import them. I've only used pip to install and work with dependencies.

How do I install my dependencies to a local folder and how I import them from that folder?

UPDATE:

I figured it out with the help of madscient and alacercogitatus on the Slack.

 

So to install a package locally:

 

 

pip3 install -t ./gitpython gitpython 

 

 

Then I had to move the git folder from the gitPython package:

 

 

mv gitpython/git ./git 

 

 



so that the structure is this:

index.py
<git>
----Git's files

Then I just used

 

 

from git import Repo

 



in the python script and changed my calls for the repo command to 'Repo'.


Not deleting this just in case someone else needs help and finds this.

Labels (3)
Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Thanks for sharing!  Please submit an answer and accept it as a solution to help future readers find it.

---
If this reply helps you, an upvote would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...

Reminder! Splunk Love Promo: $25 Visa Gift Card for Your Honest SOAR Review With ...

We recently launched our first Splunk Love Special, and it's gone phenomenally well, so we're doing it again, ...