citesync 0.1.0__tar.gz → 0.3.0__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 (35) hide show
  1. citesync-0.3.0/PKG-INFO +126 -0
  2. citesync-0.3.0/README.md +96 -0
  3. {citesync-0.1.0 → citesync-0.3.0}/pyproject.toml +9 -3
  4. {citesync-0.1.0 → citesync-0.3.0}/pyproject.toml.orig +8 -4
  5. citesync-0.3.0/src/citesync/MAPPING_SOURCE +5 -0
  6. citesync-0.3.0/src/citesync/__main__.py +7 -0
  7. citesync-0.3.0/src/citesync/check.py +392 -0
  8. citesync-0.3.0/src/citesync/cli.py +458 -0
  9. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/codecs.py +82 -14
  10. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/config.py +105 -16
  11. citesync-0.3.0/src/citesync/core_metadata.py +131 -0
  12. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/formats.py +194 -57
  13. citesync-0.3.0/src/citesync/jsonsplice.py +77 -0
  14. citesync-0.3.0/src/citesync/mapping-local.json +728 -0
  15. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/mapping.py +30 -6
  16. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/mapping.schema.json +5 -1
  17. citesync-0.3.0/src/citesync/playground.py +198 -0
  18. citesync-0.3.0/src/citesync/playground_exports.py +153 -0
  19. citesync-0.3.0/src/citesync/positions.py +180 -0
  20. citesync-0.3.0/src/citesync/research_metadata.py +316 -0
  21. citesync-0.3.0/src/citesync/rules.py +240 -0
  22. citesync-0.3.0/src/citesync/write.py +796 -0
  23. citesync-0.1.0/PKG-INFO +0 -213
  24. citesync-0.1.0/README.md +0 -184
  25. citesync-0.1.0/src/citesync/MAPPING_SOURCE +0 -5
  26. citesync-0.1.0/src/citesync/check.py +0 -247
  27. citesync-0.1.0/src/citesync/cli.py +0 -202
  28. citesync-0.1.0/src/citesync/mapping-local.json +0 -408
  29. citesync-0.1.0/src/citesync/rules.py +0 -153
  30. citesync-0.1.0/src/citesync/write.py +0 -524
  31. {citesync-0.1.0 → citesync-0.3.0}/LICENSE +0 -0
  32. {citesync-0.1.0 → citesync-0.3.0}/NOTICE +0 -0
  33. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/__init__.py +0 -0
  34. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/errors.py +0 -0
  35. {citesync-0.1.0 → citesync-0.3.0}/src/citesync/py.typed +0 -0
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: citesync
3
+ Version: 0.3.0
4
+ Summary: Generate and synchronize software citation files from package metadata. CLI, pre-commit hook and browser playground.
5
+ Keywords: citation,CITATION.cff,codemeta,zenodo,software-metadata,pre-commit
6
+ Author: Simon van Lierde
7
+ Author-email: Simon van Lierde <code@duinlab.nl>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Topic :: Software Development :: Quality Assurance
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: packaging>=26.3
22
+ Requires-Dist: ruamel-yaml>=0.19
23
+ Requires-Dist: tomlkit>=0.15.2
24
+ Requires-Python: >=3.12
25
+ Project-URL: Homepage, https://simonvanlierde.com/citesync/
26
+ Project-URL: Source, https://github.com/simonvanlierde/citesync
27
+ Project-URL: Issues, https://github.com/simonvanlierde/citesync/issues
28
+ Project-URL: Changelog, https://github.com/simonvanlierde/citesync/blob/main/CHANGELOG.md
29
+ Description-Content-Type: text/markdown
30
+
31
+ # citesync
32
+
33
+ [![python](https://github.com/simonvanlierde/citesync/actions/workflows/python.yml/badge.svg)](https://github.com/simonvanlierde/citesync/actions/workflows/python.yml)
34
+ [![PyPI](https://img.shields.io/pypi/v/citesync)](https://pypi.org/project/citesync/)
35
+ [![Python versions](https://img.shields.io/pypi/pyversions/citesync)](https://pypi.org/project/citesync/)
36
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/simonvanlierde/citesync/badge)](https://scorecard.dev/viewer/?uri=github.com/simonvanlierde/citesync)
37
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/simonvanlierde/citesync/blob/main/LICENSE)
38
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23779706.svg)](https://doi.org/10.5281/zenodo.23779706)
39
+
40
+ Status: experimental. It may change in ways that break your code, without notice.
41
+
42
+ Questions and bugs: see [CONTRIBUTING.md](https://github.com/simonvanlierde/citesync/blob/main/.github/CONTRIBUTING.md).
43
+
44
+ Generate software citation files from package metadata, then keep them in sync across CITATION.cff, codemeta.json, .zenodo.json and package manifests. Use the CLI, a pre-commit hook or the [browser playground](https://simonvanlierde.com/citesync/). Field mappings come from CodeMeta's crosswalks, as exported by [codemeta-drift](https://github.com/simonvanlierde/codemeta-drift).
45
+
46
+ ## Usage
47
+
48
+ citesync compares eleven fields, from title to release date, with one file: the source. The source is CITATION.cff unless you pick another with `--source`. With neither, citesync exits 2. Use citesync through its command line and the pre-commit hook. Its Python modules are internal and may change in any release.
49
+
50
+ ```sh
51
+ uv tool install citesync # or run it once with uvx citesync check
52
+ citesync check # exit 0: no error finding; 1: an error finding; 2: citesync couldn't run
53
+ citesync check --source pyproject.toml
54
+ citesync write --diff # print what write would change, and change nothing
55
+ citesync write # rewrite the other files to agree with the source
56
+ citesync init # write a CITATION.cff from codemeta.json, .zenodo.json and the manifests
57
+ citesync explain version-mismatch # what a rule checks and how to fix it
58
+ citesync config # the config in use, and the file it came from
59
+ ```
60
+
61
+ ```text
62
+ codemeta.json:3:3: error[version-mismatch] version: '2.0.0', CITATION.cff has '1.0.0'
63
+ help: Make the file agree with the source, or the other way round if the source is wrong.
64
+ 1 error, 0 warnings in 3 files
65
+ 1 fixable with `citesync write`
66
+ ```
67
+
68
+ A config is optional. A one-line `citesync.toml` is `ignore = ["description-mismatch"]`.
69
+
70
+ `citesync --help` lists every command and option. The reference is in `docs/`:
71
+
72
+ - [How check works](https://github.com/simonvanlierde/citesync/blob/main/docs/check.md): the fields, files, options and exit codes.
73
+ - [How write works](https://github.com/simonvanlierde/citesync/blob/main/docs/write.md): what it changes and what it leaves alone.
74
+ - [Supported files](https://github.com/simonvanlierde/citesync/blob/main/docs/formats.md): which files citesync reads, updates and creates, including read-only Python distribution, R and Julia metadata.
75
+ - [How init works](https://github.com/simonvanlierde/citesync/blob/main/docs/init.md): where a new CITATION.cff takes each field from.
76
+ - [Rules](https://github.com/simonvanlierde/citesync/blob/main/docs/rules.md): each rule id, what it checks and how to fix it.
77
+ - [Configuration](https://github.com/simonvanlierde/citesync/blob/main/docs/config.md): where config goes, and every key.
78
+ - [Use citation exports with Pandoc](https://github.com/simonvanlierde/citesync/blob/main/docs/pandoc.md): cite software from the playground’s CSL-JSON or BibTeX files.
79
+ - [Output formats](https://github.com/simonvanlierde/citesync/blob/main/docs/output.md): JSON, GitHub annotations and SARIF.
80
+ - [Tested on real repositories](https://github.com/simonvanlierde/citesync/blob/main/docs/tested-repositories.md): what citesync reports on five public repositories.
81
+
82
+ ## Browser playground
83
+
84
+ Generate citation files from existing metadata or basic project details, without installing Python. [Open the playground](https://simonvanlierde.com/citesync/) or [run it locally](https://github.com/simonvanlierde/citesync/blob/main/playground/README.md). Files are processed in the browser; downloading the converter requires a network connection.
85
+
86
+ ## Pre-commit hook
87
+
88
+ For [prek](https://prek.j178.dev) or [pre-commit](https://pre-commit.com), in `.pre-commit-config.yaml`:
89
+
90
+ ```yaml
91
+ repos:
92
+ - repo: https://github.com/simonvanlierde/citesync
93
+ rev: v0.3.0
94
+ hooks:
95
+ - id: citesync
96
+ - id: citesync-write
97
+ ```
98
+
99
+ The `citesync` hook runs when a commit changes a supported metadata file or a citesync config, at any depth. It checks every file, not only the staged ones, and fails the commit on an error finding. The `citesync-write` hook runs only when you ask for it: `prek run citesync-write --stage manual --all-files`.
100
+
101
+ ## Development
102
+
103
+ You need [uv](https://docs.astral.sh/uv/), [just](https://just.systems), Node.js 26 and [pnpm](https://pnpm.io/).
104
+
105
+ ```sh
106
+ uv sync
107
+ pnpm install --frozen-lockfile
108
+ uv tool install prek # once per machine
109
+ prek install # git hooks
110
+ ```
111
+
112
+ `just` lists the tasks. They mirror what [.github/workflows/](https://github.com/simonvanlierde/citesync/tree/main/.github/workflows) runs.
113
+
114
+ ```sh
115
+ just check # lint, types and tests for every stack here
116
+ just fmt # apply each stack's fixes and formatting
117
+ just hooks # the git hooks, as the checks workflow runs them
118
+ ```
119
+
120
+ `just mutation` mutation-tests the modules `only_mutate` lists under `[tool.mutmut]` in `pyproject.toml`. CI doesn't run it. It fails when the tests miss a change that `tests/mutation-baseline.txt` doesn't list. A change that can't alter behaviour goes in that file, with the reason. It also fails when the tests now catch a listed change, so drop that line.
121
+
122
+ uv locks only releases at least a week old. If `just check` fails on a newer security fix, add the package to `exclude-newer-package` under `[tool.uv]` in `pyproject.toml`, and remove it a week later ([how](https://github.com/simonvanlierde/project-templates/blob/main/docs/tooling.md#dependencies)).
123
+
124
+ ## Licence
125
+
126
+ See [LICENSE](https://github.com/simonvanlierde/citesync/blob/main/LICENSE).
@@ -0,0 +1,96 @@
1
+ # citesync
2
+
3
+ [![python](https://github.com/simonvanlierde/citesync/actions/workflows/python.yml/badge.svg)](https://github.com/simonvanlierde/citesync/actions/workflows/python.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/citesync)](https://pypi.org/project/citesync/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/citesync)](https://pypi.org/project/citesync/)
6
+ [![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/simonvanlierde/citesync/badge)](https://scorecard.dev/viewer/?uri=github.com/simonvanlierde/citesync)
7
+ [![license](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://github.com/simonvanlierde/citesync/blob/main/LICENSE)
8
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.23779706.svg)](https://doi.org/10.5281/zenodo.23779706)
9
+
10
+ Status: experimental. It may change in ways that break your code, without notice.
11
+
12
+ Questions and bugs: see [CONTRIBUTING.md](https://github.com/simonvanlierde/citesync/blob/main/.github/CONTRIBUTING.md).
13
+
14
+ Generate software citation files from package metadata, then keep them in sync across CITATION.cff, codemeta.json, .zenodo.json and package manifests. Use the CLI, a pre-commit hook or the [browser playground](https://simonvanlierde.com/citesync/). Field mappings come from CodeMeta's crosswalks, as exported by [codemeta-drift](https://github.com/simonvanlierde/codemeta-drift).
15
+
16
+ ## Usage
17
+
18
+ citesync compares eleven fields, from title to release date, with one file: the source. The source is CITATION.cff unless you pick another with `--source`. With neither, citesync exits 2. Use citesync through its command line and the pre-commit hook. Its Python modules are internal and may change in any release.
19
+
20
+ ```sh
21
+ uv tool install citesync # or run it once with uvx citesync check
22
+ citesync check # exit 0: no error finding; 1: an error finding; 2: citesync couldn't run
23
+ citesync check --source pyproject.toml
24
+ citesync write --diff # print what write would change, and change nothing
25
+ citesync write # rewrite the other files to agree with the source
26
+ citesync init # write a CITATION.cff from codemeta.json, .zenodo.json and the manifests
27
+ citesync explain version-mismatch # what a rule checks and how to fix it
28
+ citesync config # the config in use, and the file it came from
29
+ ```
30
+
31
+ ```text
32
+ codemeta.json:3:3: error[version-mismatch] version: '2.0.0', CITATION.cff has '1.0.0'
33
+ help: Make the file agree with the source, or the other way round if the source is wrong.
34
+ 1 error, 0 warnings in 3 files
35
+ 1 fixable with `citesync write`
36
+ ```
37
+
38
+ A config is optional. A one-line `citesync.toml` is `ignore = ["description-mismatch"]`.
39
+
40
+ `citesync --help` lists every command and option. The reference is in `docs/`:
41
+
42
+ - [How check works](https://github.com/simonvanlierde/citesync/blob/main/docs/check.md): the fields, files, options and exit codes.
43
+ - [How write works](https://github.com/simonvanlierde/citesync/blob/main/docs/write.md): what it changes and what it leaves alone.
44
+ - [Supported files](https://github.com/simonvanlierde/citesync/blob/main/docs/formats.md): which files citesync reads, updates and creates, including read-only Python distribution, R and Julia metadata.
45
+ - [How init works](https://github.com/simonvanlierde/citesync/blob/main/docs/init.md): where a new CITATION.cff takes each field from.
46
+ - [Rules](https://github.com/simonvanlierde/citesync/blob/main/docs/rules.md): each rule id, what it checks and how to fix it.
47
+ - [Configuration](https://github.com/simonvanlierde/citesync/blob/main/docs/config.md): where config goes, and every key.
48
+ - [Use citation exports with Pandoc](https://github.com/simonvanlierde/citesync/blob/main/docs/pandoc.md): cite software from the playground’s CSL-JSON or BibTeX files.
49
+ - [Output formats](https://github.com/simonvanlierde/citesync/blob/main/docs/output.md): JSON, GitHub annotations and SARIF.
50
+ - [Tested on real repositories](https://github.com/simonvanlierde/citesync/blob/main/docs/tested-repositories.md): what citesync reports on five public repositories.
51
+
52
+ ## Browser playground
53
+
54
+ Generate citation files from existing metadata or basic project details, without installing Python. [Open the playground](https://simonvanlierde.com/citesync/) or [run it locally](https://github.com/simonvanlierde/citesync/blob/main/playground/README.md). Files are processed in the browser; downloading the converter requires a network connection.
55
+
56
+ ## Pre-commit hook
57
+
58
+ For [prek](https://prek.j178.dev) or [pre-commit](https://pre-commit.com), in `.pre-commit-config.yaml`:
59
+
60
+ ```yaml
61
+ repos:
62
+ - repo: https://github.com/simonvanlierde/citesync
63
+ rev: v0.3.0
64
+ hooks:
65
+ - id: citesync
66
+ - id: citesync-write
67
+ ```
68
+
69
+ The `citesync` hook runs when a commit changes a supported metadata file or a citesync config, at any depth. It checks every file, not only the staged ones, and fails the commit on an error finding. The `citesync-write` hook runs only when you ask for it: `prek run citesync-write --stage manual --all-files`.
70
+
71
+ ## Development
72
+
73
+ You need [uv](https://docs.astral.sh/uv/), [just](https://just.systems), Node.js 26 and [pnpm](https://pnpm.io/).
74
+
75
+ ```sh
76
+ uv sync
77
+ pnpm install --frozen-lockfile
78
+ uv tool install prek # once per machine
79
+ prek install # git hooks
80
+ ```
81
+
82
+ `just` lists the tasks. They mirror what [.github/workflows/](https://github.com/simonvanlierde/citesync/tree/main/.github/workflows) runs.
83
+
84
+ ```sh
85
+ just check # lint, types and tests for every stack here
86
+ just fmt # apply each stack's fixes and formatting
87
+ just hooks # the git hooks, as the checks workflow runs them
88
+ ```
89
+
90
+ `just mutation` mutation-tests the modules `only_mutate` lists under `[tool.mutmut]` in `pyproject.toml`. CI doesn't run it. It fails when the tests miss a change that `tests/mutation-baseline.txt` doesn't list. A change that can't alter behaviour goes in that file, with the reason. It also fails when the tests now catch a listed change, so drop that line.
91
+
92
+ uv locks only releases at least a week old. If `just check` fails on a newer security fix, add the package to `exclude-newer-package` under `[tool.uv]` in `pyproject.toml`, and remove it a week later ([how](https://github.com/simonvanlierde/project-templates/blob/main/docs/tooling.md#dependencies)).
93
+
94
+ ## Licence
95
+
96
+ See [LICENSE](https://github.com/simonvanlierde/citesync/blob/main/LICENSE).
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "citesync"
3
- version = "0.1.0"
4
- description = "Check that CITATION.cff, codemeta.json, .zenodo.json and the package manifests (pyproject.toml, Cargo.toml, package.json) agree, and rewrite them to match one source file, using the CodeMeta crosswalks"
3
+ version = "0.3.0"
4
+ description = "Generate and synchronize software citation files from package metadata. CLI, pre-commit hook and browser playground."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
7
  license = "Apache-2.0"
@@ -43,7 +43,8 @@ email = "code@duinlab.nl"
43
43
  citesync = "citesync.cli:main"
44
44
 
45
45
  [project.urls]
46
- Homepage = "https://github.com/simonvanlierde/citesync"
46
+ Homepage = "https://simonvanlierde.com/citesync/"
47
+ Source = "https://github.com/simonvanlierde/citesync"
47
48
  Issues = "https://github.com/simonvanlierde/citesync/issues"
48
49
  Changelog = "https://github.com/simonvanlierde/citesync/blob/main/CHANGELOG.md"
49
50
 
@@ -51,7 +52,10 @@ Changelog = "https://github.com/simonvanlierde/citesync/blob/main/CHANGELOG.md"
51
52
  dev = [
52
53
  "hypothesis>=6.140",
53
54
  "jsonschema>=4.25",
55
+ "memray>=1.20.0 ; sys_platform != 'win32'",
54
56
  "mutmut==3.8.0",
57
+ "pybtex>=0.25",
58
+ "pyinstrument>=5.1.3",
55
59
  "pytest>=9.1.1",
56
60
  "pytest-cov>=7.1.0",
57
61
  "ruff>=0.17.1",
@@ -123,6 +127,8 @@ source_paths = ["src/citesync"]
123
127
  only_mutate = [
124
128
  "src/citesync/check.py",
125
129
  "src/citesync/codecs.py",
130
+ "src/citesync/write.py",
131
+ "src/citesync/jsonsplice.py",
126
132
  ]
127
133
  pytest_add_cli_args_test_selection = ["tests"]
128
134
  also_copy = [
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "citesync"
3
- version = "0.1.0"
4
- description = "Check that CITATION.cff, codemeta.json, .zenodo.json and the package manifests (pyproject.toml, Cargo.toml, package.json) agree, and rewrite them to match one source file, using the CodeMeta crosswalks"
3
+ version = "0.3.0"
4
+ description = "Generate and synchronize software citation files from package metadata. CLI, pre-commit hook and browser playground."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
7
7
  authors = [{ name = "Simon van Lierde", email = "code@duinlab.nl" }]
@@ -30,7 +30,8 @@ dependencies = [
30
30
  citesync = "citesync.cli:main"
31
31
 
32
32
  [project.urls]
33
- Homepage = "https://github.com/simonvanlierde/citesync"
33
+ Homepage = "https://simonvanlierde.com/citesync/"
34
+ Source = "https://github.com/simonvanlierde/citesync"
34
35
  Issues = "https://github.com/simonvanlierde/citesync/issues"
35
36
  Changelog = "https://github.com/simonvanlierde/citesync/blob/main/CHANGELOG.md"
36
37
 
@@ -38,7 +39,10 @@ Changelog = "https://github.com/simonvanlierde/citesync/blob/main/CHANGELOG.md"
38
39
  dev = [
39
40
  "hypothesis>=6.140",
40
41
  "jsonschema>=4.25",
42
+ "memray>=1.20.0 ; sys_platform != 'win32'",
41
43
  "mutmut==3.8.0",
44
+ "pybtex>=0.25",
45
+ "pyinstrument>=5.1.3",
42
46
  "pytest>=9.1.1",
43
47
  "pytest-cov>=7.1.0",
44
48
  "ruff>=0.17.1",
@@ -109,7 +113,7 @@ testpaths = ["tests"]
109
113
  # Mutation testing (`just mutation`, not in CI) covers the comparison code only.
110
114
  [tool.mutmut]
111
115
  source_paths = ["src/citesync"]
112
- only_mutate = ["src/citesync/check.py", "src/citesync/codecs.py"]
116
+ only_mutate = ["src/citesync/check.py", "src/citesync/codecs.py", "src/citesync/write.py", "src/citesync/jsonsplice.py"]
113
117
  pytest_add_cli_args_test_selection = ["tests"]
114
118
  also_copy = ["docs", ".pre-commit-hooks.yaml"]
115
119
 
@@ -0,0 +1,5 @@
1
+ # Vendored from simonvanlierde/codemeta-drift; tests/test_mapping.py checks the sha256 lines.
2
+ tag v0.4.0
3
+ commit 2028ca26bd29ce7a64e6c741aed65a92a63f3f44
4
+ sha256 80468ba82523afb3611457a77cd6eafc955720f9a95b0dafca63dd97d5502e43 mapping-local.json examples/mapping-3.1.json
5
+ sha256 0551a57279c0d8cd3b1bdafcdd8e47865067432c5652fed7efea35994f695330 mapping.schema.json src/codemeta_drift/mapping.schema.json
@@ -0,0 +1,7 @@
1
+ """``python -m citesync``, the same as the ``citesync`` command."""
2
+
3
+ import sys
4
+
5
+ from citesync.cli import main
6
+
7
+ sys.exit(main())