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
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.2.0.tar.gz (292.0 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.2.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jira_html_report-0.2.0.tar.gz
  • Upload date:
  • Size: 292.0 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.2.0.tar.gz
Algorithm Hash digest
SHA256 fe7b6152eb8d21470e1f9a118b7c539275afb82cb78651c5492424748b427a6b
MD5 0bb0c6b2ea60b5b45621a7e5bc5739ce
BLAKE2b-256 ad23502d64aa30343bbc2c5e336e92c2a2ccca74cb42f0ca35bf5965be3f5bf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for jira_html_report-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e08c40e5eead464309949359904371dea1019bf4379fc3942100c0a66cc3351
MD5 b63844157ec8a15733aa77ce722d5f14
BLAKE2b-256 1d2241e0f2d1ffe533ef8b1246aecec30e7f871df86f1161739a771f3889b914

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