diff --git a/README.md b/README.md index 498bcd4..23b082f 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ python scripts/setup_issue_label.py description: ``` -#### `config/labels.yaml` preview +#### `labels/type_labels.yaml` preview ```yaml - name: 'Type: Feature Request' diff --git a/labels/_remove_labels.yaml b/labels/_remove_labels.yaml new file mode 100644 index 0000000..60ab7c8 --- /dev/null +++ b/labels/_remove_labels.yaml @@ -0,0 +1,11 @@ +- bug +- dependencies +- documentation +- duplicate +- enhancement +- github_actions +- help wanted +- invalid +- python +- question +- wontfix diff --git a/labels/affects_labels.yaml b/labels/affects_labels.yaml new file mode 100644 index 0000000..88afff6 --- /dev/null +++ b/labels/affects_labels.yaml @@ -0,0 +1,20 @@ +- name: 'Affects: Game Assets' + color: '#fbbc9d' + description: Issues relating directly to art and game assets. +- name: 'Affects: Game Logic/Controls' + color: '#fbbc9d' + description: Issues relating directly to game logic and controls. +- name: 'Affects: Game Performance' + color: '#fbbc9d' + description: Issues relating directly to squeezing game performance. +- name: 'Affects: Game Rendering' + color: '#fbbc9d' + description: Issues relating directly to game rendering. +- name: 'Affects: Infra' + color: '#fbbc9d' + description: Related to configuration, automation, CI, etc. +- name: 'Affects: Player Experience' + color: '#fbbc9d' + description: Issues relating directly to game design & player experience. +- name: 'Affects: Project Management' + color: '#fbbc9d' diff --git a/labels/close_labels.yaml b/labels/close_labels.yaml new file mode 100644 index 0000000..4a58220 --- /dev/null +++ b/labels/close_labels.yaml @@ -0,0 +1,17 @@ +- name: 'Close: Answered' + color: '#cdd1d5' +- name: 'Close: Backlog' + color: '#cdd1d5' + description: Issues are stale/expired; sent to backlog for later re-evaluation. +- name: 'Close: Duplicate' + color: '#cdd1d5' + description: This issue or pull request already exists (see comments for pointer + to it). +- name: 'Close: Not Actionable' + color: '#cdd1d5' +- name: 'Close: Not Reproducible' + color: '#cdd1d5' + description: Closed because we cannot reproduce the issue. +- name: 'Close: Will Not Fix' + color: '#cdd1d5' + description: Closed because we have decided not to address this (e.g. out of scope). diff --git a/labels/labels.yaml b/labels/labels.yaml new file mode 100644 index 0000000..5ad3871 --- /dev/null +++ b/labels/labels.yaml @@ -0,0 +1,113 @@ +- name: 'Priority: Critical' + color: '#7c0a02' +- name: 'Priority: High' + color: '#b22222' +- name: 'Priority: Medium' + color: '#ff8597' +- name: 'Priority: Low' + color: '#ffccc9' +- name: 'Type: Bug' + color: '#ff9900' + description: Something isn't working. +- name: 'Type: Documentation' + color: '#ff9900' + description: Improvements or additions to documentation. +- name: 'Type: Feature Request' + color: '#ff9900' + description: Issue describes a feature or enhancement we'd like to implement. +- name: 'Type: Question' + color: '#ff9900' + description: This issue doesn't require code. A question needs an answer. +- name: 'Type: Refactor/Clean-up' + color: '#ff9900' + description: Issues related to reorganization/clean-up of data or code (e.g. for + maintainability). +- name: 'Type: Suggestion' + color: '#ff9900' +- name: 'State: Blocked' + color: '#e07bf9' + description: Work has stopped, waiting for something (Info, Dependent fix, etc. + See comments). +- name: 'State: In Review' + color: '#e07bf9' + description: This issue is waiting for review to finish. +- name: 'State: Work In Progress' + color: '#e07bf9' + description: This issue is being actively worked on. +- name: 'Close: Answered' + color: '#cdd1d5' +- name: 'Close: Backlog' + color: '#cdd1d5' + description: Issues are stale/expired; sent to backlog for later re-evaluation. +- name: 'Close: Duplicate' + color: '#cdd1d5' + description: This issue or pull request already exists (see comments for pointer + to it). +- name: 'Close: Not Actionable' + color: '#cdd1d5' +- name: 'Close: Not Reproducible' + color: '#cdd1d5' + description: Closed because we cannot reproduce the issue. +- name: 'Close: Will Not Fix' + color: '#cdd1d5' + description: Closed because we have decided not to address this (e.g. out of scope). +- name: 'Needs: Breakdown' + color: '#0052cc' + description: This big issue needs a checklist or subissues to describe a breakdown + of work. +- name: 'Needs: Designs' + color: '#0052cc' +- name: 'Needs: Detail' + color: '#0052cc' + description: Submitter needs to provide more detail for this issue to be assessed + (see comments). +- name: 'Needs: Feedback' + color: '#0052cc' + description: A proposed feature or bug resolution needs feedback prior to forging + ahead. +- name: 'Needs: Help' + color: '#0052cc' + description: Issues, typically substantial ones, that need a dedicated developer + to take them on. +- name: 'Needs: Investigation' + color: '#0052cc' + description: This issue/PR needs a root-cause analysis to determine a solution. +- name: 'Needs: Response' + color: '#0052cc' + description: Issues which require feedback from staff members. +- name: 'Needs: Review' + color: '#0052cc' + description: This issue/PR needs to be reviewed in order to be closed or merged + (see comments) +- name: 'Needs: Revisiting' + color: '#0052cc' + description: Archived (usually noisy dependencies). +- name: 'Needs: Submitter Input' + color: '#0052cc' + description: Waiting on input from the creator of the issue/pr. +- name: 'Needs: Testing' + color: '#0052cc' +- name: 'Needs: Triage' + color: '#0052cc' + description: This issue needs triage. The team needs to decide who should own it, + what to do, by when. +- name: 'Affects: Game Assets' + color: '#fbbc9d' + description: Issues relating directly to art and game assets. +- name: 'Affects: Game Logic/Controls' + color: '#fbbc9d' + description: Issues relating directly to game logic and controls. +- name: 'Affects: Game Performance' + color: '#fbbc9d' + description: Issues relating directly to squeezing game performance. +- name: 'Affects: Game Rendering' + color: '#fbbc9d' + description: Issues relating directly to game rendering. +- name: 'Affects: Infra' + color: '#fbbc9d' + description: Related to configuration, automation, CI, etc. +- name: 'Affects: Player Experience' + color: '#fbbc9d' + description: Issues relating directly to game design & player experience. +- name: 'Affects: Project Management' + color: '#fbbc9d' diff --git a/labels/needs_labels.yaml b/labels/needs_labels.yaml new file mode 100644 index 0000000..58271f9 --- /dev/null +++ b/labels/needs_labels.yaml @@ -0,0 +1,40 @@ +- name: 'Needs: Breakdown' + color: '#0052cc' + description: This big issue needs a checklist or subissues to describe a breakdown + of work. +- name: 'Needs: Designs' + color: '#0052cc' +- name: 'Needs: Detail' + color: '#0052cc' + description: Submitter needs to provide more detail for this issue to be assessed + (see comments). +- name: 'Needs: Feedback' + color: '#0052cc' + description: A proposed feature or bug resolution needs feedback prior to forging + ahead. +- name: 'Needs: Help' + color: '#0052cc' + description: Issues, typically substantial ones, that need a dedicated developer + to take them on. +- name: 'Needs: Investigation' + color: '#0052cc' + description: This issue/PR needs a root-cause analysis to determine a solution. +- name: 'Needs: Response' + color: '#0052cc' + description: Issues which require feedback from staff members. +- name: 'Needs: Review' + color: '#0052cc' + description: This issue/PR needs to be reviewed in order to be closed or merged + (see comments) +- name: 'Needs: Revisiting' + color: '#0052cc' + description: Archived (usually noisy dependencies). +- name: 'Needs: Submitter Input' + color: '#0052cc' + description: Waiting on input from the creator of the issue/pr. +- name: 'Needs: Testing' + color: '#0052cc' +- name: 'Needs: Triage' + color: '#0052cc' + description: This issue needs triage. The team needs to decide who should own it, + what to do, by when. diff --git a/labels/priority_labels.yaml b/labels/priority_labels.yaml new file mode 100644 index 0000000..5e1980e --- /dev/null +++ b/labels/priority_labels.yaml @@ -0,0 +1,8 @@ +- name: 'Priority: Critical' + color: '#7c0a02' +- name: 'Priority: High' + color: '#b22222' +- name: 'Priority: Medium' + color: '#ff8597' +- name: 'Priority: Low' + color: '#ffccc9' diff --git a/labels/state_labels.yaml b/labels/state_labels.yaml new file mode 100644 index 0000000..2378492 --- /dev/null +++ b/labels/state_labels.yaml @@ -0,0 +1,10 @@ +- name: 'State: Blocked' + color: '#e07bf9' + description: Work has stopped, waiting for something (Info, Dependent fix, etc. + See comments). +- name: 'State: In Review' + color: '#e07bf9' + description: This issue is waiting for review to finish. +- name: 'State: Work In Progress' + color: '#e07bf9' + description: This issue is being actively worked on. diff --git a/config/labels.yaml b/labels/type_labels.yaml similarity index 64% rename from config/labels.yaml rename to labels/type_labels.yaml index 18ebbfd..145fc34 100644 --- a/config/labels.yaml +++ b/labels/type_labels.yaml @@ -1,26 +1,18 @@ -- name: 'Priority: Critical' - color: '#7c0a02' -- name: 'Priority: High' - color: '#b22222' -- name: 'Priority: Medium' - color: '#e88a1a' -- name: 'Priority: Low' - color: '#f1bc31' - name: 'Type: Bug' - color: '#d73a4a' + color: '#ff9900' description: Something isn't working. - name: 'Type: Documentation' - color: '#a2eeef' + color: '#ff9900' description: Improvements or additions to documentation. - name: 'Type: Feature Request' - color: '#e88a1a' + color: '#ff9900' description: Issue describes a feature or enhancement we'd like to implement. - name: 'Type: Question' - color: '#d876e3' + color: '#ff9900' description: This issue doesn't require code. A question needs an answer. - name: 'Type: Refactor/Clean-up' - color: '#a0855b' + color: '#ff9900' description: Issues related to reorganization/clean-up of data or code (e.g. for maintainability). - name: 'Type: Suggestion' - color: '#ac8daf' + color: '#ff9900' diff --git a/scripts/_create_label_config.py b/scripts/_create_label_config.py deleted file mode 100644 index 8c0698d..0000000 --- a/scripts/_create_label_config.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python - -""" -CLI helper script to create label config -in either json or yaml format -""" - -__author__ = "seyLu" -__github__ = "github.com/seyLu" - -__licence__ = "MIT" -__version__ = "0.0.1" -__maintainer__ = "seyLu" -__status__ = "Prototype" - -import os -from logging.config import fileConfig - -import yaml - -CONFIG_PATH: str = "config" -LABELS_FILE: str = os.path.join(CONFIG_PATH, "labels") -LABELS_EXT: str = "yaml" -LABELS: list[dict[str, str]] = [ - # ----- Priority -----# - { - "name": "Priority: Critical", - "color": "#7c0a02", - }, - { - "name": "Priority: High", - "color": "#b22222", - }, - { - "name": "Priority: Medium", - "color": "#e88a1a", - }, - { - "name": "Priority: Low", - "color": "#f1bc31", - }, - # --------------------# - # ------- Type -------# - { - "name": "Type: Bug", - "color": "#d73a4a", - "description": "Something isn't working.", - }, - { - "name": "Type: Documentation", - "color": "#a2eeef", - "description": "Improvements or additions to documentation.", - }, - { - "name": "Type: Feature Request", - "color": "#e88a1a", - "description": "Issue describes a feature or enhancement we'd like to implement.", - }, - { - "name": "Type: Question", - "color": "#d876e3", - "description": "This issue doesn't require code. A question needs an answer.", - }, - { - "name": "Type: Refactor/Clean-up", - "color": "#a0855b", - "description": "Issues related to reorganization/clean-up of data or code (e.g. for maintainability).", - }, - { - "name": "Type: Suggestion", - "color": "#ac8daf", - } - # --------------------# -] - - -def main() -> None: - labels_file: str = f"{LABELS_FILE}.{LABELS_EXT}" - os.makedirs(os.path.dirname(labels_file), exist_ok=True) - - with open(labels_file, "w+") as f: - print( - yaml.dump( - data=LABELS, - default_flow_style=False, - sort_keys=False, - ), - file=f, - ) - - -if __name__ == "__main__": - fileConfig("logging.ini") - main() diff --git a/scripts/_dump_labels.py b/scripts/_dump_labels.py new file mode 100644 index 0000000..50369de --- /dev/null +++ b/scripts/_dump_labels.py @@ -0,0 +1,311 @@ +#!/usr/bin/env python + +""" +CLI helper script to create label config +in either json or yaml format +""" + +__author__ = "seyLu" +__github__ = "github.com/seyLu" + +__licence__ = "MIT" +__version__ = "0.0.1" +__maintainer__ = "seyLu" +__status__ = "Prototype" + +import json +import logging +import os +from argparse import ArgumentParser, Namespace +from dataclasses import dataclass +from logging.config import fileConfig + +import yaml + +fileConfig("logging.ini") + + +@dataclass(frozen=True) +class LABELS: + _REMOVE: tuple[str, ...] = ( + "bug", + "dependencies", + "documentation", + "duplicate", + "enhancement", + "github_actions", + "help wanted", + "invalid", + "python", + "question", + "wontfix", + ) + PRIORITY: tuple[dict[str, str], ...] = ( + { + "name": "Priority: Critical", + "color": "#7c0a02", + }, + { + "name": "Priority: High", + "color": "#b22222", + }, + { + "name": "Priority: Medium", + "color": "#ff8597", + }, + { + "name": "Priority: Low", + "color": "#ffccc9", + }, + ) + TYPE: tuple[dict[str, str], ...] = ( + { + "name": "Type: Bug", + "color": "#ff9900", + "description": "Something isn't working.", + }, + { + "name": "Type: Documentation", + "color": "#ff9900", + "description": "Improvements or additions to documentation.", + }, + { + "name": "Type: Feature Request", + "color": "#ff9900", + "description": "Issue describes a feature or enhancement we'd like to implement.", + }, + { + "name": "Type: Question", + "color": "#ff9900", + "description": "This issue doesn't require code. A question needs an answer.", + }, + { + "name": "Type: Refactor/Clean-up", + "color": "#ff9900", + "description": "Issues related to reorganization/clean-up of data or code (e.g. for maintainability).", + }, + { + "name": "Type: Suggestion", + "color": "#ff9900", + }, + ) + STATE: tuple[dict[str, str], ...] = ( + { + "name": "State: Blocked", + "color": "#e07bf9", + "description": "Work has stopped, waiting for something (Info, Dependent fix, etc. See comments).", + }, + { + "name": "State: In Review", + "color": "#e07bf9", + "description": "This issue is waiting for review to finish.", + }, + { + "name": "State: Work In Progress", + "color": "#e07bf9", + "description": "This issue is being actively worked on.", + }, + ) + CLOSE: tuple[dict[str, str], ...] = ( + { + "name": "Close: Answered", + "color": "#cdd1d5", + }, + { + "name": "Close: Backlog", + "color": "#cdd1d5", + "description": "Issues are stale/expired; sent to backlog for later re-evaluation.", + }, + { + "name": "Close: Duplicate", + "color": "#cdd1d5", + "description": "This issue or pull request already exists (see comments for pointer to it).", + }, + { + "name": "Close: Not Actionable", + "color": "#cdd1d5", + }, + { + "name": "Close: Not Reproducible", + "color": "#cdd1d5", + "description": "Closed because we cannot reproduce the issue.", + }, + { + "name": "Close: Will Not Fix", + "color": "#cdd1d5", + "description": "Closed because we have decided not to address this (e.g. out of scope).", + }, + ) + NEEDS: tuple[dict[str, str], ...] = ( + { + "name": "Needs: Breakdown", + "color": "#0052cc", + "description": "This big issue needs a checklist or subissues to describe a breakdown of work.", + }, + { + "name": "Needs: Designs", + "color": "#0052cc", + }, + { + "name": "Needs: Detail", + "color": "#0052cc", + "description": "Submitter needs to provide more detail for this issue to be assessed (see comments).", + }, + { + "name": "Needs: Feedback", + "color": "#0052cc", + "description": "A proposed feature or bug resolution needs feedback prior to forging ahead.", + }, + { + "name": "Needs: Help", + "color": "#0052cc", + "description": "Issues, typically substantial ones, that need a dedicated developer to take them on.", + }, + { + "name": "Needs: Investigation", + "color": "#0052cc", + "description": "This issue/PR needs a root-cause analysis to determine a solution.", + }, + { + "name": "Needs: Response", + "color": "#0052cc", + "description": "Issues which require feedback from staff members.", + }, + { + "name": "Needs: Review", + "color": "#0052cc", + "description": "This issue/PR needs to be reviewed in order to be closed or merged (see comments)", + }, + { + "name": "Needs: Revisiting", + "color": "#0052cc", + "description": "Archived (usually noisy dependencies).", + }, + { + "name": "Needs: Submitter Input", + "color": "#0052cc", + "description": "Waiting on input from the creator of the issue/pr.", + }, + { + "name": "Needs: Testing", + "color": "#0052cc", + }, + { + "name": "Needs: Triage", + "color": "#0052cc", + "description": "This issue needs triage. The team needs to decide who should own it, what to do, by when.", + }, + ) + AFFECTS: tuple[dict[str, str], ...] = ( + { + "name": "Affects: Game Assets", + "color": "#fbbc9d", + "description": "Issues relating directly to art and game assets.", + }, + { + "name": "Affects: Game Logic/Controls", + "color": "#fbbc9d", + "description": "Issues relating directly to game logic and controls.", + }, + { + "name": "Affects: Game Performance", + "color": "#fbbc9d", + "description": "Issues relating directly to squeezing game performance.", + }, + { + "name": "Affects: Game Rendering", + "color": "#fbbc9d", + "description": "Issues relating directly to game rendering.", + }, + { + "name": "Affects: Infra", + "color": "#fbbc9d", + "description": "Related to configuration, automation, CI, etc.", + }, + { + "name": "Affects: Player Experience", + "color": "#fbbc9d", + "description": "Issues relating directly to game design & player experience.", + }, + { + "name": "Affects: Project Management", + "color": "#fbbc9d", + }, + ) + + +if __name__ == "__main__": + LABELS_PATH: str = "labels" + + parser: ArgumentParser = ArgumentParser() + parser.add_argument( + "--version", + "-v", + action="version", + version=f"%(prog)s {__version__}", + ) + parser.add_argument( + "--ext", + "-e", + choices=["json", "yaml"], + help="Specify a file extension", + ) + + args: Namespace = parser.parse_args() + + EXT: str = args.ext or "yaml" + + logging.info(f"Initializing {LABELS_PATH} dir.") + for filename in os.listdir(LABELS_PATH): + file_path: str = os.path.join(LABELS_PATH, filename) + if os.path.isfile(file_path): + os.remove(file_path) + + # @TODO remove + legacy_labels: tuple[dict[str, str], ...] = () + + for field in LABELS.__dataclass_fields__: + labels: tuple[dict[str, str], ...] | tuple[str, ...] = getattr(LABELS, field) + labels_file: str = os.path.join(LABELS_PATH, f"{field.lower()}_labels.{EXT}") + + # @TODO remove + if not ( + isinstance(labels, tuple) + and all(isinstance(label, str) for label in labels) + ): + legacy_labels += labels # type: ignore + + with open(labels_file, "w+") as f: + logging.info(f"Dumping to {f.name}.") + + if EXT == "yaml": + print( + yaml.dump( + data=list(labels), + default_flow_style=False, + sort_keys=False, + ), + file=f, + ) + elif EXT == "json": + json.dump(labels, f, indent=2) + + # backwards compatibility + # @TODO remove + legacy_labels_file: str = os.path.join(LABELS_PATH, f"labels.{EXT}") + with open(legacy_labels_file, "w+") as f: + logging.info(f"Dumping to {f.name}.") + + if EXT == "yaml": + print( + yaml.dump( + data=list(legacy_labels), + default_flow_style=False, + sort_keys=False, + ), + file=f, + ) + elif EXT == "json": + json.dump(legacy_labels, f, indent=2) + + logging.info("Finished dumping of labels.") diff --git a/scripts/setup_issue_label.py b/scripts/setup_issue_label.py index ca0c893..4cb087f 100644 --- a/scripts/setup_issue_label.py +++ b/scripts/setup_issue_label.py @@ -39,12 +39,12 @@ def validate_env(env: str) -> str: @dataclass(frozen=True) class BasePath: CWD: str = os.path.dirname(__file__) - CONFIG: str = "config" + LABELS: str = "labels" @dataclass(frozen=True) class LabelFile: - _BASE_FILE: str = os.path.join(BasePath.CWD, "..", BasePath.CONFIG, "labels") + _BASE_FILE: str = os.path.join(BasePath.CWD, "..", BasePath.LABELS, "labels") YAML: str = f"{_BASE_FILE}.yaml" JSON: str = f"{_BASE_FILE}.json" @@ -170,9 +170,14 @@ def delete_default_labels(self) -> None: "bug", "dependencies", "documentation", + "duplicate", "enhancement", "github_actions", + "help wanted", + "invalid", + "python", "question", + "wontfix", ] for default_label_name in DEFAULT_LABEL_NAMES: