Skip to content

Commit

Permalink
Release version 0.0.0.dev340
Browse files Browse the repository at this point in the history
  • Loading branch information
AAriam committed Oct 31, 2024
1 parent 4aedbf5 commit 68ddd59
Show file tree
Hide file tree
Showing 7 changed files with 130 additions and 101 deletions.
23 changes: 12 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespaces = true
# ----------------------------------------- Project Metadata -------------------------------------
#
[project]
version = "0.0.0.dev339"
version = "0.0.0.dev340"
name = "ControlMan"
dependencies = [
"packaging >= 23.2, < 24",
Expand All @@ -26,18 +26,19 @@ dependencies = [
"referencing == 0.35.1",
"jsonpath-ng == 1.6.1",
"ruamel.yaml == 0.17.40",
"PyLinks == 0.0.0.dev41",
"LoggerMan == 0.0.0.dev57",
"PySerials == 0.0.0.dev31",
"GitTidy == 0.0.0.dev54",
"Jinja2 == 3.0.2",
"PyLinks == 0.0.0.dev42",
"LoggerMan == 0.0.0.dev58",
"PySerials == 0.0.0.dev32",
"GitTidy == 0.0.0.dev55",
"PkgData == 0.0.0.dev5",
"PyShellMan == 0.0.0.dev18",
"PySyntax == 0.0.0.dev3",
"ExceptionMan == 0.0.0.dev28",
"MDit == 0.0.0.dev28",
"JSONSchemata == 0.0.0.dev27",
"PyShellMan == 0.0.0.dev19",
"PySyntax == 0.0.0.dev4",
"ExceptionMan == 0.0.0.dev29",
"MDit == 0.0.0.dev29",
"JSONSchemata == 0.0.0.dev28",
"VersionMan == 0.0.0.dev248",
"HTMP == 0.0.0.dev5",
"LicenseMan == 0.0.0.dev14",
"LicenseMan == 0.0.0.dev15",
]
requires-python = ">=3.10"
21 changes: 11 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ jsonschema >= 4.23, < 5
referencing == 0.35.1
jsonpath-ng == 1.6.1
ruamel.yaml == 0.17.40
PyLinks == 0.0.0.dev41
LoggerMan == 0.0.0.dev57
PySerials == 0.0.0.dev31
GitTidy == 0.0.0.dev54
Jinja2 == 3.0.2
PyLinks == 0.0.0.dev42
LoggerMan == 0.0.0.dev58
PySerials == 0.0.0.dev32
GitTidy == 0.0.0.dev55
PkgData == 0.0.0.dev5
PyShellMan == 0.0.0.dev18
PySyntax == 0.0.0.dev3
ExceptionMan == 0.0.0.dev28
MDit == 0.0.0.dev28
JSONSchemata == 0.0.0.dev27
PyShellMan == 0.0.0.dev19
PySyntax == 0.0.0.dev4
ExceptionMan == 0.0.0.dev29
MDit == 0.0.0.dev29
JSONSchemata == 0.0.0.dev28
VersionMan == 0.0.0.dev248
HTMP == 0.0.0.dev5
LicenseMan == 0.0.0.dev14
LicenseMan == 0.0.0.dev15
53 changes: 53 additions & 0 deletions src/controlman/_data/schema/def/cache-retention-hours.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
$id: https://controlman.repodynamics.com/schema/cache-retention-hours
$schema: https://json-schema.org/draft/2020-12/schema
title: Number of hours to keep different cached data.
description: |
After the specified duration,
the cached data is considered stale
and will be automatically synced with the source.
type: object
additionalProperties: false
default: { }
required: [ extension, repo, user, orcid, doi, python ]
properties:
extension:
title: Configuration extensions retrieved from external URLs.
description: |
These are extended data in control center configuration files
defined with the `!ext` tag.
default: 0
$ref: https://jsonschemata.repodynamics.com/number/non-negative
repo:
title: Repository data retrieved from GitHub API.
description: |
This includes general repository settings,
as well as details about discussion categories,
which are used for the website's blog.
default: 1
$ref: https://jsonschemata.repodynamics.com/number/non-negative
user:
title: Team member data retrieved from GitHub API.
description: |
This includes GitHub user data such as
name, email, avatar, bio, and other profile information.
default: 24
$ref: https://jsonschemata.repodynamics.com/number/non-negative
orcid:
title: Publications data retrieved from ORCID API.
description: |
This includes a list of all publication DOIs associated with an ORCID ID.
default: 240
$ref: https://jsonschemata.repodynamics.com/number/non-negative
doi:
title: Publication data retrieved from DOI API.
description: |
This corresponds to citation details associated with a specific DOI.
default: 1000
$ref: https://jsonschemata.repodynamics.com/number/non-negative
python:
title: Python version data retrieved from the Python GitHub repository.
description: |
This is a list of currently available Python versions,
used to update workflow configurations such as CI/CD/CT pipelines.
default: 500
$ref: https://jsonschemata.repodynamics.com/number/non-negative
17 changes: 7 additions & 10 deletions src/controlman/_data/schema/local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@ description: |
This allows you to easily maintain your own local configurations
without affecting the remote repository.
:::
examples:
- control:
cache:
retention_hours:
api: 1
extensions: 1
type: object
additionalProperties: false
properties:
control:
title: Control Center
description: Configurations for the project's control center.
$ref: user/ci.yaml#/properties/control
retention_hours:
title: Number of hours to keep different cached data.
description: |
After the specified duration,
the cached data is considered stale
and will be automatically synced with the source.
$ref: https://controlman.repodynamics.com/schema/cache-retention-hours
92 changes: 28 additions & 64 deletions src/controlman/_data/schema/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1817,7 +1817,7 @@ properties:
Initialize new changelog entry.
body: |
Issue #{{ issue.number }}
Pull #{{ pull.number }}
Pull #{{ pull_request.number }}
$ref: https://controlman.repodynamics.com/schema/commit-auto
config_sync:
title: Configuration Synchronization
Expand All @@ -1837,7 +1837,7 @@ properties:
type: refactor
scope: auto
description: >-
Refactor code.
Apply automatic formatting and refactoring.
$ref: https://controlman.repodynamics.com/schema/commit-auto
primary:
title: Primary Commits
Expand Down Expand Up @@ -2444,6 +2444,7 @@ properties:
Project's changelog templates and paths.
Configurations and templates for your project's changelogs and release notes.
type: object
default: { }
properties:
path:
title: Path
Expand Down Expand Up @@ -2550,10 +2551,10 @@ properties:
type: string
default: |
{%- macro make_user(user) -%}
{%- if user.name -%}
{{ user.name }} (@{{ user.login }})
{%- if user.name.full != user.github.id -%}
{{ user.name.full }} (@{{ user.github.id }})
{%- else -%}
@{{ user.login }}
@{{ user.github.id }}
{%- endif -%}
{%- endmacro -%}
Expand Down Expand Up @@ -2638,30 +2639,38 @@ properties:
{%- endmacro -%}
{%- macro make_user(user) -%}
{%- if user.name -%}
{{ user.name }} (@{{ user.login }})
{%- if user.name.full != user.github.id -%}
{{ user.name.full }} (@{{ user.github.id }})
{%- else -%}
@{{ user.login }}
@{{ user.github.id }}
{%- endif -%}
{%- endmacro -%}
{%- macro make_description() -%}
{%- if action == "assigned" -%}
Assigned to {{ make_user(assignee) }}.
{%- if event == "issues" -%}
Issue assigned to {{ make_user(assignee) }}.
{%- elif event == "pull_request" -%}
Pull request assigned to {{ make_user(assignee) }}.
{%- endif -%}
{%- elif action == "unassigned" -%}
Unassigned from {{ make_user(assignee) }}.
{%- if event == "issues" -%}
Issue unassigned from {{ make_user(assignee) }}.
{%- elif event == "pull_request" -%}
Pull request unassigned from {{ make_user(assignee) }}.
{%- endif -%}
{%- elif action == "review_requested" -%}
Assigned to {{ make_user(requested_reviewer) }} for review.
Review assigned to {{ make_user(requested_reviewer) }}.
{%- elif action == "review_request_removed" -%}
Unassigned from {{ make_user(requested_reviewer) }} for review.
Review unassigned from {{ make_user(requested_reviewer) }}.
{%- elif action == "synchronize" -%}
New commits pushed to [{{ head.name }}]({{ head.url }}) (CI [{{ context.run_id }}]({{ workflow_url }})).
{%- elif action == "labeled" -%}
{%- set category = label.category -%}
{%- if category == "type" -%}
Type set to `{{ label.suffix }}`.
{%- elif category == "subtype" -%}
Subtype set to `{{ label.suffix }}`.
{%- elif category == "scope" -%}
Scope set to `{{ label.suffix }}`.
{%- elif category == "version" -%}
Target version set to `{{ label.suffix }}`.
{%- elif category == "branch" -%}
Expand Down Expand Up @@ -2700,13 +2709,13 @@ properties:
{%- endif -%}
{%- elif action == "opened" -%}
{%- if event == "issues" -%}
Issue ticket #{{ payload.issue.number }} submitted by {{ make_user(creator) }}.
Issue ticket #{{ issue.number }} submitted by {{ make_user(issue.user) }}.
{%- elif event == "pull_request" -%}
Pull request #{{ payload.pull_request.number }} opened by {{ make_user(creator) }}.
Pull request #{{ pull_request.number }} opened from branch {{ by {{ make_user(pull_request.user) }}.
{%- endif -%}
{%- endif -%}
{%- endmacro %}
{{ make_entry(make_user(payload.sender), make_description()) -}}
{{ make_entry(make_user(sender), make_description()) -}}
references:
$ref: https://controlman.repodynamics.com/schema/doc-protocol-dynamic-data
default:
Expand Down Expand Up @@ -3593,55 +3602,10 @@ properties:
After the specified duration,
the cached data is considered stale
and will be automatically synced with the source.
type: object
additionalProperties: false
default: { }
required: [ extension, repo, user, orcid, doi, python ]
properties:
extension:
title: Configuration extensions retrieved from external URLs.
description: |
These are extended data in control center configuration files
defined with the `!ext` tag.
default: 0
$ref: https://jsonschemata.repodynamics.com/number/non-negative
repo:
title: Repository data retrieved from GitHub API.
description: |
This includes general repository settings,
as well as details about discussion categories,
which are used for the website's blog.
default: 1
$ref: https://jsonschemata.repodynamics.com/number/non-negative
user:
title: Team member data retrieved from GitHub API.
description: |
This includes GitHub user data such as
name, email, avatar, bio, and other profile information.
default: 24
$ref: https://jsonschemata.repodynamics.com/number/non-negative
orcid:
title: Publications data retrieved from ORCID API.
description: |
This includes a list of all publication DOIs associated with an ORCID ID.
default: 240
$ref: https://jsonschemata.repodynamics.com/number/non-negative
doi:
title: Publication data retrieved from DOI API.
description: |
This corresponds to citation details associated with a specific DOI.
default: 1000
$ref: https://jsonschemata.repodynamics.com/number/non-negative
python:
title: Python version data retrieved from the Python GitHub repository.
description: |
This is a list of currently available Python versions,
used to update workflow configurations such as CI/CD/CT pipelines.
default: 500
$ref: https://jsonschemata.repodynamics.com/number/non-negative
$ref: https://controlman.repodynamics.com/schema/cache-retention-hours
url:
title: URL of the project's configuration file.
default: ${{ repo.url.raw }}$/.github/.control/.metadata.json
default: ${{ repo.url.raw }}$/.github/.repodynamics/metadata.json
$ref: https://jsonschemata.repodynamics.com/url/https
workflow:
type: object
Expand Down
21 changes: 17 additions & 4 deletions src/controlman/center_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
DynamicDir as _DynamicDir,
)
from controlman import const
from controlman.exception import load as _load_exception
from controlman.cache_manager import CacheManager
from controlman import file_gen as _file_gen
from controlman import data_loader as _data_loader
Expand Down Expand Up @@ -45,12 +46,24 @@ def __init__(

self._path_root = self._git.repo_path
self._hook_manager = _HookManager(dir_path=self._path_cc / const.DIRNAME_CC_HOOK)
local_cache_path = self._data_before.get("local.cache.path")
relpath_local_cache = self._data_before.get("local.cache.path")
path_local_cache = None
retention_hours = self._data_before.get("control.cache.retention_hours", {})
if relpath_local_cache:
path_local_cache = self._path_root / relpath_local_cache
path_local_config = path_local_cache / const.FILENAME_LOCAL_CONFIG
if path_local_config.is_file():
with _logger.sectioning("Local Cache Configuration"):
try:
local_config = _ps.read.yaml_from_file(path=path_local_config, safe=True)
except _ps.exception.read.PySerialsInvalidDataError as e:
raise _load_exception.ControlManInvalidConfigFileDataError(cause=e) from None
_data_validator.validate(data=local_config, schema="local")
retention_hours = local_config.get("retention_hours", {})
self._cache_manager: CacheManager = CacheManager(
path_local_cache=self._path_root / local_cache_path if local_cache_path else None,
retention_hours=self._data_before.get("control.cache.retention_hours", {}),
path_local_cache=path_local_cache,
retention_hours=retention_hours,
)

self._data_raw: _ps.NestedDict | None = None
self._data: _ps.NestedDict | None = None
self._files: list[_GeneratedFile] = []
Expand Down
4 changes: 2 additions & 2 deletions src/controlman/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
DIRNAME_LOCAL_REPORT = "reports"
DIRNAME_LOCAL_REPODYNAMICS = "RepoDynamics"

FILEPATH_METADATA = ".github/.control/.metadata.json"
FILEPATH_METADATA = ".github/.repodynamics/metadata.json"
FILENAME_METADATA_CACHE = ".metadata_cache.yaml"
FILEPATH_LOCAL_CONFIG = ".github/.control/local_config.yaml"
FILENAME_LOCAL_CONFIG = "config.yaml"

DIRNAME_CC_HOOK = "hook"

Expand Down

0 comments on commit 68ddd59

Please sign in to comment.