estrellio-weekly-report-processor 0.1.0__py3-none-any.whl
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.
- estrellio_weekly_report_processor-0.1.0.dist-info/METADATA +77 -0
- estrellio_weekly_report_processor-0.1.0.dist-info/RECORD +10 -0
- estrellio_weekly_report_processor-0.1.0.dist-info/WHEEL +5 -0
- estrellio_weekly_report_processor-0.1.0.dist-info/entry_points.txt +2 -0
- estrellio_weekly_report_processor-0.1.0.dist-info/licenses/LICENSE +21 -0
- estrellio_weekly_report_processor-0.1.0.dist-info/top_level.txt +1 -0
- weekly_report_processor/__init__.py +46 -0
- weekly_report_processor/__main__.py +3 -0
- weekly_report_processor/cli.py +136 -0
- weekly_report_processor/core.py +5438 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: estrellio-weekly-report-processor
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Structured Markdown weekly report processing and export
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Dynamic: license-file
|
|
10
|
+
|
|
11
|
+
# Weekly report processor
|
|
12
|
+
|
|
13
|
+
A standard-library-only Python package for structured Markdown weekly reports:
|
|
14
|
+
XLSX and Outlook-friendly HTML export, weekly archiving, status sorting, and
|
|
15
|
+
missing-field completion. Python 3.10 or newer. MIT license.
|
|
16
|
+
|
|
17
|
+
## Install and use
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
pip install estrellio-weekly-report-processor
|
|
21
|
+
weekly-report -i report.md
|
|
22
|
+
weekly-report archive_weekly_progress -i report.md --output archived.md
|
|
23
|
+
weekly-report -i report.md --config layout.json --banner-week-offset -1
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The default operation exports both XLSX and HTML beside the input. Explicit
|
|
27
|
+
conversion commands choose one format. Maintenance commands rewrite the input
|
|
28
|
+
unless `--output` is supplied. They never invoke Git. Errors return a nonzero
|
|
29
|
+
exit status; successful commands print the generated paths.
|
|
30
|
+
|
|
31
|
+
Input and output paths are relative to the working directory. Image references
|
|
32
|
+
are resolved relative to the input Markdown. There is no automatic repository,
|
|
33
|
+
local configuration, or environment-profile discovery. `--config` explicitly
|
|
34
|
+
selects a JSON layout; a missing or invalid file fails. Without it, code defaults
|
|
35
|
+
apply. See `tests/fixtures/sample.md` for the heading structure and
|
|
36
|
+
`tests/fixtures/layout.json` for layout options.
|
|
37
|
+
|
|
38
|
+
## Python interface
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from weekly_report_processor import convert_report_markdown_to_excel
|
|
42
|
+
convert_report_markdown_to_excel("report.md", "report.xlsx")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Public functions also support HTML rendering, Markdown parsing/rendering,
|
|
46
|
+
archiving, sorting and field completion. `ReportLayoutConfig` carries formatting,
|
|
47
|
+
structure and optional project policy. A configuration can supply:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"project_rules": [["Example", "Example "]],
|
|
52
|
+
"default_project": "Other",
|
|
53
|
+
"project_order": ["Example", "Other"],
|
|
54
|
+
"variants": [["Complete report", null], ["Example report", "Example"]]
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Rules use the first case-sensitive title substring match. Unknown projects sort
|
|
59
|
+
stably after explicitly ordered ones. A null variant project exports all tasks;
|
|
60
|
+
a named variant filters tasks and summary entries. Other report sections are
|
|
61
|
+
preserved. Variant titles become filename suffixes and must be unique,
|
|
62
|
+
filename-safe names. The default policy has no named projects or variants and
|
|
63
|
+
produces one unfiltered report per requested format. Configuration is loaded
|
|
64
|
+
per call; no global project registry is modified.
|
|
65
|
+
|
|
66
|
+
## Development and release
|
|
67
|
+
|
|
68
|
+
Run `python -m pytest -q tests`. Build with `python -m build --wheel`, check with
|
|
69
|
+
`python -m twine check --strict dist/*.whl` and `python scripts/check_dist.py dist`.
|
|
70
|
+
Install the exact wheel and pytest in a separate virtual environment, then run
|
|
71
|
+
`python scripts/verify_install.py 0.1.0` with that environment's interpreter.
|
|
72
|
+
The verifier copies tests outside the checkout and uses isolated Python mode.
|
|
73
|
+
|
|
74
|
+
Source is maintained in a private GitHub repository. Only the pure Python wheel
|
|
75
|
+
is published. Version tags trigger the `publish.yml` workflow after Linux and
|
|
76
|
+
Windows installation tests on Python 3.10 and 3.12. Publishing uses the `pypi`
|
|
77
|
+
environment and PyPI Trusted Publishing.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
estrellio_weekly_report_processor-0.1.0.dist-info/licenses/LICENSE,sha256=yAt48nv6oAYMWjETk8lC71NkGtpIBX7Op_svNv43RDQ,1062
|
|
2
|
+
weekly_report_processor/__init__.py,sha256=RXMdY35__3446qZnI6kdOovteQdlS4tTX3LKzPTBn44,2296
|
|
3
|
+
weekly_report_processor/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
|
4
|
+
weekly_report_processor/cli.py,sha256=RbhYci6VMdg3nwAlggPPPknVmGpv7VBBLLMTiAD3rSM,5790
|
|
5
|
+
weekly_report_processor/core.py,sha256=cracbhq8VJUwN_Hxz2oVWBWi9ZKnw1K3BkcIy4V-w9M,179061
|
|
6
|
+
estrellio_weekly_report_processor-0.1.0.dist-info/METADATA,sha256=LJ60aySlyZVvp-dgevwOnta7OtBnWeme6PCTfOvrjFY,3316
|
|
7
|
+
estrellio_weekly_report_processor-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
8
|
+
estrellio_weekly_report_processor-0.1.0.dist-info/entry_points.txt,sha256=BkCX1S_oMzxia2jfvseZtYqJU_cf-fLGR4zRmVeCB0I,67
|
|
9
|
+
estrellio_weekly_report_processor-0.1.0.dist-info/top_level.txt,sha256=SYL8igiVgs7l0kKMwi3J0Vi85DRYtpa2hLM0eSRgnm0,24
|
|
10
|
+
estrellio_weekly_report_processor-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shade
|
|
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 @@
|
|
|
1
|
+
weekly_report_processor
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Structured Markdown weekly reports."""
|
|
2
|
+
from .core import (
|
|
3
|
+
parse_report_layout_config,
|
|
4
|
+
TaskItem,
|
|
5
|
+
SummaryHistorySnapshot,
|
|
6
|
+
ReportDocument,
|
|
7
|
+
RawTaskFieldBlock,
|
|
8
|
+
RawTaskBlock,
|
|
9
|
+
MarkdownTable,
|
|
10
|
+
MarkdownTextSegment,
|
|
11
|
+
MarkdownTableSegment,
|
|
12
|
+
SummaryProgressItem,
|
|
13
|
+
MarkdownImageReference,
|
|
14
|
+
CellSpec,
|
|
15
|
+
WorksheetImageSpec,
|
|
16
|
+
WorksheetSpec,
|
|
17
|
+
ReportColumnConfig,
|
|
18
|
+
ReportTypographyConfig,
|
|
19
|
+
ReportStyleConfig,
|
|
20
|
+
ReportOptionsConfig,
|
|
21
|
+
ReportBannerConfig,
|
|
22
|
+
ReportSectionConfig,
|
|
23
|
+
ReportStructureConfig,
|
|
24
|
+
ReportLayoutConfig,
|
|
25
|
+
parse_report_markdown,
|
|
26
|
+
extract_markdown_tables,
|
|
27
|
+
convert_report_markdown_to_excel,
|
|
28
|
+
convert_markdown_report_to_table_report,
|
|
29
|
+
convert_markdown_to_excel,
|
|
30
|
+
convert_report_markdown_to_outlook_html,
|
|
31
|
+
convert_report_markdown_to_versioned_outputs,
|
|
32
|
+
archive_weekly_progress,
|
|
33
|
+
sort_report_tasks_by_status,
|
|
34
|
+
fill_missing_report_fields,
|
|
35
|
+
render_report_markdown,
|
|
36
|
+
render_report_outlook_html,
|
|
37
|
+
build_report_banner_text,
|
|
38
|
+
get_default_report_typography,
|
|
39
|
+
get_default_report_styles,
|
|
40
|
+
get_default_report_structure,
|
|
41
|
+
get_default_report_layout,
|
|
42
|
+
load_report_layout_config,
|
|
43
|
+
sanitize_sheet_name,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
__all__ = ['parse_report_layout_config', 'TaskItem', 'SummaryHistorySnapshot', 'ReportDocument', 'RawTaskFieldBlock', 'RawTaskBlock', 'MarkdownTable', 'MarkdownTextSegment', 'MarkdownTableSegment', 'SummaryProgressItem', 'MarkdownImageReference', 'CellSpec', 'WorksheetImageSpec', 'WorksheetSpec', 'ReportColumnConfig', 'ReportTypographyConfig', 'ReportStyleConfig', 'ReportOptionsConfig', 'ReportBannerConfig', 'ReportSectionConfig', 'ReportStructureConfig', 'ReportLayoutConfig', 'parse_report_markdown', 'extract_markdown_tables', 'convert_report_markdown_to_excel', 'convert_markdown_report_to_table_report', 'convert_markdown_to_excel', 'convert_report_markdown_to_outlook_html', 'convert_report_markdown_to_versioned_outputs', 'archive_weekly_progress', 'sort_report_tasks_by_status', 'fill_missing_report_fields', 'render_report_markdown', 'render_report_outlook_html', 'build_report_banner_text', 'get_default_report_typography', 'get_default_report_styles', 'get_default_report_structure', 'get_default_report_layout', 'load_report_layout_config', 'sanitize_sheet_name']
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Standalone CLI: all paths are explicit or relative to the current directory."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
import argparse
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Optional, Sequence
|
|
6
|
+
from . import core
|
|
7
|
+
from .core import (DEFAULT_COMMAND, LEGACY_CONVERT_MARKDOWN_TO_EXCEL_COMMAND,
|
|
8
|
+
CONVERT_MARKDOWN_REPORT_TO_OUTLOOK_HTML_COMMAND, ARCHIVE_WEEKLY_PROGRESS_COMMAND,
|
|
9
|
+
SORT_REPORT_TASKS_BY_STATUS_COMMAND, FILL_MISSING_REPORT_FIELDS_COMMAND)
|
|
10
|
+
|
|
11
|
+
def _parse_args(argv: Optional[Sequence[str]] = None) -> argparse.Namespace:
|
|
12
|
+
parser = argparse.ArgumentParser(description="Markdown report utilities")
|
|
13
|
+
parser.add_argument(
|
|
14
|
+
"command",
|
|
15
|
+
nargs="?",
|
|
16
|
+
choices=(
|
|
17
|
+
DEFAULT_COMMAND,
|
|
18
|
+
LEGACY_CONVERT_MARKDOWN_TO_EXCEL_COMMAND,
|
|
19
|
+
CONVERT_MARKDOWN_REPORT_TO_OUTLOOK_HTML_COMMAND,
|
|
20
|
+
ARCHIVE_WEEKLY_PROGRESS_COMMAND,
|
|
21
|
+
SORT_REPORT_TASKS_BY_STATUS_COMMAND,
|
|
22
|
+
FILL_MISSING_REPORT_FIELDS_COMMAND,
|
|
23
|
+
),
|
|
24
|
+
help=(
|
|
25
|
+
"Command to run. Defaults to convert_markdown_report_to_table_report when omitted."
|
|
26
|
+
),
|
|
27
|
+
)
|
|
28
|
+
parser.add_argument(
|
|
29
|
+
"-convert_markdown_report_to_table_report",
|
|
30
|
+
"--convert_markdown_report_to_table_report",
|
|
31
|
+
action="store_true",
|
|
32
|
+
dest="convert_markdown_report_to_table_report_flag",
|
|
33
|
+
help="Run convert_markdown_report_to_table_report.",
|
|
34
|
+
)
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"-convert_markdown_to_excel",
|
|
37
|
+
"--convert_markdown_to_excel",
|
|
38
|
+
action="store_true",
|
|
39
|
+
dest="convert_markdown_to_excel_flag",
|
|
40
|
+
help="Legacy alias for convert_markdown_report_to_table_report.",
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"-convert_markdown_report_to_outlook_html",
|
|
44
|
+
"--convert_markdown_report_to_outlook_html",
|
|
45
|
+
action="store_true",
|
|
46
|
+
dest="convert_markdown_report_to_outlook_html_flag",
|
|
47
|
+
help="Run convert_markdown_report_to_outlook_html.",
|
|
48
|
+
)
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
"-archive_weekly_progress",
|
|
51
|
+
"--archive_weekly_progress",
|
|
52
|
+
action="store_true",
|
|
53
|
+
dest="archive_weekly_progress_flag",
|
|
54
|
+
help="Archive weekly progress into last-week and total-progress fields.",
|
|
55
|
+
)
|
|
56
|
+
parser.add_argument(
|
|
57
|
+
"-sort_report_tasks_by_status",
|
|
58
|
+
"--sort_report_tasks_by_status",
|
|
59
|
+
action="store_true",
|
|
60
|
+
dest="sort_report_tasks_by_status_flag",
|
|
61
|
+
help="Sort report task blocks by configured status order.",
|
|
62
|
+
)
|
|
63
|
+
parser.add_argument(
|
|
64
|
+
"-fill_missing_report_fields",
|
|
65
|
+
"--fill_missing_report_fields",
|
|
66
|
+
action="store_true",
|
|
67
|
+
dest="fill_missing_report_fields_flag",
|
|
68
|
+
help=(
|
|
69
|
+
"Fill missing report task fields from config defaults and write back markdown."
|
|
70
|
+
),
|
|
71
|
+
)
|
|
72
|
+
parser.add_argument(
|
|
73
|
+
"-i",
|
|
74
|
+
"--input-path",
|
|
75
|
+
dest="input_path",
|
|
76
|
+
help="Override the input markdown path from local txt config.",
|
|
77
|
+
)
|
|
78
|
+
parser.add_argument(
|
|
79
|
+
"-banner_week_offset",
|
|
80
|
+
"--banner-week-offset",
|
|
81
|
+
type=int,
|
|
82
|
+
default=0,
|
|
83
|
+
help=(
|
|
84
|
+
"Shift the report banner week by N weeks. "
|
|
85
|
+
"Use -1 to show the previous week."
|
|
86
|
+
),
|
|
87
|
+
)
|
|
88
|
+
parser.add_argument("--output", type=Path)
|
|
89
|
+
parser.add_argument("--config", type=Path)
|
|
90
|
+
args = parser.parse_args(argv)
|
|
91
|
+
|
|
92
|
+
selected_commands: list[str] = []
|
|
93
|
+
if args.command:
|
|
94
|
+
if args.command == LEGACY_CONVERT_MARKDOWN_TO_EXCEL_COMMAND:
|
|
95
|
+
selected_commands.append(DEFAULT_COMMAND)
|
|
96
|
+
else:
|
|
97
|
+
selected_commands.append(args.command)
|
|
98
|
+
if args.convert_markdown_report_to_table_report_flag:
|
|
99
|
+
selected_commands.append(DEFAULT_COMMAND)
|
|
100
|
+
if args.convert_markdown_to_excel_flag:
|
|
101
|
+
selected_commands.append(DEFAULT_COMMAND)
|
|
102
|
+
if args.convert_markdown_report_to_outlook_html_flag:
|
|
103
|
+
selected_commands.append(CONVERT_MARKDOWN_REPORT_TO_OUTLOOK_HTML_COMMAND)
|
|
104
|
+
if args.archive_weekly_progress_flag:
|
|
105
|
+
selected_commands.append(ARCHIVE_WEEKLY_PROGRESS_COMMAND)
|
|
106
|
+
if args.sort_report_tasks_by_status_flag:
|
|
107
|
+
selected_commands.append(SORT_REPORT_TASKS_BY_STATUS_COMMAND)
|
|
108
|
+
if args.fill_missing_report_fields_flag:
|
|
109
|
+
selected_commands.append(FILL_MISSING_REPORT_FIELDS_COMMAND)
|
|
110
|
+
|
|
111
|
+
unique_commands = list(dict.fromkeys(selected_commands))
|
|
112
|
+
if len(unique_commands) > 1:
|
|
113
|
+
parser.error("multiple commands specified")
|
|
114
|
+
|
|
115
|
+
args.default_command_requested = not unique_commands
|
|
116
|
+
args.command = unique_commands[0] if unique_commands else DEFAULT_COMMAND
|
|
117
|
+
return args
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def main(argv: Optional[Sequence[str]] = None) -> None:
|
|
121
|
+
args = _parse_args(argv)
|
|
122
|
+
if not args.input_path:
|
|
123
|
+
raise SystemExit("--input-path/-i is required")
|
|
124
|
+
source = Path(args.input_path).expanduser()
|
|
125
|
+
layout = core.load_report_layout_config(config_path=args.config)
|
|
126
|
+
if args.command == ARCHIVE_WEEKLY_PROGRESS_COMMAND:
|
|
127
|
+
outputs = [core.archive_weekly_progress(source, args.output, banner_week_offset=args.banner_week_offset, report_layout=layout)]
|
|
128
|
+
elif args.command == SORT_REPORT_TASKS_BY_STATUS_COMMAND:
|
|
129
|
+
outputs = [core.sort_report_tasks_by_status(source, args.output, report_layout=layout)]
|
|
130
|
+
elif args.command == FILL_MISSING_REPORT_FIELDS_COMMAND:
|
|
131
|
+
outputs = [core.fill_missing_report_fields(source, args.output, report_layout=layout)]
|
|
132
|
+
else:
|
|
133
|
+
formats = ("xlsx", "html") if args.default_command_requested else (("html",) if args.command == CONVERT_MARKDOWN_REPORT_TO_OUTLOOK_HTML_COMMAND else ("xlsx",))
|
|
134
|
+
outputs = core.convert_report_markdown_to_versioned_outputs(source, args.output or source.with_suffix(".xlsx"), output_formats=formats, banner_week_offset=args.banner_week_offset, report_layout=layout)
|
|
135
|
+
for output in outputs:
|
|
136
|
+
print(output)
|