Skip to main content

Generating Jira report to see issue trends.

Project description

Jira HTML Report

jira-html-report is a Python script designed to generate reports from Jira. This script allows you to fetch and process data from your Jira projects, providing insights and summaries that can help you manage your projects more effectively.

Features

  • HTML report with charts and table sheet
  • Fetch data from Jira projects
  • Generate summary reports
  • Customizable report formats
  • Easy to use and configure

Sample charts and table

Charts
Table

Requirements

  • Python 3.x
  • Python external packages
jira
plotly
pandas
jinja2

Installation

  • Clone the repository:

    git clone https://github.com/freeyssu/jira-html-report.git
    cd jira-html-report
    pip install -r requirements.txt
    
  • Pypi package management:

    pip install jira-html-report
    

Directory and files

.
├── jira_html_report/
│   ├── html_templates/
│   │   ├── chart_templates.j2
│   │   ├── report_templates.j2
│   │   └── table_templates.j2
│   ├── data.py
│   └── report.py
└── samples/
    ├── sample.html
    ├── sample.ipynb
    └── sa,ple.py

Usage

  1. Initialize HTMLReport instance
from jira_html_report import HTMLReport
html_report = HTMLReport(server='https://YOUR_JIRA_SERVER', username=USERNAME password=PASSWORD)
  1. Query Jira items by JQL then generate Pandas DataFrame
jql = 'Project = TEST AND created > -7d'

# define fields what you extract from the queried Jira items
fields_for_charts = [
    'customfield_1000',     # custom fields
    'customfield_2000',     # what you want to get
    'customfield_3000',     # you should put field-id
    'status',
    'assignee',
    'reporter',
    'priority',
    'components'
]
fields_for_table = [
    'customfield_4000',     # you can add/remove any field for chart or table
    'status',
    'assignee'
]

# generate main DataFrame and sub DataFrames for chart.
# sub DataFrames are grouped by the selected fields and counted the rows. it has two columns (field name and Count)
chart_df, chart_sub_dfs = html_report.generate_dataframes_by_jql(jql=jql, fields=fields_for_charts, jql_search_limit=100)
table_df, table_sub_dfs = html_report.generate_dataframes_by_jql(jql=jql, fields=fields_for_table, jql_search_limit=100)

########################################################
# do something here to update the main or sub dataframes
# e.g. update column name
########################################################
  1. Draw charts
figures = {}
for field_name, sub_df in sub_dfs.items():
    figures[field_name] = html_report.generate_chart_figure(
        df=sub_df,
        chart_type='bar',
        chart_title=f'{sub_df.columns[0]} Status',
        x=sub_df.columns[0],
        y=sub_df.columns[1])

########################################################
# do something here to update chart properties
# figures['customfield_1000'].update_layout(...)
# figures['assignee'].update_traces(...)
# figures['field_x'] ...
########################################################
  1. Generate HTML code blocks for chart and table sheet
# generate HTML code block for charts
html_charts = {}
for field_name, figure in figures.items():
    html_charts[field_name] = html_report.generate_html_chart(figure=figure, static_chart=True)

# generate HTML code block for table
html_table = html_report.generate_html_table(df=table_df)
  1. Generate HTML report
html_report = html_report.generate_html_report(html_charts=html_charts, html_table=html_table)
with open('jira_report.html', 'wb') as f:
    f.write(html_report.encode())

HTML template modification

There are three Jinja2 templates under html_templates dir to generate a HTML report. You can modify or add any HTML properties/Python vars.

  1. Add/update vars or properties in Jinja2 template
<!-- add <h2> tag to html_templates/report_template.j2 -->
<h2> {{ new_h2_string_in_report }} </h2>
  1. Populate the vars
html_report = html_report.generate_html_report(html_charts=html_charts, html_table=html_table, new_h2_string_in_report="ADDED NEW H2 STRING")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jira_html_report-0.4.0.tar.gz (292.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jira_html_report-0.4.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file jira_html_report-0.4.0.tar.gz.

File metadata

  • Download URL: jira_html_report-0.4.0.tar.gz
  • Upload date:
  • Size: 292.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for jira_html_report-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0e211ebf17c43fbd6b25e1ba7b62932a00251d74bd8d6a5993a4601a35743099
MD5 2deb7805dfbd0a123f0675aa28cdf945
BLAKE2b-256 af212b86ded811151acc533ef89e507e724c24ef2dda17d51e041c31dde2ac99

See more details on using hashes here.

File details

Details for the file jira_html_report-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for jira_html_report-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e9055dd40caf52e532d958d1a5101f2072b1fb3d8a3b17e4b18a751e46323b9
MD5 b7d7287afa7409d9cd396c5dcf20b096
BLAKE2b-256 d3c3880631149438642b586bbad74ed271008bc124da0689992ee7b47df28e5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page