Add Jira sprint support for 'did this sprint' / 'did last sprint' - #475
Add Jira sprint support for 'did this sprint' / 'did last sprint'#475evakhoni wants to merge 6 commits into
Conversation
4b22993 to
9533e28
Compare
| since, until, period = Date.get_month("last" in argument) | ||
|
|
||
| elif "sprint" in argument: | ||
| from did.plugins.jira import get_sprint_dates |
There was a problem hiding this comment.
This cycle is intentional — base.py needs to dispatch did this sprint to the Jira plugin, and the Jira plugin needs Date from base.py. The import is lazy (inside Date.period(), only executed when the user actually requests a sprint period), so the cycle is broken at runtime. This is the standard Python pattern for unavoidable circular dependencies.
There was a problem hiding this comment.
@psss I'm not able to verify if this is a pythonic way to handle this. Can you?
9533e28 to
6c22ef7
Compare
| sprint. For 'last sprint', returns the most recently closed sprint. | ||
| """ | ||
| # Import Date here to avoid circular dependency (base.py -> jira.py -> base.py) | ||
| from did.base import Date |
There was a problem hiding this comment.
same as in #475 (comment) just from the other end
- Add 'sprint' keyword to CLI argument parser - Implement get_sprint_dates() in jira plugin - Auto-discover Scrum board from project config - Support manual sprint_board override for multi-board projects - Query Agile API for active/closed sprint dates - Add comprehensive test coverage - Document sprint usage in config.rst Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
7bc1994 to
9420b17
Compare
|
@evakhoni why do you force push when this PR is under review?
|
Address autopep8 --hang-closing bracket style, flake8 W505 doc line length, and pylint cyclic-import warnings: - Move closing brackets/parens to align with content (autopep8 --hang-closing style) at 4 locations - Shorten docstring first line from 73 to 39 chars - Shorten comment from 79 to 55 chars to stay under 72 char limit - Add cyclic-import suppression in base.py (the lazy import breaks the cycle at runtime) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add return type annotation to get_sprint_dates() - Document the ``last`` parameter in the docstring - Rename period_name to sprint_name in docstring - Use ['this', 'sprint'] in test to match docstring description Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sort all sprints by endDate descending and take the most recent, regardless of whether we're looking for active or closed sprints. This removes a separate code path for "this sprint" and makes the behavior deterministic when parallel sprints are enabled. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Create JiraStatsGroup once upfront instead of conditionally inside the auto-discover branch and again via try/except NameError later. Both code paths need the authenticated session, so instantiating it early simplifies the control flow. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When multiple comma-separated projects are configured and sprint_board is not set, raise an error instead of silently using only the first project for board auto-discovery. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
the testing-farm failures seems unrelated to my changes |
|
@kwk Hi! I have solved the issues, and the CI failure is seems like a temporary outage unrelated to this pr. |

Summary
Adds support for sprint-based time periods (
did this sprintanddid last sprint) by integrating with the Jira Agile API. When used, all configured stats (git, GitHub, GitLab, Confluence, etc.) report against the sprint's date range instead of a calendar-based period.Motivation
Users working in agile environments track work in sprints, not calendar weeks. This feature enables generating activity reports scoped to sprint boundaries, making it easier to:
Implementation
Core changes
CLI keyword support (
did/cli.py):'sprint'to accepted keywords listDate period handling (
did/base.py):elif "sprint" in argumentbranch inDate.period()get_sprint_dates()from jira plugin to avoid circular dependencyJira Agile API integration (
did/plugins/jira.py):get_sprint_dates(last: bool)function:projectconfig via/rest/agile/1.0/boardendpointsprint_boardconfig for multi-board projects/rest/agile/1.0/board/{boardId}/sprint?state=active|closed(Date(start), Date(end), "sprint name")tupleJiraStatsGroupauth logic (supports GSS, basic, token)Documentation (
docs/config.rst):sprint_boardconfig optionTest coverage (
tests/unit/test_base.py):test_sprint_period(): Verifiesthis sprintperiod parsingtest_last_sprint_period(): Verifieslast sprintperiod parsingtest_sprint_keyword_accepted(): Ensuressprintkeyword passes validationAuto-discovery logic
When
sprint_boardis not explicitly configured:projectconfig (e.g.,MYPROJECTfromproject = MYPROJECT, OTHER)sprint_boardsprint_boardExample usage
Testing
All tests pass (33/33):
Manual testing verified:
did this sprintreturns current active sprint with correct date rangedid last sprintreturns most recently closed sprintprojectconfigCompatibility
[jira]config section withprojectorsprint_board