CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-jira

Python library for interacting with JIRA via REST APIs.

Pending
Overview
Eval results
Files

issue-management.mddocs/

Issue Management

Comprehensive issue operations including creation, search, update, transitions, and bulk operations using JQL (JIRA Query Language). This is the core functionality for working with JIRA issues.

Capabilities

Issue Search & Retrieval

Search for issues using JIRA Query Language (JQL) and retrieve individual issues by ID or key.

def search_issues(
    self,
    jql_str: str,
    startAt: int = 0,
    maxResults: int = 50,
    validate_query: bool = True,
    fields: str = None,
    expand: str = None,
    json_result: bool = None
) -> list[Issue]:
    """
    Search for issues using JQL.
    
    Parameters:
    - jql_str: JQL query string
    - startAt: Starting index for pagination
    - maxResults: Maximum number of results to return
    - validate_query: Whether to validate JQL syntax
    - fields: Comma-separated list of fields to include
    - expand: Comma-separated list of properties to expand
    - json_result: Return raw JSON instead of Issue objects
    
    Returns:
    List of Issue objects matching the query
    """

def issue(self, id: str, fields: str = None, expand: str = None) -> Issue:
    """
    Get a single issue by ID or key.
    
    Parameters:
    - id: Issue ID or key (e.g., 'PROJ-123')
    - fields: Comma-separated list of fields to include
    - expand: Comma-separated list of properties to expand
    
    Returns:
    Issue object
    """

Usage examples:

# Search for issues in a project
issues = jira.search_issues('project = MYPROJ AND status = "To Do"')
for issue in issues:
    print(f"{issue.key}: {issue.fields.summary}")

# Search with specific fields
issues = jira.search_issues(
    'assignee = currentUser()',
    fields='summary,status,assignee',
    maxResults=20
)

# Get a specific issue
issue = jira.issue('PROJ-123')
print(f"Summary: {issue.fields.summary}")
print(f"Status: {issue.fields.status.name}")
print(f"Assignee: {issue.fields.assignee.displayName}")

# Get issue with expanded properties
issue = jira.issue('PROJ-123', expand='changelog,transitions')

Issue Creation

Create new issues with various field configurations and bulk creation capabilities.

def create_issue(self, fields: dict = None, prefetch: bool = True, **fieldargs) -> Issue:
    """
    Create a new issue.
    
    Parameters:
    - fields: Dictionary of field values
    - prefetch: Whether to fetch the created issue details
    - **fieldargs: Field values as keyword arguments
    
    Returns:
    Created Issue object
    """

def create_issues(self, field_list: list[dict], prefetch: bool = True) -> list[Issue]:
    """
    Bulk create multiple issues.
    
    Parameters:
    - field_list: List of field dictionaries for each issue
    - prefetch: Whether to fetch created issue details
    
    Returns:
    List of created Issue objects
    """

def createmeta(
    self,
    projectKeys: list[str] = None,
    projectIds: list[str] = [],
    issuetypeIds: list[str] = None,
    issuetypeNames: list[str] = None,
    expand: str = None
) -> dict:
    """
    Get metadata for creating issues.
    
    Parameters:
    - projectKeys: List of project keys to get metadata for
    - projectIds: List of project IDs to get metadata for
    - issuetypeIds: List of issue type IDs to include
    - issuetypeNames: List of issue type names to include
    - expand: Properties to expand
    
    Returns:
    Create metadata dictionary
    """

Usage examples:

# Create a simple issue
new_issue = jira.create_issue(
    project={'key': 'PROJ'},
    summary='New bug report',
    description='Description of the bug',
    issuetype={'name': 'Bug'},
    priority={'name': 'High'}
)
print(f"Created issue: {new_issue.key}")

# Create issue with custom fields
new_issue = jira.create_issue(
    project={'key': 'PROJ'},
    summary='Feature request',
    issuetype={'name': 'Story'},
    assignee={'name': 'john.doe'},
    labels=['frontend', 'ui'],
    customfield_10001='Custom value'
)

# Bulk create issues
issues_data = [
    {
        'project': {'key': 'PROJ'},
        'summary': 'First issue',
        'issuetype': {'name': 'Task'}
    },
    {
        'project': {'key': 'PROJ'},
        'summary': 'Second issue',
        'issuetype': {'name': 'Task'}
    }
]
created_issues = jira.create_issues(issues_data)

# Get create metadata before creating
meta = jira.createmeta(projectKeys=['PROJ'])
available_fields = meta['projects'][0]['issuetypes'][0]['fields']

Issue Assignment & Updates

Assign issues to users and get metadata for editing issues.

def assign_issue(self, issue: Issue, assignee: str) -> None:
    """
    Assign an issue to a user.
    
    Parameters:
    - issue: Issue object or issue key
    - assignee: Username to assign to, or None to unassign
    """

def editmeta(self, issue: Issue) -> dict:
    """
    Get metadata for editing an issue.
    
    Parameters:
    - issue: Issue object or issue key
    
    Returns:
    Edit metadata dictionary
    """

Usage examples:

# Assign issue to user
jira.assign_issue('PROJ-123', 'john.doe')

# Unassign issue
jira.assign_issue('PROJ-123', None)

# Get edit metadata
issue = jira.issue('PROJ-123')
edit_meta = jira.editmeta(issue)
editable_fields = edit_meta['fields'].keys()

Issue Transitions

Manage issue workflows and transitions between different statuses.

def transitions(self, issue: Issue, id: str = None, expand: str = None) -> list[dict]:
    """
    Get available transitions for an issue.
    
    Parameters:
    - issue: Issue object or issue key
    - id: Specific transition ID to get
    - expand: Properties to expand
    
    Returns:
    List of available transition dictionaries
    """

def find_transitionid_by_name(self, issue: Issue, transition_name: str) -> str:
    """
    Find transition ID by name.
    
    Parameters:
    - issue: Issue object or issue key
    - transition_name: Name of the transition
    
    Returns:
    Transition ID string
    """

def transition_issue(
    self,
    issue: Issue,
    transition: str,
    fields: dict = None,
    comment: str = None,
    worklog: dict = None,
    **fieldargs
) -> None:
    """
    Transition an issue to a new status.
    
    Parameters:
    - issue: Issue object or issue key
    - transition: Transition ID or name
    - fields: Dictionary of field updates
    - comment: Comment to add during transition
    - worklog: Worklog to add during transition
    - **fieldargs: Field updates as keyword arguments
    """

Usage examples:

# Get available transitions
issue = jira.issue('PROJ-123')
transitions = jira.transitions(issue)
for transition in transitions:
    print(f"ID: {transition['id']}, Name: {transition['name']}")

# Transition by name
jira.transition_issue(issue, 'In Progress')

# Transition with comment and field updates
jira.transition_issue(
    issue,
    'Resolve Issue',
    fields={'resolution': {'name': 'Fixed'}},
    comment='Issue has been resolved'
)

# Find transition ID by name
transition_id = jira.find_transitionid_by_name(issue, 'Close Issue')
jira.transition_issue(issue, transition_id)

Issue Links

Create and manage links between issues.

def create_issue_link(
    self,
    type: str,
    inwardIssue: str,
    outwardIssue: str,
    comment: dict = None
) -> None:
    """
    Create a link between two issues.
    
    Parameters:
    - type: Link type name (e.g., 'Blocks', 'Relates')
    - inwardIssue: Key of the inward issue
    - outwardIssue: Key of the outward issue
    - comment: Optional comment dictionary
    """

def delete_issue_link(self, id: str) -> None:
    """Delete an issue link by ID."""

def issue_link(self, id: str) -> dict:
    """Get issue link details by ID."""

def issue_link_types(self) -> list[dict]:
    """Get all available issue link types."""

def issue_link_type(self, id: str) -> dict:
    """Get specific issue link type by ID."""

Usage examples:

# Create issue link
jira.create_issue_link(
    type='Blocks',
    inwardIssue='PROJ-123',
    outwardIssue='PROJ-124'
)

# Get available link types
link_types = jira.issue_link_types()
for link_type in link_types:
    print(f"{link_type['name']}: {link_type['inward']} / {link_type['outward']}")

# Delete issue link
jira.delete_issue_link('12345')

Issue Types & Metadata

Retrieve issue types, priorities, resolutions, and other metadata.

def issue_types(self) -> list[dict]:
    """Get all issue types."""

def issue_type(self, id: str) -> dict:
    """Get issue type by ID."""

def issue_type_by_name(self, name: str) -> dict:
    """Get issue type by name."""

def priorities(self) -> list[dict]:
    """Get all priorities."""

def priority(self, id: str) -> dict:
    """Get priority by ID."""

def resolutions(self) -> list[dict]:
    """Get all resolutions."""

def resolution(self, id: str) -> dict:
    """Get resolution by ID."""

def statuses(self) -> list[dict]:
    """Get all statuses."""

def status(self, id: str) -> dict:
    """Get status by ID."""

def fields(self) -> list[dict]:
    """Get all issue fields."""

Usage examples:

# Get issue types
issue_types = jira.issue_types()
for issue_type in issue_types:
    print(f"{issue_type['name']}: {issue_type['description']}")

# Get priorities
priorities = jira.priorities()
highest_priority = next(p for p in priorities if p['name'] == 'Highest')

# Get all fields
fields = jira.fields()
custom_fields = [f for f in fields if f['custom']]

# Find specific field
summary_field = next(f for f in fields if f['name'] == 'Summary')

Votes & Watchers

Manage issue votes and watchers.

def votes(self, issue: Issue) -> dict:
    """Get vote information for an issue."""

def add_vote(self, issue: Issue) -> None:
    """Vote for an issue."""

def remove_vote(self, issue: Issue) -> None:
    """Remove vote from an issue."""

def watchers(self, issue: Issue) -> dict:
    """Get watchers for an issue."""

def add_watcher(self, issue: Issue, watcher: str) -> None:
    """Add a watcher to an issue."""

def remove_watcher(self, issue: Issue, watcher: str) -> None:
    """Remove a watcher from an issue."""

Usage examples:

# Get vote information
issue = jira.issue('PROJ-123')
votes = jira.votes(issue)
print(f"Votes: {votes['votes']}, Has voted: {votes['hasVoted']}")

# Vote for issue
jira.add_vote(issue)

# Get watchers
watchers = jira.watchers(issue)
print(f"Watching count: {watchers['watchCount']}")

# Add watcher
jira.add_watcher(issue, 'john.doe')

JQL Examples

Common JQL (JIRA Query Language) patterns for searching issues:

# Issues in specific project
jira.search_issues('project = PROJ')

# Issues assigned to current user
jira.search_issues('assignee = currentUser()')

# Open issues updated recently
jira.search_issues('status != Closed AND updated >= -7d')

# High priority bugs
jira.search_issues('priority = High AND type = Bug')

# Issues with specific labels
jira.search_issues('labels in (frontend, backend)')

# Issues in sprint
jira.search_issues('sprint = "Sprint 1"')

# Complex query with multiple conditions
jql = '''
project = PROJ AND
status in ("To Do", "In Progress") AND
assignee in (john.doe, jane.smith) AND
created >= -30d
ORDER BY priority DESC, created ASC
'''
issues = jira.search_issues(jql)

Install with Tessl CLI

npx tessl i tessl/pypi-jira@2.0.2

docs

administration.md

agile-boards.md

client-setup.md

comments-attachments.md

filters-dashboards.md

index.md

issue-management.md

project-management.md

remote-links.md

service-desk.md

system-operations.md

user-management.md

worklogs.md

tile.json