Skip to main content

Collection of Python scripts for interacting with Jira tickets.

Project description

jps-jira-utils

Build & Test Publish to PyPI codecov Python Version License: MIT

A clean, modular, production-grade toolkit for Jira power users
Built with Typer, rich logging, and full test coverage.

Features

  • Unified CLIjps-jira-utils command with subcommands for all operations
  • Create Issuescreate_issue.py — Create new Jira issues with all required fields
    • Interactive prompts for issue type, summary, and description
    • Automatic reporter field handling (uses authenticated user)
    • Support for all required fields: Space (project), Work Type, Reporter, Title
    • Full validation and confirmation before creation
  • Add Commentsadd_comment.py — Add rich comments (with optional file attachments) to any Jira issue
    • Interactive multiline input (ends on two blank lines)
    • Load comment from file (--comment-file)
    • Attach files with pre-canned or custom notes (STDOUT, STDERR, log file, README, etc.)
    • Final confirmation table before posting
    • Full logging with structured output
    • Optional custom config file (--config-file)
  • Secure credential loading via ~/.config/jps-jira-utils/.jira.env (never in code or CLI)
  • Clean, maintainable, fully tested codebase using modern Python best practices
  • Zero external runtime dependencies beyond requests, typer, and python-dotenv

Installation

From source (recommended for development)

git clone https://github.com/jai-python3/jps-jira-utils.git
cd jps-jira-utils
make install    # creates .venv and installs in editable mode

From PyPI (coming soon)

pip install jps-jira-utils

Configuration

Setting up credentials

The tool requires Jira Cloud credentials to authenticate API requests. By default, credentials are loaded from:

~/.config/jps-jira-utils/.jira.env

Auto-create the configuration file

You can automatically create the configuration directory and file with placeholder values:

mkdir -p ~/.config/jps-jira-utils
cat > ~/.config/jps-jira-utils/.jira.env << 'EOF'
JIRA_BASE_URL=https://your-company.atlassian.net
JIRA_EMAIL=your.email@company.com
JIRA_API_TOKEN=your_api_token_here
EOF

Then edit the file with your actual credentials:

nano ~/.config/jps-jira-utils/.jira.env
# or use your preferred editor

Manual configuration

Create the configuration directory and file manually:

mkdir -p ~/.config/jps-jira-utils

Then create ~/.config/jps-jira-utils/.jira.env with your Jira Cloud credentials:

JIRA_BASE_URL=https://your-company.atlassian.net
JIRA_EMAIL=your.email@company.com
JIRA_API_TOKEN=your_api_token_here

Generate your API token at: https://id.atlassian.com/manage-profile/security/api-tokens

Using a custom config file

If you need to use a different location for your configuration file, you can specify it with the --config-file option:

jps-add-comment JPS-1234 --config-file /path/to/custom/.jira.env

Prerequisites

Python 3.11 or higher is required.

Usage

Unified CLI

View all available commands:

jps-jira-utils --help

Create a new issue

Create an issue interactively:

jps-jira-utils create-issue JPS

Or using the standalone command:

jps-jira-utils-create-issue JPS

Create with all details provided:

jps-jira-utils create-issue JPS \
  --summary "Fix login bug" \
  --issue-type Bug \
  --description "Users cannot log in with SSO"

Required fields for issue creation:

  • Space (Project key): e.g., JPS
  • Work Type (Issue type): e.g., Task, Bug, Story
  • Reporter: Automatically set to authenticated user's email
  • Title (Summary): Brief description of the issue

Add a comment to an issue

Add a comment interactively:

jps-jira-utils add-comment JPS-1234

Or using the standalone command:

jps-jira-utils-add-comment JPS-1234

Add a comment from a file + attach a log:

jps-jira-utils add-comment JPS-1234 \
  --comment-file results.txt \
  --attach-file test-run.log

Get help

Full help for any command:

jps-jira-utils --help
jps-jira-utils create-issue --help
jps-jira-utils add-comment --help

Development

# Format, lint, and fix everything
make fix
make format
make lint

Run tests with coverage

make test

Run pre-commit hooks (recommended)

pre-commit run --all-files

Project Structure

src/jps_jira_utils/
├── cli.py                # Main CLI entry point with subcommands
├── create_issue.py       # Create new Jira issues
├── add_comment.py        # Add comments to Jira issues
├── jira_helper.py        # Credential loading
├── logging_helper.py     # Structured logging setup
└── prompt_helper.py      # Interactive input utilities

tests/                    # Full test coverage with pytest
├── test_cli.py           # CLI tests
├── test_create_issue.py  # Issue creation tests
├── test_add_comment.py   # Comment addition tests
└── ...

Contributing

Contributions are welcome! Please:

Use pre-commit hooks Write tests for new features Follow Google-style docstrings Keep the codebase clean and modular

License

MIT License © Jaideep Sundaram

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

jps_jira_utils-0.9.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

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

jps_jira_utils-0.9.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file jps_jira_utils-0.9.0.tar.gz.

File metadata

  • Download URL: jps_jira_utils-0.9.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jps_jira_utils-0.9.0.tar.gz
Algorithm Hash digest
SHA256 ab716a6c225ddeb87f0f3706f98576fb8c396c868816215cf0e6ce7375927d7d
MD5 d3bbfca52239cda4538b5f7b6cc2b6aa
BLAKE2b-256 57917915c7b9ef288899f6f6b5548abbc7310b8606fa739f9f2caa83cd911848

See more details on using hashes here.

File details

Details for the file jps_jira_utils-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: jps_jira_utils-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jps_jira_utils-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96f46e10a8d512492811a6e17cc31b1d7893efaec8923578f7d3ee535e4ed70b
MD5 f7a334d0af51e8cba056e235342aaed3
BLAKE2b-256 0c1b8c139ee58a1c8f4078d301f3297639ead805c1df236d298cd6c7ffcc40fb

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