Jira Python Integration: 2 Easy Methods

on Data Science, Jira, Machine Learning, Project Management Tool, Python, Tutorials • November 29th, 2021 • Write for Hevo

Companies have Software Teams working on multiple project instances simultaneously. These projects often contain issues that one needs to resolve before deploying. In such cases managing various projects and tracking their issues can create a chaotic situation. Jira is a Cloud-based tool that companies can use to bring some order to this chaos. It is a Project Management tool that specializes in Issue tracking. The Jira tool is a great Project Management option especially for businesses that work on Agile Methodology of software development.

Python is a Programming Language, popular for its rich libraries and easy-to-use syntax. Developers and Analysts alike prefer Python Programming language to implement Software Development and Machine Learning programs. Furthermore, nowadays companies are drawn towards the idea of Jira Python Integration. This is mainly because of the various benefits and functionalities that Python provides. Therefore, companies find it easier to manage their Jira data in Python Data Frames to gain more control and better results. 

This article will discuss Jira and Python and list down their key features. It will also provide a step-by-step guide for setting up the Jira Python Integration using 2 methods. The first method makes use of the Jira Library present in Python to transfer the data from Jira Tables into Python Dataframes. The second method is built-around APIs( Application Programming Interface) that can facilitate this data transfer process. Read along to learn these methods and the benefits associated with Jira Python Integration!

Table of Contents

Prerequisites

  • An Atlassian account.
  • Working knowledge of Python Programming Language.
  • Working knowledge of APIs.

Introduction to Jira

Jira Python Integration: Jira Logo
Image Source

Jira is a software tool that works on Cloud and is popular for its Problem Tracking and Project Management properties. Companies deploying projects on Agile Methodology of software development are the main users of this tool. It’s a subscription-based service that helps teams achieve a common goal. Along with major tasks like Backlog Creation, Planning, and Product Delivery, this tool allows you to monitor and improve the overall progress of your project. Jira also works with many other tools to simplify Issue Tracking and promote the launch of new software products. 

Jira supports a Version Management feature that can track your projects and prepare detailed performance reports. It also offers design templates that your company can customize according to its Marketing Campaigns.

Key Features of Jira

Jira Python Integration: Jira Features
Image Source

Jira is a preferred choice for Issue Tracking due to its following features:

  • Security: Jira’s has Bug Tracking software which allows access only to teams that have the required authorization to work on the Bug Management. Moreover, Jira’s Default Authorization Scheme provides an added layer of security while projects are allocated to teams. 
  • Reports: Jira serves data obtained from Issue Tracking and Project Management in the form of visuals called Reports. These Reports are available in various forms and syntaxes for you to choose from. They act as the measurement tool from the initial phase to the product delivery and maintenance phase of a project.
  • Project Control: You can easily track the progress of your company’s current projects at any stage with the Jira Tracking Software. It deploys JQL (a customized version of SQL) to search through issues faster. Furthermore, Jira offers a simple drag and drop method for you to create backlog sprints seamlessly.

You can learn more about Jira here.

Introduction to Python

Jira Python Integration: Python Logo
Image Source

Python is a popular general-purpose Programming Language. Its versatility, coupled with its ease of use for beginners, has made it one of the most used Programming Languages ​​today. It is mostly used for Website and Software Development, Task Automation, Data Analysis, and Data Visualization. Due to its simple syntax, many non-technical professionals such as Accountants and Scientists also use it for daily work such as organizing finances. The Python Programming Language serves as the main tool in Data Science to perform complex Statistical Calculations, create Machine Learning Algorithms, etc. 

Python Programming Language can create a wide variety of Data Visualizations, such as Line and Bar Charts, Pie Charts, Column Charts, and 3D Charts. It also has a number of libraries that allow programmers to write Machine Learning programs faster and more efficiently. TensorFlow and Keras are examples of such libraries.

Key Features of the Python Programming Language

Jira Python Integration: Python Features
Image Source

The following features make Python the most popular Programming Language today:

  • Beginner Friendly: The Python Programming Language provides a hassle-free option for developers. It has a straightforward and easy-to-understand workflow that suits entry-level coders. Moreover, since It’s open-source, one can use and distribute it for commercial purposes free of cost.
  • Robust Applications: It has a simple syntax based on natural human-readable language. Thus making projects on Python Programming Language, is faster as compared to other Programming Languages. Furthermore, Its versatile nature allows its use for different tasks like Web Development and Machine Learning.
  • Large Communities: Due to Python Programming Language’s popularity, a large and active community of coders is available that contributes to this language’s set of modules and libraries. The vast support community ensures that if you or any other coder get stuck into a programming issue, a solution will be available easily. You just have to post your issue on these community pages.

You can understand more about the Python Programming Language by visiting here.

Simplify your Data Analysis with Hevo’s No-code Data Pipeline

Hevo Data, a No-code Data Pipeline helps to Load Data from any data source such as Databases, SaaS applications, Cloud Storage, SDK,s, and Streaming Services and simplifies the ETL process. It supports 100+ data sources like Jira and loads the data onto the desired Data Warehouse, enriches the data, and transforms it into an analysis-ready form without writing a single line of code.

Its completely automated pipeline offers data to be delivered in real-time without any loss from source to destination. Its fault-tolerant and scalable architecture ensure that the data is handled in a secure, consistent manner with zero data loss and supports different forms of data. The solutions provided are consistent and work with different Business Intelligence (BI) tools as well.

Get Started with Hevo for Free

Check out why Hevo is the Best:

  • Secure: Hevo has a fault-tolerant architecture that ensures that the data is handled in a secure, consistent manner with zero data loss.
  • Schema Management: Hevo takes away the tedious task of schema management & automatically detects the schema of incoming data and maps it to the destination schema.
  • Minimal Learning: Hevo, with its simple and interactive UI, is extremely simple for new customers to work on and perform operations.
  • Hevo Is Built To Scale: As the number of sources and the volume of your data grows, Hevo scales horizontally, handling millions of records per minute with very little latency.
  • Incremental Data Load: Hevo allows the transfer of data that has been modified in real-time. This ensures efficient utilization of bandwidth on both ends.
  • Live Support: The Hevo team is available round the clock to extend exceptional support to its customers through chat, email, and support calls.
  • Live Monitoring: Hevo allows you to monitor the data flow and check where your data is at a particular point in time.
Sign up here for a 14-Day Free Trial!

Methods to Set Up the Jira Python Integration

It is preferable to analyze and modify data in Python Data Frames rather than in Jira Tables. To achieve this, you can set up a Jira Python Integration using the following methods: 

Method 1: Using the JIRA Library for Jira Python Integration

Python supports the JIRA library that allows you to connect with the Jira platform and manage your data. The following steps will guide you through this easy to implement this approach of the Jira Python Integration:

Step 1: Generate Authentication Token

Log into your Atlassian account and generate a token using this link. Save the token for use in upcoming steps. This token will authenticate your Jira Python Integration.

Step 2: Import the JIRA Library

Use the following pip command to install Jira for Python.

Now open a python compiler (for example anaconda) and import the Jira library that you just installed.

from jira import JIRA

Step 3: Construct a Client Instance

Construct a Client-instance that will request your required data from the Jira server. This will require the Server name (to which the client will send its data request) given by your Domain name. Moreover, the client will require authentication parameters like your email id and the token created in Step 1.

jiraOptions = {'server': "https://zxxxxxxpython.atlassian.net"}

The authentication parameter( to be used in the next step) will look like the following:

Step 4: Pass the Authentication Parameter

Now, pass the authentication parameters to configure the Client instance:

jira = JIRA(options=jiraOptions, basic_auth=("abxxxxxxh@gmail.com", "dejxxxxxxxxxxxxxxxxxxx7E"))

Step 5: Call the Required Instances

Now since your Client instance is ready, all that’s left is to export it. You can either call for all the instances related to a single project using the following code:

for singleIssue in jira.search_issues(jql_str='project = MedicineAppBugs'):
print('{}: {}:{}'.format(singleIssue.key, singleIssue.fields.summary,singleIssue.fields.reporter.displayName))

This will generate the output shown in the below image.

Jira Python Integration: Output
Image Source

Another option is to call only a single instance from your project. This requires the following code:

singleIssue = jira.issue('MED-1')
print('{}: {}:{}'.format(singleIssue.key,
                         singleIssue.fields.summary,
                         singleIssue.fields.reporter.displayName))

The output generated will be as shown in the below image.

Jira Python Integration: Output
Image Source

That’s it! Your Jira Python Integration is complete.

Method 2: Using the JIRA Rest API for Jira Python Integration

This method implements APIs to transfer the data from Jira to Python Data Frames. You can follow the below steps to set up the Jira Python Integration using APIs:

Step 1: Create the Authentication Token

Log into your Atlassian account and generate a token using this link. Save the token for use in upcoming steps. 

Step 2: Import Required Modules

Use the following code to Import the modules important for this process.

import requests
from requests.auth import HTTPBasicAuth
import json
import pandas as pd

Create a URL using your domain name to search for all issues related to your project.

url = "https://zxxxxxxpython.atlassian.net/rest/api/2/search"

Step 3: Create an Authentication Object

Now, you must create an authentication object that will include your email id and the token generated in Step 1. The following code will generate your authentication object.

auth = TPBasicAuth("abxxxxxxh@gmail.com", "dejxxxxxxxxxxxxxxxxxxx7E")

The following header will define the desired format in which you wish to get the output of your Jira Python Integration.

headers = { "Accept": "application/json"}

Mention your project name in the JQL query s shown in the below code. Otherwise, the API will fetch data from all the projects.

query = { 'jql': 'project =MedicineAppBugs '}

Step 4: Generate a Request Object

Now, generate a request object using JQL Query and authentication object of  Step 3.

response =requets.request(  "GET",  url,  headers=headers,  auth=auth,  params=query)

Use the following code to request for all the issues related to your project.

projectIssues = json.dumps(json.loads(response.text),                           sort_keys=True,indent=6,separators=(",", ": "))

You will get an output in the nested object which you should convert into a dictionary object for better understanding using the below code.

dictProjectIssues = json.loads(projectIssues)
listAllIssues = []
keyIssue, keySummary, keyReporter = "", "", ""

Step 5: Acess the Issues from your Project

All Issues from your Jira data are present, in the form of list elements, in the main API output. To access them, you need to loop through each element. Furthermore, since each Issue is also a nested dictionary object, apply the “iterateDictIssues” function, and fetch the required keys using the code below.

def iterateDictIssues(oIssues, listInner):

for key, values in oIssues.items():
    if(key == "fields"):
          fieldsDict = dict(values)
         iterateDictIssues(fieldsDict, listInner)
  elif (key == "reporter"):
         reporterDict = dict(values)
         iterateDictIssues(reporterDict, listInner)
elif(key == 'key'):
      keyIssue = values
      listInner.append(keyIssue)
elif(key == 'summary'):
       keySummary = values
       listInner.append(keySummary)
elif(key == "displayName"):
            keyReporter = values
            listInner.append(keyReporter)

for key, value in dictProjectIssues.items():
  
       if(key == "issues")
        totalIssues = len(value)
  
     
        for eachIssue in range(totalIssues):
            listInner = []  
           iterateDictIssues(value[eachIssue], listInner)  
           listAllIssues.append(listInner)

Step 6: Output the Results

The last step requires you to attach the output list, onto a Pandas’ data frame, and display the output.

dfIssues = pd.DataFrame(listAllIssues, columns=["Reporter","Summary","Key"])                                              
columnTiles = ["Key", "Summary", "Reporter"]
dfIssues = dfIssues.reindex(columns=columnTiles)
print(dfIssues)
Jira Python Integration: Output
Image Source

That’s it! Your Jira Python Integration using APIs is complete.

Advantages of Jira Python Integration

Now since you have understood the methods of setting up the Jira Python Integration, you should understand the importance of the same. Using Python with Jira will enhance your work in the following ways:

  • APIs are a convenient way to manage your Jira data. APIs provide you access to your data independently from the User interface. Jira API uses Python to transfer your data from Jira tables into a Pandas DataFrame. This provides you data in an independent form to clean, filter, or save it.
  • The Python modules have rich features that provide a simple way for you to manage and transform data, Moreover, it allows you to write custom scripts to visualize your data according to your requirements, something that is not possible while the data is stored in Jira. 
  • The Panda library is great at handling missing data. It has tools like series and data frames to manage both one-dimensional and 2-dimensional data. Furthermore, with the Jira Python Integration in place, you can merge, concatenate and reshape your Jira data easily. This allows you to transform the Jira Data in a form suitable for use.

Conclusion

This article introduced you to Jira and Python Programming Language along with their key features. It also explained 2 methods using which you can easily set up your Jira Python Integration and transfer your Jira data into Python Dataframes. The first method uses the Jira Library present in Python to call the issue-tracking data of projects. The second method implemented the Jira APIs to transfer the data from Jira to Python’s Dataframes. Furthermore, the blog listed down the benefits of implementing the Jira Python Integration.

Visit our Website to Explore Hevo

Jira is a great tool for tracking issues occurring in your ongoing projects. However, at times, you need to transfer this data to a Data Warehouse for further analysis. Building an in-house solution for this process could be an expensive and time-consuming task Hevo Data, on the other hand, offers a No-code Data Pipeline that can automate your data transfer process, hence allowing you to focus on other aspects of your business like Analytics, Customer Management, etc. This platform allows you to transfer data from 100+ sources like Jira to Cloud-based Data Warehouses like Snowflake, Google BigQuery, Amazon Redshift, etc. It will provide you with a hassle-free experience and make your work life much easier.

Want to take Hevo for a spin? Sign Up for a 14-day free trial and experience the feature-rich Hevo suite first hand. 

Share your views on the Jira Python Integration in the comments section!

No Code Data Pipeline For Your Data Warehouse