admin-toolbox 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- admin_toolbox-0.1.0/LICENSE +21 -0
- admin_toolbox-0.1.0/PKG-INFO +52 -0
- admin_toolbox-0.1.0/README.md +39 -0
- admin_toolbox-0.1.0/pyproject.toml +23 -0
- admin_toolbox-0.1.0/setup.cfg +4 -0
- admin_toolbox-0.1.0/src/admin_toolbox/__init__.py +0 -0
- admin_toolbox-0.1.0/src/admin_toolbox/cli.py +39 -0
- admin_toolbox-0.1.0/src/admin_toolbox/jira_report.py +46 -0
- admin_toolbox-0.1.0/src/admin_toolbox.egg-info/PKG-INFO +52 -0
- admin_toolbox-0.1.0/src/admin_toolbox.egg-info/SOURCES.txt +12 -0
- admin_toolbox-0.1.0/src/admin_toolbox.egg-info/dependency_links.txt +1 -0
- admin_toolbox-0.1.0/src/admin_toolbox.egg-info/entry_points.txt +2 -0
- admin_toolbox-0.1.0/src/admin_toolbox.egg-info/requires.txt +3 -0
- admin_toolbox-0.1.0/src/admin_toolbox.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Przemyslaw Sagalo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: admin-toolbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A collection of administration utility tools for various services.
|
|
5
|
+
Author: przemek@sagalo.pro
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: jira==3.8.0
|
|
10
|
+
Requires-Dist: click==8.1.7
|
|
11
|
+
Requires-Dist: python-dotenv==1.0.1
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Admin Toolbox
|
|
15
|
+
|
|
16
|
+
A collection of administration utility tools for various services.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install admin-toolbox
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Environment Variables
|
|
25
|
+
|
|
26
|
+
The following environment variables must be set (either in your environment or in a `.env` file):
|
|
27
|
+
|
|
28
|
+
- `JIRA_URL`: The full URL to your Jira instance (e.g., `https://yourdomain.atlassian.net`).
|
|
29
|
+
- `JIRA_PAT`: Your Personal Access Token for authentication.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### Jira Issue Report
|
|
34
|
+
|
|
35
|
+
Generates a Markdown report of Jira issues assigned to the current user, grouped by status.
|
|
36
|
+
|
|
37
|
+
**Behavior:**
|
|
38
|
+
- Includes all issues that are currently in an **open** state (not Done/Cancelled).
|
|
39
|
+
- Includes issues in a **closed** state (Done) ONLY if they were resolved within the specified date range.
|
|
40
|
+
- Excludes all issues in the **Cancelled** status.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
admin-toolbox jira-report --projects PROJ1 --projects PROJ2 --start-date 2024-01-01 --end-date 2024-03-31
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Options:**
|
|
47
|
+
|
|
48
|
+
- `--projects`, `-p`: (Required) List of Jira project keys to include. Can be specified multiple times.
|
|
49
|
+
- `--start-date`: (Optional) Start date for filtering closed/resolved tasks in `YYYY-MM-DD` format. Defaults to the first day of the current month.
|
|
50
|
+
- `--end-date`: (Optional) End date for filtering closed/resolved tasks in `YYYY-MM-DD` format. Defaults to the last day (Sunday) of the current week.
|
|
51
|
+
- `--output`, `-o`: (Optional) Output Markdown file name. Defaults to `jira_report.md`.
|
|
52
|
+
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Admin Toolbox
|
|
2
|
+
|
|
3
|
+
A collection of administration utility tools for various services.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install admin-toolbox
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Environment Variables
|
|
12
|
+
|
|
13
|
+
The following environment variables must be set (either in your environment or in a `.env` file):
|
|
14
|
+
|
|
15
|
+
- `JIRA_URL`: The full URL to your Jira instance (e.g., `https://yourdomain.atlassian.net`).
|
|
16
|
+
- `JIRA_PAT`: Your Personal Access Token for authentication.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Jira Issue Report
|
|
21
|
+
|
|
22
|
+
Generates a Markdown report of Jira issues assigned to the current user, grouped by status.
|
|
23
|
+
|
|
24
|
+
**Behavior:**
|
|
25
|
+
- Includes all issues that are currently in an **open** state (not Done/Cancelled).
|
|
26
|
+
- Includes issues in a **closed** state (Done) ONLY if they were resolved within the specified date range.
|
|
27
|
+
- Excludes all issues in the **Cancelled** status.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
admin-toolbox jira-report --projects PROJ1 --projects PROJ2 --start-date 2024-01-01 --end-date 2024-03-31
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Options:**
|
|
34
|
+
|
|
35
|
+
- `--projects`, `-p`: (Required) List of Jira project keys to include. Can be specified multiple times.
|
|
36
|
+
- `--start-date`: (Optional) Start date for filtering closed/resolved tasks in `YYYY-MM-DD` format. Defaults to the first day of the current month.
|
|
37
|
+
- `--end-date`: (Optional) End date for filtering closed/resolved tasks in `YYYY-MM-DD` format. Defaults to the last day (Sunday) of the current week.
|
|
38
|
+
- `--output`, `-o`: (Optional) Output Markdown file name. Defaults to `jira_report.md`.
|
|
39
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "admin-toolbox"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A collection of administration utility tools for various services."
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "przemek@sagalo.pro"}
|
|
7
|
+
]
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
|
|
12
|
+
dependencies = [
|
|
13
|
+
"jira==3.8.0",
|
|
14
|
+
"click==8.1.7",
|
|
15
|
+
"python-dotenv==1.0.1"
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.scripts]
|
|
19
|
+
admin-toolbox = "admin_toolbox.cli:main"
|
|
20
|
+
|
|
21
|
+
[build-system]
|
|
22
|
+
requires = ["setuptools >= 79.0.1"]
|
|
23
|
+
build-backend = "setuptools.build_meta"
|
|
File without changes
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from datetime import datetime, timedelta
|
|
3
|
+
from dotenv import load_dotenv
|
|
4
|
+
from admin_toolbox.jira_report import fetch_and_export_jira_issues
|
|
5
|
+
|
|
6
|
+
# Load environment variables from .env file
|
|
7
|
+
load_dotenv()
|
|
8
|
+
|
|
9
|
+
@click.group()
|
|
10
|
+
def main():
|
|
11
|
+
"""Admin Toolbox - A collection of utility tools."""
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
@main.command()
|
|
15
|
+
@click.option('--start-date', type=str, help='Start date for filtering CLOSED tasks (resolved >= date) in YYYY-MM-DD format (default: 1st of current month)')
|
|
16
|
+
@click.option('--end-date', type=str, help='End date for filtering CLOSED tasks (resolved <= date) in YYYY-MM-DD format (default: end of current week)')
|
|
17
|
+
@click.option('--projects', '-p', multiple=True, required=True, help='Jira project keys/names to include')
|
|
18
|
+
@click.option('--output', '-o', default='jira_report.md', help='Output Markdown file name')
|
|
19
|
+
def jira_report(start_date, end_date, projects, output):
|
|
20
|
+
"""Generate a status-grouped Jira issues report.
|
|
21
|
+
Includes all assigned open tasks and closed tasks resolved within the specified date range.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
today = datetime.now()
|
|
25
|
+
if not start_date:
|
|
26
|
+
start_date = today.replace(day=1).strftime('%Y-%m-%d')
|
|
27
|
+
if not end_date:
|
|
28
|
+
# Calculate the end of the current week (Sunday)
|
|
29
|
+
end_of_week = today + timedelta(days=(6 - today.weekday()))
|
|
30
|
+
end_date = end_of_week.strftime('%Y-%m-%d')
|
|
31
|
+
|
|
32
|
+
try:
|
|
33
|
+
fetch_and_export_jira_issues(projects, start_date, end_date, output)
|
|
34
|
+
click.echo(f"Report successfully generated: {output}")
|
|
35
|
+
except Exception as e:
|
|
36
|
+
click.echo(f"Error: {e}", err=True)
|
|
37
|
+
|
|
38
|
+
if __name__ == '__main__':
|
|
39
|
+
main()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from jira import JIRA
|
|
3
|
+
|
|
4
|
+
def fetch_and_export_jira_issues(projects, start_date, end_date, output_file):
|
|
5
|
+
jira_url = os.environ.get('JIRA_URL')
|
|
6
|
+
jira_pat = os.environ.get('JIRA_PAT')
|
|
7
|
+
|
|
8
|
+
if not jira_url or not jira_pat:
|
|
9
|
+
raise ValueError("Environment variables JIRA_URL and JIRA_PAT must be set.")
|
|
10
|
+
|
|
11
|
+
# Authenticate with Jira
|
|
12
|
+
jira = JIRA(server=jira_url, token_auth=jira_pat)
|
|
13
|
+
|
|
14
|
+
# Construct JQL query
|
|
15
|
+
project_list_str = ", ".join([f'"{p}"' for p in projects])
|
|
16
|
+
|
|
17
|
+
# JQL with full filtration for open/closed tasks
|
|
18
|
+
jql = (
|
|
19
|
+
f'project in ({project_list_str}) AND '
|
|
20
|
+
f'assignee = currentUser() AND '
|
|
21
|
+
f'status != "Cancelled" AND '
|
|
22
|
+
f'(status != "Done" OR (status = "Done" AND resolutiondate >= "{start_date}" AND resolutiondate <= "{end_date} 23:59")) '
|
|
23
|
+
f'ORDER BY status ASC, created ASC'
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Fetch issues
|
|
27
|
+
issues = jira.search_issues(jql, maxResults=False)
|
|
28
|
+
|
|
29
|
+
if not issues:
|
|
30
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
|
31
|
+
f.write("No issues found for the specified criteria.\n")
|
|
32
|
+
return
|
|
33
|
+
|
|
34
|
+
# Find the maximum status length for padding to ensure same size for all rows
|
|
35
|
+
max_status_len = max(len(issue.fields.status.name) for issue in issues)
|
|
36
|
+
|
|
37
|
+
# Write to Markdown file as a bulleted list
|
|
38
|
+
with open(output_file, 'w', encoding='utf-8') as f:
|
|
39
|
+
for issue in issues:
|
|
40
|
+
status = issue.fields.status.name
|
|
41
|
+
key = issue.key
|
|
42
|
+
summary = issue.fields.summary
|
|
43
|
+
|
|
44
|
+
# Pad status for consistent width
|
|
45
|
+
padded_status = status.ljust(max_status_len)
|
|
46
|
+
f.write(f"- [{padded_status}] {key} - {summary}\n")
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: admin-toolbox
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A collection of administration utility tools for various services.
|
|
5
|
+
Author: przemek@sagalo.pro
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: jira==3.8.0
|
|
10
|
+
Requires-Dist: click==8.1.7
|
|
11
|
+
Requires-Dist: python-dotenv==1.0.1
|
|
12
|
+
Dynamic: license-file
|
|
13
|
+
|
|
14
|
+
# Admin Toolbox
|
|
15
|
+
|
|
16
|
+
A collection of administration utility tools for various services.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install admin-toolbox
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Environment Variables
|
|
25
|
+
|
|
26
|
+
The following environment variables must be set (either in your environment or in a `.env` file):
|
|
27
|
+
|
|
28
|
+
- `JIRA_URL`: The full URL to your Jira instance (e.g., `https://yourdomain.atlassian.net`).
|
|
29
|
+
- `JIRA_PAT`: Your Personal Access Token for authentication.
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
### Jira Issue Report
|
|
34
|
+
|
|
35
|
+
Generates a Markdown report of Jira issues assigned to the current user, grouped by status.
|
|
36
|
+
|
|
37
|
+
**Behavior:**
|
|
38
|
+
- Includes all issues that are currently in an **open** state (not Done/Cancelled).
|
|
39
|
+
- Includes issues in a **closed** state (Done) ONLY if they were resolved within the specified date range.
|
|
40
|
+
- Excludes all issues in the **Cancelled** status.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
admin-toolbox jira-report --projects PROJ1 --projects PROJ2 --start-date 2024-01-01 --end-date 2024-03-31
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Options:**
|
|
47
|
+
|
|
48
|
+
- `--projects`, `-p`: (Required) List of Jira project keys to include. Can be specified multiple times.
|
|
49
|
+
- `--start-date`: (Optional) Start date for filtering closed/resolved tasks in `YYYY-MM-DD` format. Defaults to the first day of the current month.
|
|
50
|
+
- `--end-date`: (Optional) End date for filtering closed/resolved tasks in `YYYY-MM-DD` format. Defaults to the last day (Sunday) of the current week.
|
|
51
|
+
- `--output`, `-o`: (Optional) Output Markdown file name. Defaults to `jira_report.md`.
|
|
52
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/admin_toolbox/__init__.py
|
|
5
|
+
src/admin_toolbox/cli.py
|
|
6
|
+
src/admin_toolbox/jira_report.py
|
|
7
|
+
src/admin_toolbox.egg-info/PKG-INFO
|
|
8
|
+
src/admin_toolbox.egg-info/SOURCES.txt
|
|
9
|
+
src/admin_toolbox.egg-info/dependency_links.txt
|
|
10
|
+
src/admin_toolbox.egg-info/entry_points.txt
|
|
11
|
+
src/admin_toolbox.egg-info/requires.txt
|
|
12
|
+
src/admin_toolbox.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
admin_toolbox
|