-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish 2412-1 and add Gantt chart (#28)
- **Add 'just cutoff' and 'just publish' commands** - **Update and add badges** - **Publish 2412-1** - **gantt ftw** --------- Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
- Loading branch information
Showing
8 changed files
with
175 additions
and
10 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,38 @@ | ||
beautifulsoup4==4.12.3 | ||
Brotli==1.1.0 | ||
bs4==0.0.2 | ||
certifi==2024.8.30 | ||
cffi==1.17.0 | ||
charset-normalizer==3.3.2 | ||
contourpy==1.3.0 | ||
cssselect2==0.7.0 | ||
cycler==0.12.1 | ||
fonttools==4.53.1 | ||
html5lib==1.1 | ||
icalendar==5.0.13 | ||
idna==3.8 | ||
kiwisolver==1.4.7 | ||
Markdown==3.7 | ||
matplotlib==3.9.2 | ||
narwhals==1.25.0 | ||
numpy==2.1.1 | ||
packaging==24.1 | ||
pandas==2.2.3 | ||
pdf2image==1.17.0 | ||
pillow==10.4.0 | ||
plotly==6.0.0 | ||
pycparser==2.22 | ||
pydyf==0.11.0 | ||
pyparsing==3.1.4 | ||
pyphen==0.16.0 | ||
python-dateutil==2.9.0.post0 | ||
pytz==2024.1 | ||
requests==2.32.3 | ||
six==1.16.0 | ||
soupsieve==2.6 | ||
tinycss2==1.3.0 | ||
tzdata==2025.1 | ||
urllib3==2.2.2 | ||
weasyprint==62.3 | ||
webencodings==0.5.1 | ||
zopfli==0.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import json | ||
import matplotlib.pyplot as plt | ||
import matplotlib.dates as mdates | ||
from datetime import datetime, timedelta | ||
import argparse | ||
import sys | ||
from typing import List, Dict, Any | ||
|
||
def parse_date(date_info: Any) -> datetime: | ||
if isinstance(date_info, str): | ||
return datetime.fromisoformat(date_info) | ||
elif isinstance(date_info, dict): | ||
date_str = date_info.get('when') or date_info.get('estimated') | ||
return datetime.fromisoformat(date_str) if date_str else None | ||
return None | ||
|
||
COLOR_RELEASED_BAR = '#E6007A' # released version | ||
COLOR_RELEASED_PATCH = '#E6007A' # released patch | ||
COLOR_PLANNED_BAR = '#a3a3a3' # planned version | ||
COLOR_PLANNED_PATCH = '#a3a3a3' # planned patch | ||
|
||
def process_releases(data: Dict) -> tuple[List[Dict], datetime, datetime]: | ||
tasks = [] | ||
min_date = datetime.max | ||
max_date = datetime.min | ||
|
||
sdk_data = data.get("Polkadot SDK", {}) | ||
releases = sdk_data.get("releases", []) | ||
|
||
for release in releases: | ||
name = release['name'] | ||
start_date = parse_date(release['publish']) | ||
end_date = parse_date(release['endOfLife']) | ||
|
||
if not (start_date and end_date): | ||
continue | ||
|
||
min_date = min(min_date, start_date) | ||
max_date = max(max_date, end_date) | ||
|
||
tasks.append({ | ||
'name': name, | ||
'start': start_date, | ||
'end': end_date, | ||
'color': COLOR_RELEASED_BAR if release['state'] == 'released' else COLOR_PLANNED_BAR | ||
}) | ||
|
||
for patch in release.get('patches', []): | ||
patch_date = parse_date(patch['publish']) | ||
if not patch_date: | ||
continue | ||
|
||
patch_end = patch_date + timedelta(days=7) | ||
max_date = max(max_date, patch_end) | ||
|
||
is_planned = isinstance(patch['publish'], dict) and 'estimated' in patch['publish'] | ||
|
||
tasks.append({ | ||
'name': patch['name'].split('-')[1], | ||
'start': patch_date, | ||
'end': patch_end, | ||
'color': COLOR_PLANNED_PATCH if is_planned else COLOR_RELEASED_PATCH | ||
}) | ||
|
||
return tasks, min_date, max_date | ||
|
||
def create_gantt_chart(tasks: List[Dict], min_date: datetime, max_date: datetime, output: str): | ||
fig, ax = plt.subplots(figsize=(15, 8)) | ||
|
||
# Plot bars | ||
for idx, task in enumerate(tasks): | ||
ax.barh(idx, | ||
(task['end'] - task['start']).days, | ||
left=task['start'], | ||
color=task['color'], | ||
alpha=0.8) | ||
|
||
# Customize axis | ||
ax.set_ylim(-0.5, len(tasks) - 0.5) | ||
ax.set_yticks(range(len(tasks))) | ||
ax.set_yticklabels([t['name'] for t in tasks]) | ||
|
||
# Format dates | ||
ax.xaxis.set_major_locator(mdates.MonthLocator()) | ||
ax.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m')) | ||
plt.xticks(rotation=45) | ||
|
||
# Add grid and title | ||
ax.grid(True, axis='x', alpha=0.3) | ||
ax.set_title('Polkadot SDK Release Timeline', pad=20) | ||
|
||
# Adjust layout and save | ||
plt.tight_layout() | ||
plt.savefig(output, dpi=300, bbox_inches='tight') | ||
plt.close() | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='Generate release timeline Gantt chart') | ||
parser.add_argument('input', help='Input JSON file path') | ||
parser.add_argument('-o', '--output', help='Output PNG file path', default='gantt.png') | ||
|
||
args = parser.parse_args() | ||
|
||
try: | ||
with open(args.input, 'r') as f: | ||
data = json.load(f) | ||
except Exception as e: | ||
print(f"Error reading input file: {e}", file=sys.stderr) | ||
sys.exit(1) | ||
|
||
tasks, min_date, max_date = process_releases(data) | ||
create_gantt_chart(tasks, min_date, max_date, args.output) | ||
|
||
if __name__ == '__main__': | ||
main() |