updateCitation 0.2.2__tar.gz → 0.2.3__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.
Files changed (39) hide show
  1. {updatecitation-0.2.2/updateCitation.egg-info → updatecitation-0.2.3}/PKG-INFO +7 -7
  2. {updatecitation-0.2.2 → updatecitation-0.2.3}/pyproject.toml +37 -18
  3. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/conftest.py +7 -7
  4. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/test_github.py +1 -1
  5. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation/__init__.py +0 -41
  6. updatecitation-0.2.3/updateCitation/citationFileFormat.py +75 -0
  7. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation/flowControl.py +4 -69
  8. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation/github.py +2 -249
  9. updatecitation-0.2.3/updateCitation/pypa.py +71 -0
  10. updatecitation-0.2.3/updateCitation/pypi.py +26 -0
  11. updatecitation-0.2.3/updateCitation/pyprojectDOTtoml.py +43 -0
  12. updatecitation-0.2.3/updateCitation/variables.py +254 -0
  13. {updatecitation-0.2.2 → updatecitation-0.2.3/updateCitation.egg-info}/PKG-INFO +7 -7
  14. updatecitation-0.2.3/updateCitation.egg-info/requires.txt +7 -0
  15. updatecitation-0.2.2/updateCitation/citationFileFormat.py +0 -219
  16. updatecitation-0.2.2/updateCitation/pypa.py +0 -231
  17. updatecitation-0.2.2/updateCitation/pypi.py +0 -121
  18. updatecitation-0.2.2/updateCitation/pyprojectDOTtoml.py +0 -171
  19. updatecitation-0.2.2/updateCitation/variables.py +0 -579
  20. updatecitation-0.2.2/updateCitation.egg-info/requires.txt +0 -7
  21. {updatecitation-0.2.2 → updatecitation-0.2.3}/LICENSE +0 -0
  22. {updatecitation-0.2.2 → updatecitation-0.2.3}/MANIFEST.in +0 -0
  23. {updatecitation-0.2.2 → updatecitation-0.2.3}/README.md +0 -0
  24. {updatecitation-0.2.2 → updatecitation-0.2.3}/setup.cfg +0 -0
  25. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/__init__.py +0 -0
  26. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/dataSamples/citationAlpha.cff +0 -0
  27. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/dataSamples/pyproject.toml +0 -0
  28. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/test_citationFileFormat.py +0 -0
  29. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/test_flowControl.py +0 -0
  30. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/test_pypa.py +0 -0
  31. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/test_pypi.py +0 -0
  32. {updatecitation-0.2.2 → updatecitation-0.2.3}/tests/test_variables.py +0 -0
  33. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation/_semiotics.py +0 -0
  34. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation/_theTypes.py +0 -0
  35. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation/py.typed +0 -0
  36. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation.egg-info/SOURCES.txt +0 -0
  37. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation.egg-info/dependency_links.txt +0 -0
  38. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation.egg-info/entry_points.txt +0 -0
  39. {updatecitation-0.2.2 → updatecitation-0.2.3}/updateCitation.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: updateCitation
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Automatically update citation files (CITATION.cff) in a GitHub repository from `pyproject.toml`, GitHub releases, and PyPI releases.
5
5
  Author-email: Hunter Hogan <HunterHogan@pm.me>
6
6
  License-Expression: CC-BY-NC-4.0
@@ -29,12 +29,12 @@ Classifier: Typing :: Typed
29
29
  Requires-Python: >=3.10
30
30
  Description-Content-Type: text/markdown
31
31
  License-File: LICENSE
32
- Requires-Dist: attrs
33
- Requires-Dist: cffconvert
34
- Requires-Dist: packaging
35
- Requires-Dist: pygithub
36
- Requires-Dist: ruamel.yaml
37
- Requires-Dist: tomli
32
+ Requires-Dist: attrs>=23.2
33
+ Requires-Dist: cffconvert>=2.0.0
34
+ Requires-Dist: packaging>=24.2
35
+ Requires-Dist: pygithub>=2.4
36
+ Requires-Dist: ruamel.yaml>=0.18.6
37
+ Requires-Dist: tomli>=2.0.1
38
38
  Requires-Dist: typing_extensions>=4.0.0
39
39
  Dynamic: license-file
40
40
 
@@ -1,7 +1,7 @@
1
1
  # path-sync copy -n hunterhogan
2
2
  [project]
3
3
  name = "updateCitation"
4
- version = "0.2.2"
4
+ version = "0.2.3"
5
5
  description = "Automatically update citation files (CITATION.cff) in a GitHub repository from `pyproject.toml`, GitHub releases, and PyPI releases."
6
6
  readme = { file = "README.md", content-type = "text/markdown" }
7
7
  requires-python = ">=3.10"
@@ -46,12 +46,12 @@ classifiers = [
46
46
  urls = { Donate = "https://www.patreon.com/integrated", Homepage = "https://github.com/hunterhogan/updateCitation", Repository = "https://github.com/hunterhogan/updateCitation.git" }
47
47
  scripts = { updateCitation = "updateCitation.flowControl:here" }
48
48
  dependencies = [
49
- "attrs",
50
- "cffconvert",
51
- "packaging",
52
- "pygithub",
53
- "ruamel.yaml",
54
- "tomli",
49
+ "attrs>=23.2",
50
+ "cffconvert>=2.0.0",
51
+ "packaging>=24.2",
52
+ "pygithub>=2.4",
53
+ "ruamel.yaml>=0.18.6",
54
+ "tomli>=2.0.1",
55
55
  "typing_extensions>= 4.0.0",
56
56
  ]
57
57
 
@@ -83,8 +83,10 @@ xml = { output = "tests/coverage/coverage.xml" }
83
83
  # === DO_NOT_EDIT: path-sync hunterhogan ===
84
84
  [tool.isort]
85
85
  add_imports = ["from __future__ import annotations"]
86
+ append_only = true
87
+ atomic = true
86
88
  combine_as_imports = true
87
- extend_skip_glob = ["*.ipynb", "*.pyi"]
89
+ extend_skip_glob = ["*.pyi"]
88
90
  filter_files = true
89
91
  force_alphabetical_sort_within_sections = true
90
92
  from_first = true
@@ -95,26 +97,23 @@ lines_after_imports = 1
95
97
  lines_between_types = 0
96
98
  multi_line_output = 4
97
99
  no_sections = true
98
- overwrite_in_place = true
100
+ skip_gitignore = true
99
101
  use_parentheses = true
100
102
  # === OK_EDIT: path-sync hunterhogan ===
101
103
 
102
104
  # === DO_NOT_EDIT: path-sync hunterhogan ===
103
105
  [tool.pyrefly]
104
- preset = "strict"
105
106
  enabled-ignores = ["pyrefly"]
107
+ # ignore-errors-in-generated-code = true
106
108
  infer-with-first-use = false
107
- project-excludes = ["typings", "typings/**/*", "**/node_modules", "**/__pycache__", "**/.*", ".v*"]
108
- site-packages-path = ["./typings"]
109
+ preset = "strict"
110
+ python-platform = "all"
109
111
  # === OK_EDIT: path-sync hunterhogan ===
110
112
 
111
113
  # === DO_NOT_EDIT: path-sync hunterhogan ===
112
114
  [tool.pyrefly.errors]
113
115
  bad-return = "warn"
114
- invalid-type-var = "warn"
115
116
  invalid-yield = "warn"
116
- protected-access = "warn"
117
- redundant-condition = "warn"
118
117
  # === OK_EDIT: path-sync hunterhogan ===
119
118
 
120
119
  [tool.pytest]
@@ -203,7 +202,7 @@ ignore = [
203
202
  preview = true
204
203
  select = ["ALL"]
205
204
  extend-select = ["missing-terminal-punctuation", "undocumented-param", "undocumented-public-init"]
206
- task-tags = ["DEVELOPMENT", "FailEarly", "NOTE", "SEMIOTICS", "TODO"]
205
+ task-tags = ["DEVELOPMENT", "NOTE", "SEMIOTICS", "TODO"]
207
206
  # === OK_EDIT: path-sync hunterhogan ===
208
207
 
209
208
  # === DO_NOT_EDIT: path-sync hunterhogan ===
@@ -252,7 +251,10 @@ inline-quotes = "single"
252
251
 
253
252
  # === DO_NOT_EDIT: path-sync hunterhogan ===
254
253
  [tool.ruff.lint.per-file-ignores]
255
- "*test*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
254
+ "**/*_test.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
255
+ "**/conftest*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
256
+ "**/test_*.py" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
257
+ "**/tests/**" = ["ARG", "assert", "BLE", "D", "DTZ", "FBT", "PT", "suspicious-non-cryptographic-random-usage", "TRY"]
256
258
  # === OK_EDIT: path-sync hunterhogan ===
257
259
 
258
260
  # === DO_NOT_EDIT: path-sync hunterhogan ===
@@ -263,8 +265,10 @@ convention = "numpy"
263
265
  # === DO_NOT_EDIT: path-sync hunterhogan ===
264
266
  [tool.ruff.format]
265
267
  docstring-code-format = true
266
- quote-style = "single"
267
268
  indent-style = "tab"
269
+ line-ending = "lf"
270
+ nested-string-quote-style = "preferred"
271
+ quote-style = "single"
268
272
  skip-magic-trailing-comma = true
269
273
  # === OK_EDIT: path-sync hunterhogan ===
270
274
 
@@ -272,6 +276,10 @@ skip-magic-trailing-comma = true
272
276
  package-data = { "*" = ["py.typed"] }
273
277
  packages = { find = { include = ["updateCitation", "updateCitation.*"] } }
274
278
 
279
+ # To fill `typings/` with these stubs, run this in this folder: uv run https://raw.githubusercontent.com/hunterhogan/stubFileNotFound/main/stubFileNotFound/installStubs.py
280
+ [tool.stubFileNotFound]
281
+ stubs = ["cffconvert"]
282
+
275
283
  # === DO_NOT_EDIT: path-sync hunterhogan ===
276
284
  [tool.tombi.format.rules]
277
285
  line-ending = "lf"
@@ -280,6 +288,7 @@ line-ending = "lf"
280
288
  # === DO_NOT_EDIT: path-sync hunterhogan ===
281
289
  [tool.ty.analysis]
282
290
  respect-type-ignore-comments = false
291
+ return-type-inference = "always"
283
292
  # === OK_EDIT: path-sync hunterhogan ===
284
293
 
285
294
  # === DO_NOT_EDIT: path-sync hunterhogan ===
@@ -288,6 +297,16 @@ extra-paths = ["./typings"]
288
297
  python-platform = "all"
289
298
  # === OK_EDIT: path-sync hunterhogan ===
290
299
 
300
+ # === DO_NOT_EDIT: path-sync hunterhogan ===
301
+ [tool.ty.rules]
302
+ blanket-ignore-comment = "error"
303
+ missing-override-decorator = "error"
304
+ missing-type-argument = "error"
305
+ possibly-missing-attribute = "warn" # Might annoy you: ty's docs say this rule produces many false positives.
306
+ possibly-unresolved-reference = "warn" # Might annoy you: ty's docs say this rule produces many false positives.
307
+ truthiness-test-of-none-union = "warn" # Might annoy you: flags `if value:` on `int | None` or `str | None` even when treating 0 or '' like None is deliberate.
308
+ # === OK_EDIT: path-sync hunterhogan ===
309
+
291
310
  [tool.updateCitation]
292
311
  filenameCitationDOTcff = "CITATION.cff"
293
312
  pathFilenameCitationSSOT = "citations/CITATION.cff"
@@ -30,12 +30,12 @@ def resetCitationNexusProtectedFields() -> None:
30
30
 
31
31
  @pytest.fixture
32
32
  def pathTmpTesting(tmp_path: Path) -> Path:
33
- """'path' means directory or folder, not file.""" # noqa: DOC201
33
+ """'path' means directory or folder, not file."""
34
34
  return tmp_path
35
35
 
36
36
  @pytest.fixture
37
37
  def pathFilenameTmpTesting(request: pytest.FixtureRequest, tmp_path: Path) -> Path:
38
- """'filename' means file; 'pathFilename' means the full path and filename.""" # noqa: DOC201
38
+ """'filename' means file; 'pathFilename' means the full path and filename."""
39
39
  try:
40
40
  extension = request.param
41
41
  except AttributeError:
@@ -55,7 +55,7 @@ def pathWorkingDirectory(request: pytest.FixtureRequest, tmp_path: Path, monkeyp
55
55
 
56
56
  @pytest.fixture
57
57
  def nexusCitationTesting(request: pytest.FixtureRequest) -> CitationNexus:
58
- """Return a CitationNexus object with the specified attributes.""" # noqa: DOC201
58
+ """Return a CitationNexus object with the specified attributes."""
59
59
  try:
60
60
  attributes: dict[str, Any] = request.param
61
61
  except AttributeError:
@@ -82,7 +82,7 @@ Section: Pytest fixtures for testing the updateCitation package"""
82
82
  def settingsPackageTesting() -> SettingsPackage:
83
83
  return SettingsPackage(
84
84
  pathFilenamePackageSSOT=pathDataSamples / filename_pyprojectDOTtomlDEFAULT,
85
- GITHUB_TOKEN="FAKE_TOKEN", # noqa: S106
85
+ GITHUB_TOKEN="FAKE_TOKEN", # ruff: ignore[hardcoded-password-func-arg]
86
86
  gitUserEmail="test@example.com",
87
87
  gitUserName="TestUserName",
88
88
  gitCommitMessage="TestCommitMessage",
@@ -92,7 +92,7 @@ def settingsPackageTesting() -> SettingsPackage:
92
92
  Section: Standardized assert statements and failure messages"""
93
93
 
94
94
  def uniformTestFailureMessage(expected: Any, actual: Any, functionName: str, *arguments: Any, **keywordArguments: Any) -> str:
95
- """Format assertion message for any test comparison.""" # noqa: DOC201
95
+ """Format assertion message for any test comparison."""
96
96
  listArgumentComponents = [str(parameter) for parameter in arguments]
97
97
  listKeywordComponents = [f"{key}={value}" for key, value in keywordArguments.items()]
98
98
  joinedArguments = ', '.join(listArgumentComponents + listKeywordComponents)
@@ -103,7 +103,7 @@ def uniformTestFailureMessage(expected: Any, actual: Any, functionName: str, *ar
103
103
 
104
104
  def standardizedEqualTo(expected: Any, functionTarget: Callable[..., Any], *arguments: Any, **keywordArguments: Any) -> None:
105
105
  """Template for most tests to compare the actual outcome with the expected outcome, including expected errors."""
106
- if type(expected) == type[Exception]: # noqa: E721
106
+ if type(expected) == type[Exception]: # ruff: ignore[type-comparison]
107
107
  messageExpected = expected.__name__
108
108
  else:
109
109
  messageExpected = expected
@@ -114,4 +114,4 @@ def standardizedEqualTo(expected: Any, functionTarget: Callable[..., Any], *argu
114
114
  messageActual = type(actualError).__name__
115
115
  actual = type(actualError)
116
116
 
117
- assert actual == expected, uniformTestFailureMessage(messageExpected, messageActual, functionTarget.__name__, *arguments, **keywordArguments) # ty:ignore[unresolved-attribute]
117
+ assert actual == expected, uniformTestFailureMessage(messageExpected, messageActual, functionTarget.__name__, *arguments, **keywordArguments) # ty:ignore[missing-attribute]
@@ -54,7 +54,7 @@ def test_updateCitationWorkflow_runsUpdateCitationAndExposesGitHubToken(
54
54
  for dictionaryStep in workflowData["jobs"]["updateCitation"]["steps"]
55
55
  if dictionaryStep.get("name") == "Run updateCitation"
56
56
  )
57
- assert dictionaryStepRun["env"]["GITHUB_TOKEN"] == "${{ github.token }}", ( # noqa: S105
57
+ assert dictionaryStepRun["env"]["GITHUB_TOKEN"] == "${{ github.token }}", ( # ruff: ignore[hardcoded-password-string]
58
58
  f"{pathFilenameWorkflow} did not expose github.token as GITHUB_TOKEN for updateCitation."
59
59
  )
60
60
  assert dictionaryStepRun["run"].strip() == "pipx run updateCitation", (
@@ -1,44 +1,3 @@
1
- """Access citation metadata aggregation and CITATION.cff generation.
2
-
3
- (AI generated docstring)
4
-
5
- You can use this package to aggregate citation metadata from multiple sources and
6
- generate valid Citation File Format (CFF) [1] files. The package reads metadata from
7
- `pyproject.toml` [2], PyPA packaging metadata [3], GitHub releases [4], and PyPI [5],
8
- then merges the metadata into a single `CitationNexus` object and writes a validated
9
- CITATION.cff file.
10
-
11
- Modules
12
- -------
13
- variables
14
- Core types, configuration, and data structures for citation metadata.
15
- pyprojectDOTtoml
16
- Read `pyproject.toml` settings and extract author and contact data.
17
- citationFileFormat
18
- Read, write, and validate CITATION.cff files using `cffconvert` and `ruamel.yaml`.
19
- pypa
20
- Extract and normalize PyPA packaging metadata for citation fields.
21
- github
22
- GitHub API integration for release data, authentication, and git operations.
23
- pypi
24
- Construct PyPI release URL for the `repositoryDASHartifact` citation field.
25
- flowControl
26
- Orchestrate the full citation update workflow.
27
-
28
- References
29
- ----------
30
- [1] Citation File Format (CFF) specification
31
- https://citation-file-format.github.io/
32
- [2] pyproject.toml specification - Python Packaging User Guide
33
- https://packaging.python.org/en/latest/specifications/pyproject-toml/
34
- [3] packaging - PyPA
35
- https://packaging.pypa.io/en/stable/
36
- [4] PyGithub - GitHub API client
37
- https://pygithub.readthedocs.io/en/stable/
38
- [5] PyPI - Python Package Index
39
- https://pypi.org/
40
-
41
- """
42
1
 
43
2
  # isort: split
44
3
  from __future__ import annotations
@@ -0,0 +1,75 @@
1
+ from __future__ import annotations
2
+
3
+ from cffconvert.cli.create_citation import create_citation
4
+ from operator import truth
5
+ from pathlib import Path
6
+ from typing import Any, TYPE_CHECKING
7
+ import attrs
8
+ import ruamel.yaml
9
+
10
+ if TYPE_CHECKING:
11
+ from cffconvert import Citation as cffCitation
12
+ from updateCitation import CitationNexus
13
+
14
+ def getCitation(pathFilenameCitationSSOT: Path) -> dict[str, Any]:
15
+ # Try to converge with cffconvert when possible.
16
+ citationObject: cffCitation = create_citation(infile=str(pathFilenameCitationSSOT), url=None)
17
+ # NOTE `._parse()` is `ruamel.yaml.YAML` loader
18
+ return citationObject._parse() # ruff: ignore[private-member-access]
19
+
20
+ def addCitation(nexusCitation: CitationNexus, pathFilenameCitationSSOT: Path) -> CitationNexus:
21
+ cffobj: dict[str, Any] = getCitation(pathFilenameCitationSSOT)
22
+
23
+ # This step is designed to prevent deleting fields that are populated in the current CFF file,
24
+ # but for whatever reason do not get added to the CitationNexus object.
25
+
26
+ for nexusCitationField in iter(attrs.fields(type(nexusCitation))):
27
+ cffobjKeyName: str = nexusCitationField.name.replace("DASH", "-")
28
+ cffobjValue = cffobj.get(cffobjKeyName)
29
+ if cffobjValue: # An empty list will be False
30
+ nexusCitation.__setattr__(nexusCitationField.name, cffobjValue, warn=False)
31
+
32
+ nexusCitation.setInStone("Citation")
33
+ return nexusCitation
34
+
35
+ def writeCitation(nexusCitation: CitationNexus, pathFilenameCitationSSOT: Path, pathFilenameCitationDOTcffRepo: Path | None = None) -> bool:
36
+ # NOTE embarrassingly hacky process to follow
37
+
38
+ # TODO format the output
39
+ # parameterIndent: int = 2 # ruff: ignore[commented-out-code]
40
+ # parameterLineWidth: int = 60 # ruff: ignore[commented-out-code]
41
+
42
+ # use `ruamel.yaml` because using the same packages and identifiers as `cffconvert` and other CFF ecosystem tools has benefits
43
+ yamlWorkhorse: ruamel.yaml.YAML = ruamel.yaml.YAML()
44
+
45
+ def fieldValueIsTruthy(_Z0Z_field: Any, Z0Z_value: Any) -> bool:
46
+ return truth(Z0Z_value) # empty lists and empty strings will be False
47
+
48
+ # Convert the attrs object to a dictionary.
49
+ dictionaryCitation: dict[str, Any] = attrs.asdict(nexusCitation, filter=fieldValueIsTruthy)
50
+
51
+ # Rename the keys to match the CFF format.
52
+ for keyName in list(dictionaryCitation.keys()):
53
+ dictionaryCitation[keyName.replace("DASH", "-")] = dictionaryCitation.pop(keyName)
54
+
55
+ # This function and this context manager only exist to work around the fact that `ruamel.yaml` does not support `Path` objects.
56
+ def writeStream(pathFilename: Path) -> None:
57
+ pathFilename = Path(pathFilename)
58
+ pathFilename.parent.mkdir(parents=True, exist_ok=True)
59
+ with open(pathFilename, 'w', encoding="utf-8") as pathlibIsAStealthContextManagerThatRuamelCannotDetectAndRefusesToWorkWith: # ruff: ignore[builtin-open]
60
+ yamlWorkhorse.dump(dictionaryCitation, pathlibIsAStealthContextManagerThatRuamelCannotDetectAndRefusesToWorkWith) # pyright: ignore[reportUnknownMemberType]
61
+
62
+ # Write the validation file because I haven't figured out how to validate it as a stream yet.
63
+ pathFilenameForValidation: Path = Path(pathFilenameCitationSSOT).with_stem('validation')
64
+ writeStream(pathFilenameForValidation)
65
+ citationObject: cffCitation = create_citation(infile=str(pathFilenameForValidation), url=None)
66
+ pathFilenameForValidation.unlink()
67
+
68
+ # If the validation succeeds, write the CFF file and the CFF repo file.
69
+ if citationObject.validate() is None:
70
+ writeStream(pathFilenameCitationSSOT)
71
+ if pathFilenameCitationDOTcffRepo is not None and pathFilenameCitationDOTcffRepo != pathFilenameCitationSSOT:
72
+ writeStream(pathFilenameCitationDOTcffRepo)
73
+ return True
74
+
75
+ return False
@@ -1,83 +1,18 @@
1
- """Orchestrate the full citation update workflow.
2
-
3
- (AI generated docstring)
4
-
5
- You can use this module to run the complete citation update process. The
6
- module reads settings from `pyproject.toml` [1], aggregates citation metadata
7
- from the existing CITATION.cff file, PyPA metadata, GitHub release data,
8
- and PyPI release data, then writes a validated CITATION.cff file and
9
- optionally commits and pushes the result.
10
-
11
- Contents
12
- --------
13
- Functions
14
- here
15
- Run the full citation update workflow from `pyproject.toml` to CITATION.cff.
16
-
17
- References
18
- ----------
19
- [1] pyproject.toml specification - Python Packaging User Guide
20
- https://packaging.python.org/en/latest/specifications/pyproject-toml/
21
-
22
- """
1
+ # ruff: file-ignore[undocumented-public-module, undocumented-public-function]
23
2
  from __future__ import annotations
24
3
 
25
4
  from pathlib import Path
26
- from typing import Any, TYPE_CHECKING
5
+ from typing import TYPE_CHECKING
27
6
  from updateCitation import (
28
7
  add_pyprojectDOTtoml, addCitation, addGitHubRelease, addGitHubSettings, addPyPAMetadata, addPyPIrelease, CitationNexus,
29
8
  filename_pyprojectDOTtomlDEFAULT, getSettingsPackage, gittyUpGitAmendGitHub, SettingsPackage, writeCitation)
30
9
 
31
10
  if TYPE_CHECKING:
32
11
  from os import PathLike
12
+ from typing import Any
33
13
 
34
14
  def here(pathFilename_pyprojectDOTtoml: str | PathLike[Any] | None = None) -> None:
35
- """Run the full citation update workflow from `pyproject.toml` to CITATION.cff.
36
-
37
- (AI generated docstring)
38
-
39
- You can call `here` to execute the complete citation update pipeline.
40
- The function reads package settings via `getSettingsPackage` [1], populates
41
- a `CitationNexus` [2] from `pyproject.toml` [3] author data, the existing
42
- CITATION.cff file, PyPA metadata, GitHub release information, and PyPI
43
- release data. The function then writes a validated CITATION.cff file using
44
- `writeCitation` [4] and optionally commits and pushes the changes via
45
- `gittyUpGitAmendGitHub` [5].
46
-
47
- Parameters
48
- ----------
49
- pathFilename_pyprojectDOTtoml : str | PathLike[Any] | None = None
50
- The full path to the `pyproject.toml` file. If `None`, the function
51
- uses the current working directory with the default filename.
52
-
53
- Raises
54
- ------
55
- ValueError
56
- If the package name (`nexusCitation.title`) is `None` after reading
57
- `pyproject.toml`.
58
-
59
- Examples
60
- --------
61
- Real usage from Z0Z_runUpdateCitation.py:
62
-
63
- import updateCitation
64
- updateCitation.here()
65
-
66
- References
67
- ----------
68
- [1] updateCitation.pyprojectDOTtoml.getSettingsPackage
69
- Internal package reference
70
- [2] updateCitation.variables.CitationNexus
71
- Internal package reference
72
- [3] pyproject.toml specification - Python Packaging User Guide
73
- https://packaging.python.org/en/latest/specifications/pyproject-toml/
74
- [4] updateCitation.citationFileFormat.writeCitation
75
- Internal package reference
76
- [5] updateCitation.github.gittyUpGitAmendGitHub
77
- Internal package reference
78
-
79
- """
80
- pathFilenameSettingsSSOT: Path = Path(pathFilename_pyprojectDOTtoml) if pathFilename_pyprojectDOTtoml else Path.cwd() / filename_pyprojectDOTtomlDEFAULT
15
+ pathFilenameSettingsSSOT: Path = Path(pathFilename_pyprojectDOTtoml or Path.cwd() / filename_pyprojectDOTtomlDEFAULT)
81
16
  truth: SettingsPackage = getSettingsPackage(pathFilenameSettingsSSOT)
82
17
 
83
18
  nexusCitation: CitationNexus = CitationNexus()