sourceledger 0.4.0__tar.gz → 0.5.1__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.
- {sourceledger-0.4.0 → sourceledger-0.5.1}/PKG-INFO +57 -19
- {sourceledger-0.4.0 → sourceledger-0.5.1}/README.md +48 -16
- {sourceledger-0.4.0 → sourceledger-0.5.1}/pyproject.toml +40 -10
- {sourceledger-0.4.0 → sourceledger-0.5.1}/pyproject.toml.orig +38 -15
- sourceledger-0.5.1/src/sourceledger/__init__.py +60 -0
- sourceledger-0.5.1/src/sourceledger/builder.py +631 -0
- sourceledger-0.5.1/src/sourceledger/cli.py +640 -0
- sourceledger-0.5.1/src/sourceledger/fetcher.py +472 -0
- sourceledger-0.5.1/src/sourceledger/ledger.py +685 -0
- sourceledger-0.5.1/src/sourceledger/manifest.py +368 -0
- sourceledger-0.5.1/src/sourceledger/releaser.py +718 -0
- sourceledger-0.5.1/src/sourceledger/report.py +559 -0
- {sourceledger-0.4.0 → sourceledger-0.5.1}/src/sourceledger/sources.schema.json +43 -3
- sourceledger-0.4.0/src/sourceledger/__init__.py +0 -56
- sourceledger-0.4.0/src/sourceledger/cli.py +0 -201
- sourceledger-0.4.0/src/sourceledger/ledger.py +0 -1534
- sourceledger-0.4.0/src/sourceledger/report.py +0 -136
- {sourceledger-0.4.0 → sourceledger-0.5.1}/LICENSE +0 -0
- {sourceledger-0.4.0 → sourceledger-0.5.1}/src/sourceledger/py.typed +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sourceledger
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Fetch
|
|
3
|
+
Version: 0.5.1
|
|
4
|
+
Summary: Fetch or record a dataset's public files with provenance, and release it without files whose terms forbid it
|
|
5
5
|
Keywords: provenance,data pipeline,reproducibility,open data,research software,FAIR
|
|
6
6
|
Author: Simon van Lierde
|
|
7
7
|
Author-email: Simon van Lierde <code@duinlab.nl>
|
|
@@ -9,7 +9,7 @@ License-Expression: MIT
|
|
|
9
9
|
License-File: LICENSE
|
|
10
10
|
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Science/Research
|
|
12
|
-
Classifier: Operating System ::
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.13
|
|
@@ -17,10 +17,16 @@ Classifier: Programming Language :: Python :: 3.14
|
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.15
|
|
18
18
|
Classifier: Topic :: Scientific/Engineering
|
|
19
19
|
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Dist: pyarrow>=23 ; extra == 'parquet'
|
|
21
|
+
Requires-Dist: mlcroissant>=1.1.1 ; extra == 'release'
|
|
22
|
+
Requires-Dist: roc-validator>=0.13.1 ; extra == 'release'
|
|
20
23
|
Requires-Dist: openpyxl>=3.1 ; extra == 'xlsx'
|
|
21
24
|
Requires-Python: >=3.12
|
|
22
25
|
Project-URL: Homepage, https://github.com/simonvanlierde/sourceledger
|
|
23
26
|
Project-URL: Issues, https://github.com/simonvanlierde/sourceledger/issues
|
|
27
|
+
Project-URL: Changelog, https://github.com/simonvanlierde/sourceledger/blob/main/CHANGELOG.md
|
|
28
|
+
Provides-Extra: parquet
|
|
29
|
+
Provides-Extra: release
|
|
24
30
|
Provides-Extra: xlsx
|
|
25
31
|
Description-Content-Type: text/markdown
|
|
26
32
|
|
|
@@ -30,6 +36,7 @@ Description-Content-Type: text/markdown
|
|
|
30
36
|
[](LICENSE)
|
|
31
37
|
[](https://doi.org/10.5281/zenodo.23460694)
|
|
32
38
|
[](https://scorecard.dev/viewer/?uri=github.com/simonvanlierde/sourceledger)
|
|
39
|
+
[](https://www.bestpractices.dev/projects/16545)
|
|
33
40
|
[](https://app.codspeed.io/simonvanlierde/sourceledger?utm_source=badge)
|
|
34
41
|
|
|
35
42
|
Build a dataset from published sources and keep a record of the downloads behind it.
|
|
@@ -40,6 +47,8 @@ CSV, JSON, Excel or binary files. List the sources and reuse terms in `sources.t
|
|
|
40
47
|
- `fetch` downloads the files and records their URLs, dates and SHA-256 checksums.
|
|
41
48
|
- `build` writes tables with provenance columns, or copies file sources unchanged.
|
|
42
49
|
- `validate` checks the outputs against the downloads and the manifest.
|
|
50
|
+
- `release` writes the folder to publish, without the sources whose terms forbid it, and
|
|
51
|
+
checks it.
|
|
43
52
|
|
|
44
53
|
Each table row identifies its download. A `datapackage.json` describes the outputs.
|
|
45
54
|
The [documentation website](https://simonvanlierde.com/sourceledger/) follows a source through a publisher's revision.
|
|
@@ -51,8 +60,9 @@ uv tool install sourceledger
|
|
|
51
60
|
```
|
|
52
61
|
|
|
53
62
|
For a Python project that imports the library, use `uv add sourceledger` instead.
|
|
54
|
-
Use `sourceledger[xlsx]` in either command to read Excel files
|
|
55
|
-
|
|
63
|
+
Use `sourceledger[xlsx]` in either command to read Excel files, `sourceledger[parquet]`
|
|
64
|
+
to write Parquet outputs, or `sourceledger[release]` to check RO-Crate and Croissant metadata.
|
|
65
|
+
Python 3.12 or later is required; Linux, macOS and Windows are supported.
|
|
56
66
|
This README follows `main`, including [unreleased features](CHANGELOG.md#unreleased).
|
|
57
67
|
|
|
58
68
|
## Quick start
|
|
@@ -79,9 +89,20 @@ sourceledger build
|
|
|
79
89
|
sourceledger validate
|
|
80
90
|
```
|
|
81
91
|
|
|
92
|
+
`sourceledger fetch --help` lists one stage's options, and `--dry-run` on `fetch`, `record`
|
|
93
|
+
and `build` shows what they would write. Exit code 1 means `validate` or `release` found problems, 2 a
|
|
94
|
+
usage error and 3 that a stage could not run; see [options and exit codes](docs/reference.md#options-output-and-exit-codes).
|
|
95
|
+
|
|
96
|
+
For [Parquet outputs](docs/reference.md#sourcestoml), set `output_format = "parquet"`
|
|
97
|
+
before the first `[[source]]` table in `sources.toml`, after installing the Parquet extra above.
|
|
98
|
+
CSV remains the default. Parquet writing and validation use batches of at most 10,000 rows;
|
|
99
|
+
see [table memory limits](docs/reference.md#sourcestoml).
|
|
100
|
+
|
|
82
101
|
`sourceledger` reads CSV (gzipped or not), JSON and Excel, by each source's `format` or its
|
|
83
102
|
URL's extension. Set `format = "file"` to keep a raster, archive or other file unchanged.
|
|
84
|
-
For another table format, see [custom readers](docs/
|
|
103
|
+
For another table format, see [custom readers](docs/recipes.md#write-a-custom-reader).
|
|
104
|
+
If another tool downloads a source, [record its file](docs/recipes.md#record-a-file-another-tool-downloaded)
|
|
105
|
+
instead of fetching it.
|
|
85
106
|
|
|
86
107
|
### What to commit
|
|
87
108
|
|
|
@@ -100,43 +121,60 @@ runs `fetch` before `build` and `validate`.
|
|
|
100
121
|
- **Get started:** follow the [worked example](docs/getting-started.md) to notice a revised
|
|
101
122
|
source and rebuild the dataset.
|
|
102
123
|
- **Configure and run:** use the [manifest and command reference](docs/reference.md),
|
|
103
|
-
[download limits and retries](docs/fetching.md), and [
|
|
104
|
-
|
|
105
|
-
|
|
124
|
+
[download limits and retries](docs/fetching.md), and [recipes](docs/recipes.md) for
|
|
125
|
+
pooch, DVC, dlt, your own fetcher and custom readers.
|
|
126
|
+
- **Inspect and share:** consume [JSON reports](docs/reference.md#json-reports) in CI, or create a
|
|
127
|
+
[standalone HTML provenance report](docs/reference.md#html-provenance-report) for dataset recipients
|
|
106
128
|
with `sourceledger report > provenance.html`.
|
|
107
129
|
- **Understand the checks:** read [how it works](docs/architecture.md),
|
|
108
130
|
[safe use](docs/secure-use.md), and [what the checks establish](docs/assurance-case.md).
|
|
109
|
-
- **Choose and verify:**
|
|
110
|
-
sourceledger release's
|
|
131
|
+
- **Choose and verify:** see [where sourceledger fits](docs/where-it-fits.md) among related
|
|
132
|
+
tools, or check a sourceledger release's
|
|
133
|
+
[signed provenance and reproducible build](docs/secure-use.md#check-a-sourceledger-release).
|
|
111
134
|
|
|
112
135
|
## Project status
|
|
113
136
|
|
|
114
137
|
### Stability
|
|
115
138
|
|
|
116
|
-
Until 1.0, the public API is `sourceledger`'s `__all__`, the keys of `sources.toml`,
|
|
117
|
-
|
|
139
|
+
Until 1.0, the public API is `sourceledger`'s `__all__`, the keys of `sources.toml`, the
|
|
140
|
+
format of fetch records and the log, and the CLI's stages, options, exit codes and `--json`
|
|
141
|
+
reports. A breaking change to any of them comes only in a
|
|
118
142
|
minor version, listed in [CHANGELOG.md](CHANGELOG.md), with a warning first where that's
|
|
119
|
-
cheap. Older fetch logs stay readable.
|
|
143
|
+
cheap. Older fetch logs stay readable. A record written by `record()`, or with
|
|
144
|
+
`parameters`, is not readable by 0.4.0: after a downgrade, run `fetch` again.
|
|
120
145
|
|
|
121
146
|
### Roadmap
|
|
122
147
|
|
|
123
|
-
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
148
|
+
- An error class per kind of failure in the other stages, under `ValueError` and `OSError`,
|
|
149
|
+
once a caller needs to tell them apart. This will not break code that catches the base classes.
|
|
150
|
+
- Comparing two versions of a table row by row, with the row keys the caller names, so a
|
|
151
|
+
revision shows which values changed and not only that the bytes did. It starts as a pilot on
|
|
152
|
+
real data, the archived World Development Indicators releases, before it becomes an API.
|
|
128
153
|
- A review by [pyOpenSci](https://www.pyopensci.org) once the project has users besides
|
|
129
154
|
its own template.
|
|
130
155
|
|
|
156
|
+
Not planned:
|
|
157
|
+
|
|
158
|
+
- Templated, paginated or parallel downloads, an `update` command, or a plugin per download
|
|
159
|
+
tool. Other tools fetch those files, and `record` logs them
|
|
160
|
+
([0005](docs/decisions/0005-provenance-core.md)).
|
|
161
|
+
|
|
131
162
|
Ideas and requests are welcome as [issues](https://github.com/simonvanlierde/sourceledger/issues).
|
|
132
163
|
|
|
133
164
|
## Development
|
|
134
165
|
|
|
166
|
+
You need [uv](https://docs.astral.sh/uv/), [just](https://just.systems), and Node 26 with
|
|
167
|
+
[pnpm](https://pnpm.io) for the documentation site, which `just check` also builds.
|
|
168
|
+
|
|
135
169
|
```sh
|
|
136
170
|
uv sync
|
|
137
171
|
just check
|
|
138
172
|
```
|
|
139
173
|
|
|
174
|
+
The site is built with Astro from the Markdown in `docs/`. `just site` builds it into
|
|
175
|
+
`site/dist/`, and every push to `main` deploys it to GitHub Pages at
|
|
176
|
+
<https://simonvanlierde.com/sourceledger/>.
|
|
177
|
+
|
|
140
178
|
[Contributing](.github/CONTRIBUTING.md) covers hooks, coding standards and tests.
|
|
141
179
|
[Governance](GOVERNANCE.md) explains project decisions. Report vulnerabilities through
|
|
142
180
|
[Security](.github/SECURITY.md).
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://doi.org/10.5281/zenodo.23460694)
|
|
6
6
|
[](https://scorecard.dev/viewer/?uri=github.com/simonvanlierde/sourceledger)
|
|
7
|
+
[](https://www.bestpractices.dev/projects/16545)
|
|
7
8
|
[](https://app.codspeed.io/simonvanlierde/sourceledger?utm_source=badge)
|
|
8
9
|
|
|
9
10
|
Build a dataset from published sources and keep a record of the downloads behind it.
|
|
@@ -14,6 +15,8 @@ CSV, JSON, Excel or binary files. List the sources and reuse terms in `sources.t
|
|
|
14
15
|
- `fetch` downloads the files and records their URLs, dates and SHA-256 checksums.
|
|
15
16
|
- `build` writes tables with provenance columns, or copies file sources unchanged.
|
|
16
17
|
- `validate` checks the outputs against the downloads and the manifest.
|
|
18
|
+
- `release` writes the folder to publish, without the sources whose terms forbid it, and
|
|
19
|
+
checks it.
|
|
17
20
|
|
|
18
21
|
Each table row identifies its download. A `datapackage.json` describes the outputs.
|
|
19
22
|
The [documentation website](https://simonvanlierde.com/sourceledger/) follows a source through a publisher's revision.
|
|
@@ -25,8 +28,9 @@ uv tool install sourceledger
|
|
|
25
28
|
```
|
|
26
29
|
|
|
27
30
|
For a Python project that imports the library, use `uv add sourceledger` instead.
|
|
28
|
-
Use `sourceledger[xlsx]` in either command to read Excel files
|
|
29
|
-
|
|
31
|
+
Use `sourceledger[xlsx]` in either command to read Excel files, `sourceledger[parquet]`
|
|
32
|
+
to write Parquet outputs, or `sourceledger[release]` to check RO-Crate and Croissant metadata.
|
|
33
|
+
Python 3.12 or later is required; Linux, macOS and Windows are supported.
|
|
30
34
|
This README follows `main`, including [unreleased features](CHANGELOG.md#unreleased).
|
|
31
35
|
|
|
32
36
|
## Quick start
|
|
@@ -53,9 +57,20 @@ sourceledger build
|
|
|
53
57
|
sourceledger validate
|
|
54
58
|
```
|
|
55
59
|
|
|
60
|
+
`sourceledger fetch --help` lists one stage's options, and `--dry-run` on `fetch`, `record`
|
|
61
|
+
and `build` shows what they would write. Exit code 1 means `validate` or `release` found problems, 2 a
|
|
62
|
+
usage error and 3 that a stage could not run; see [options and exit codes](docs/reference.md#options-output-and-exit-codes).
|
|
63
|
+
|
|
64
|
+
For [Parquet outputs](docs/reference.md#sourcestoml), set `output_format = "parquet"`
|
|
65
|
+
before the first `[[source]]` table in `sources.toml`, after installing the Parquet extra above.
|
|
66
|
+
CSV remains the default. Parquet writing and validation use batches of at most 10,000 rows;
|
|
67
|
+
see [table memory limits](docs/reference.md#sourcestoml).
|
|
68
|
+
|
|
56
69
|
`sourceledger` reads CSV (gzipped or not), JSON and Excel, by each source's `format` or its
|
|
57
70
|
URL's extension. Set `format = "file"` to keep a raster, archive or other file unchanged.
|
|
58
|
-
For another table format, see [custom readers](docs/
|
|
71
|
+
For another table format, see [custom readers](docs/recipes.md#write-a-custom-reader).
|
|
72
|
+
If another tool downloads a source, [record its file](docs/recipes.md#record-a-file-another-tool-downloaded)
|
|
73
|
+
instead of fetching it.
|
|
59
74
|
|
|
60
75
|
### What to commit
|
|
61
76
|
|
|
@@ -74,43 +89,60 @@ runs `fetch` before `build` and `validate`.
|
|
|
74
89
|
- **Get started:** follow the [worked example](docs/getting-started.md) to notice a revised
|
|
75
90
|
source and rebuild the dataset.
|
|
76
91
|
- **Configure and run:** use the [manifest and command reference](docs/reference.md),
|
|
77
|
-
[download limits and retries](docs/fetching.md), and [
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
[download limits and retries](docs/fetching.md), and [recipes](docs/recipes.md) for
|
|
93
|
+
pooch, DVC, dlt, your own fetcher and custom readers.
|
|
94
|
+
- **Inspect and share:** consume [JSON reports](docs/reference.md#json-reports) in CI, or create a
|
|
95
|
+
[standalone HTML provenance report](docs/reference.md#html-provenance-report) for dataset recipients
|
|
80
96
|
with `sourceledger report > provenance.html`.
|
|
81
97
|
- **Understand the checks:** read [how it works](docs/architecture.md),
|
|
82
98
|
[safe use](docs/secure-use.md), and [what the checks establish](docs/assurance-case.md).
|
|
83
|
-
- **Choose and verify:**
|
|
84
|
-
sourceledger release's
|
|
99
|
+
- **Choose and verify:** see [where sourceledger fits](docs/where-it-fits.md) among related
|
|
100
|
+
tools, or check a sourceledger release's
|
|
101
|
+
[signed provenance and reproducible build](docs/secure-use.md#check-a-sourceledger-release).
|
|
85
102
|
|
|
86
103
|
## Project status
|
|
87
104
|
|
|
88
105
|
### Stability
|
|
89
106
|
|
|
90
|
-
Until 1.0, the public API is `sourceledger`'s `__all__`, the keys of `sources.toml`,
|
|
91
|
-
|
|
107
|
+
Until 1.0, the public API is `sourceledger`'s `__all__`, the keys of `sources.toml`, the
|
|
108
|
+
format of fetch records and the log, and the CLI's stages, options, exit codes and `--json`
|
|
109
|
+
reports. A breaking change to any of them comes only in a
|
|
92
110
|
minor version, listed in [CHANGELOG.md](CHANGELOG.md), with a warning first where that's
|
|
93
|
-
cheap. Older fetch logs stay readable.
|
|
111
|
+
cheap. Older fetch logs stay readable. A record written by `record()`, or with
|
|
112
|
+
`parameters`, is not readable by 0.4.0: after a downgrade, run `fetch` again.
|
|
94
113
|
|
|
95
114
|
### Roadmap
|
|
96
115
|
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
116
|
+
- An error class per kind of failure in the other stages, under `ValueError` and `OSError`,
|
|
117
|
+
once a caller needs to tell them apart. This will not break code that catches the base classes.
|
|
118
|
+
- Comparing two versions of a table row by row, with the row keys the caller names, so a
|
|
119
|
+
revision shows which values changed and not only that the bytes did. It starts as a pilot on
|
|
120
|
+
real data, the archived World Development Indicators releases, before it becomes an API.
|
|
102
121
|
- A review by [pyOpenSci](https://www.pyopensci.org) once the project has users besides
|
|
103
122
|
its own template.
|
|
104
123
|
|
|
124
|
+
Not planned:
|
|
125
|
+
|
|
126
|
+
- Templated, paginated or parallel downloads, an `update` command, or a plugin per download
|
|
127
|
+
tool. Other tools fetch those files, and `record` logs them
|
|
128
|
+
([0005](docs/decisions/0005-provenance-core.md)).
|
|
129
|
+
|
|
105
130
|
Ideas and requests are welcome as [issues](https://github.com/simonvanlierde/sourceledger/issues).
|
|
106
131
|
|
|
107
132
|
## Development
|
|
108
133
|
|
|
134
|
+
You need [uv](https://docs.astral.sh/uv/), [just](https://just.systems), and Node 26 with
|
|
135
|
+
[pnpm](https://pnpm.io) for the documentation site, which `just check` also builds.
|
|
136
|
+
|
|
109
137
|
```sh
|
|
110
138
|
uv sync
|
|
111
139
|
just check
|
|
112
140
|
```
|
|
113
141
|
|
|
142
|
+
The site is built with Astro from the Markdown in `docs/`. `just site` builds it into
|
|
143
|
+
`site/dist/`, and every push to `main` deploys it to GitHub Pages at
|
|
144
|
+
<https://simonvanlierde.com/sourceledger/>.
|
|
145
|
+
|
|
114
146
|
[Contributing](.github/CONTRIBUTING.md) covers hooks, coding standards and tests.
|
|
115
147
|
[Governance](GOVERNANCE.md) explains project decisions. Report vulnerabilities through
|
|
116
148
|
[Security](.github/SECURITY.md).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sourceledger"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "Fetch
|
|
3
|
+
version = "0.5.1"
|
|
4
|
+
description = "Fetch or record a dataset's public files with provenance, and release it without files whose terms forbid it"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
license = "MIT"
|
|
@@ -17,7 +17,7 @@ keywords = [
|
|
|
17
17
|
classifiers = [
|
|
18
18
|
"Development Status :: 3 - Alpha",
|
|
19
19
|
"Intended Audience :: Science/Research",
|
|
20
|
-
"Operating System ::
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
21
|
"Programming Language :: Python :: 3",
|
|
22
22
|
"Programming Language :: Python :: 3.12",
|
|
23
23
|
"Programming Language :: Python :: 3.13",
|
|
@@ -33,28 +33,38 @@ name = "Simon van Lierde"
|
|
|
33
33
|
email = "code@duinlab.nl"
|
|
34
34
|
|
|
35
35
|
[project.scripts]
|
|
36
|
-
sourceledger = "sourceledger.cli:
|
|
36
|
+
sourceledger = "sourceledger.cli:entry"
|
|
37
37
|
|
|
38
38
|
[project.urls]
|
|
39
39
|
Homepage = "https://github.com/simonvanlierde/sourceledger"
|
|
40
40
|
Issues = "https://github.com/simonvanlierde/sourceledger/issues"
|
|
41
|
+
Changelog = "https://github.com/simonvanlierde/sourceledger/blob/main/CHANGELOG.md"
|
|
41
42
|
|
|
42
43
|
[project.optional-dependencies]
|
|
43
44
|
xlsx = ["openpyxl>=3.1"]
|
|
45
|
+
parquet = ["pyarrow>=23"]
|
|
46
|
+
release = [
|
|
47
|
+
"mlcroissant>=1.1.1",
|
|
48
|
+
"roc-validator>=0.13.1",
|
|
49
|
+
]
|
|
44
50
|
|
|
45
51
|
[dependency-groups]
|
|
46
52
|
dev = [
|
|
47
53
|
"frictionless>=5.20",
|
|
48
|
-
"hypothesis>=6.170.
|
|
54
|
+
"hypothesis>=6.170.13",
|
|
49
55
|
"jsonschema>=4.26",
|
|
56
|
+
"mlcroissant>=1.1.1",
|
|
57
|
+
"mutmut>=3.8.1",
|
|
50
58
|
"openpyxl>=3.1",
|
|
51
|
-
"
|
|
59
|
+
"polars>=1.35",
|
|
60
|
+
"pyarrow>=23",
|
|
61
|
+
"pytest>=9.2.0",
|
|
52
62
|
"pytest-codspeed>=5.0.3",
|
|
53
63
|
"pytest-cov>=7.1.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
64
|
+
"roc-validator>=0.13.1",
|
|
65
|
+
"ruff>=0.17.3",
|
|
66
|
+
"ty>=0.0.93",
|
|
56
67
|
]
|
|
57
|
-
mutation = ["mutmut>=3.8.0"]
|
|
58
68
|
|
|
59
69
|
[build-system]
|
|
60
70
|
requires = ["uv_build>=0.12.19,<0.14.0"]
|
|
@@ -73,7 +83,12 @@ line-length = 120
|
|
|
73
83
|
docstring-code-format = true
|
|
74
84
|
|
|
75
85
|
[tool.ruff.lint]
|
|
76
|
-
|
|
86
|
+
preview = true
|
|
87
|
+
explicit-preview-rules = true
|
|
88
|
+
select = [
|
|
89
|
+
"ALL",
|
|
90
|
+
"PLW1514",
|
|
91
|
+
]
|
|
77
92
|
ignore = [
|
|
78
93
|
"ANN204",
|
|
79
94
|
"COM812",
|
|
@@ -92,6 +107,15 @@ ignore = [
|
|
|
92
107
|
"PLR2004",
|
|
93
108
|
"ANN201",
|
|
94
109
|
]
|
|
110
|
+
"docs/examples/**" = [
|
|
111
|
+
"T201",
|
|
112
|
+
"INP001",
|
|
113
|
+
"D1",
|
|
114
|
+
"ANN",
|
|
115
|
+
"E501",
|
|
116
|
+
"FBT003",
|
|
117
|
+
"B905",
|
|
118
|
+
]
|
|
95
119
|
"src/sourceledger/cli.py" = ["T201"]
|
|
96
120
|
|
|
97
121
|
[tool.ruff.lint.pydocstyle]
|
|
@@ -101,6 +125,9 @@ convention = "google"
|
|
|
101
125
|
allow-magic-value-types = ["int"]
|
|
102
126
|
max-args = 10
|
|
103
127
|
|
|
128
|
+
[tool.ty.src]
|
|
129
|
+
exclude = ["docs/examples"]
|
|
130
|
+
|
|
104
131
|
[tool.ty.terminal]
|
|
105
132
|
error-on-warning = false
|
|
106
133
|
|
|
@@ -115,6 +142,7 @@ addopts = [
|
|
|
115
142
|
]
|
|
116
143
|
markers = ["live: calls a real external service; deselected unless run with -m live"]
|
|
117
144
|
testpaths = ["tests"]
|
|
145
|
+
pythonpath = ["tests"]
|
|
118
146
|
|
|
119
147
|
[tool.coverage.run]
|
|
120
148
|
source = ["src"]
|
|
@@ -129,10 +157,12 @@ exclude_also = [
|
|
|
129
157
|
]
|
|
130
158
|
|
|
131
159
|
[tool.mutmut]
|
|
160
|
+
process_isolation = "forkserver"
|
|
132
161
|
source_paths = ["src"]
|
|
133
162
|
also_copy = [
|
|
134
163
|
"README.md",
|
|
135
164
|
"docs",
|
|
136
165
|
".github/scripts",
|
|
166
|
+
"src/sourceledger/sources.schema.json",
|
|
137
167
|
]
|
|
138
168
|
do_not_mutate_patterns = ['^\s*_logger\.\w+\(']
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sourceledger"
|
|
3
|
-
version = "0.
|
|
4
|
-
description = "Fetch
|
|
3
|
+
version = "0.5.1"
|
|
4
|
+
description = "Fetch or record a dataset's public files with provenance, and release it without files whose terms forbid it"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.12"
|
|
7
7
|
authors = [{ name = "Simon van Lierde", email = "code@duinlab.nl" }]
|
|
8
8
|
license = "MIT"
|
|
9
9
|
license-files = ["LICENSE"]
|
|
10
|
+
# citesync compares keywords with CITATION.cff.
|
|
10
11
|
keywords = ["provenance", "data pipeline", "reproducibility", "open data", "research software", "FAIR"]
|
|
11
12
|
classifiers = [
|
|
12
13
|
"Development Status :: 3 - Alpha",
|
|
13
14
|
"Intended Audience :: Science/Research",
|
|
14
|
-
"Operating System ::
|
|
15
|
+
"Operating System :: OS Independent",
|
|
15
16
|
"Programming Language :: Python :: 3",
|
|
16
17
|
"Programming Language :: Python :: 3.12",
|
|
17
18
|
"Programming Language :: Python :: 3.13",
|
|
@@ -22,34 +23,44 @@ classifiers = [
|
|
|
22
23
|
]
|
|
23
24
|
dependencies = []
|
|
24
25
|
|
|
25
|
-
# `sourceledger
|
|
26
|
-
# with its own readers calls `sourceledger.
|
|
26
|
+
# The `sourceledger` command, reading each source by its format. A project
|
|
27
|
+
# with its own readers calls `sourceledger.entry` from its own entry point instead.
|
|
27
28
|
[project.scripts]
|
|
28
|
-
sourceledger = "sourceledger.cli:
|
|
29
|
+
sourceledger = "sourceledger.cli:entry"
|
|
29
30
|
|
|
30
31
|
[project.urls]
|
|
31
32
|
Homepage = "https://github.com/simonvanlierde/sourceledger"
|
|
32
33
|
Issues = "https://github.com/simonvanlierde/sourceledger/issues"
|
|
34
|
+
Changelog = "https://github.com/simonvanlierde/sourceledger/blob/main/CHANGELOG.md"
|
|
33
35
|
|
|
34
36
|
[project.optional-dependencies]
|
|
35
37
|
xlsx = [
|
|
36
38
|
"openpyxl>=3.1",
|
|
37
39
|
]
|
|
40
|
+
parquet = [
|
|
41
|
+
"pyarrow>=23",
|
|
42
|
+
]
|
|
43
|
+
release = [
|
|
44
|
+
"mlcroissant>=1.1.1",
|
|
45
|
+
"roc-validator>=0.13.1",
|
|
46
|
+
]
|
|
38
47
|
|
|
39
48
|
[dependency-groups]
|
|
40
49
|
dev = [
|
|
41
50
|
"frictionless>=5.20",
|
|
42
|
-
"hypothesis>=6.170.
|
|
51
|
+
"hypothesis>=6.170.13",
|
|
43
52
|
"jsonschema>=4.26",
|
|
53
|
+
"mlcroissant>=1.1.1",
|
|
54
|
+
"mutmut>=3.8.1",
|
|
44
55
|
"openpyxl>=3.1",
|
|
45
|
-
"
|
|
56
|
+
"polars>=1.35",
|
|
57
|
+
"pyarrow>=23",
|
|
58
|
+
"pytest>=9.2.0",
|
|
46
59
|
"pytest-codspeed>=5.0.3",
|
|
47
60
|
"pytest-cov>=7.1.0",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
mutation = [
|
|
52
|
-
"mutmut>=3.8.0",
|
|
61
|
+
"roc-validator>=0.13.1",
|
|
62
|
+
"ruff>=0.17.3",
|
|
63
|
+
"ty>=0.0.93",
|
|
53
64
|
]
|
|
54
65
|
|
|
55
66
|
[build-system]
|
|
@@ -76,7 +87,9 @@ line-length = 120
|
|
|
76
87
|
docstring-code-format = true
|
|
77
88
|
|
|
78
89
|
[tool.ruff.lint]
|
|
79
|
-
|
|
90
|
+
preview = true
|
|
91
|
+
explicit-preview-rules = true
|
|
92
|
+
select = ["ALL", "PLW1514"] # unspecified-encoding is preview-only, so ALL skips it
|
|
80
93
|
ignore = [
|
|
81
94
|
"ANN204", # missing-return-type-special-method
|
|
82
95
|
"COM812", # trailing-comma-missing: conflicts with the formatter
|
|
@@ -91,6 +104,8 @@ ignore = [
|
|
|
91
104
|
# annotations, or package __init__.py.
|
|
92
105
|
[tool.ruff.lint.per-file-ignores]
|
|
93
106
|
"**/tests/**" = ["S101", "D1", "INP001", "PLR2004", "ANN201"]
|
|
107
|
+
# A documentation script: it prints, is not a package, and carries no annotations.
|
|
108
|
+
"docs/examples/**" = ["T201", "INP001", "D1", "ANN", "E501", "FBT003", "B905"]
|
|
94
109
|
# The command line reports to the terminal.
|
|
95
110
|
"src/sourceledger/cli.py" = ["T201"]
|
|
96
111
|
|
|
@@ -101,6 +116,10 @@ convention = "google"
|
|
|
101
116
|
allow-magic-value-types = ["int"]
|
|
102
117
|
max-args = 10
|
|
103
118
|
|
|
119
|
+
# The example script imports pyarrow, which the project environment need not hold.
|
|
120
|
+
[tool.ty.src]
|
|
121
|
+
exclude = ["docs/examples"]
|
|
122
|
+
|
|
104
123
|
# A rule set to "warn" reports without failing: ty otherwise exits 1 on warnings too.
|
|
105
124
|
[tool.ty.terminal]
|
|
106
125
|
error-on-warning = false
|
|
@@ -110,6 +129,8 @@ error-on-warning = false
|
|
|
110
129
|
addopts = ["-ra", "--strict-config", "--strict-markers", "--import-mode=importlib", "-m", "not live"]
|
|
111
130
|
markers = ["live: calls a real external service; deselected unless run with -m live"]
|
|
112
131
|
testpaths = ["tests"]
|
|
132
|
+
# The test modules import their shared helpers from tests/support.py.
|
|
133
|
+
pythonpath = ["tests"]
|
|
113
134
|
|
|
114
135
|
# Coverage is opt-in via `pytest --cov` (`just py-cov`), not addopts, because it
|
|
115
136
|
# slows every plain test run. CI's run fails under the fail_under below.
|
|
@@ -126,7 +147,9 @@ exclude_also = ["if TYPE_CHECKING:", "raise NotImplementedError"]
|
|
|
126
147
|
|
|
127
148
|
# `just py-mutation` runs it. The docs tests read the README and docs/ from the copy.
|
|
128
149
|
[tool.mutmut]
|
|
150
|
+
# Polars starts worker threads; forking after tests used them can deadlock a mutant.
|
|
151
|
+
process_isolation = "forkserver"
|
|
129
152
|
source_paths = ["src"]
|
|
130
|
-
also_copy = ["README.md", "docs", ".github/scripts"]
|
|
153
|
+
also_copy = ["README.md", "docs", ".github/scripts", "src/sourceledger/sources.schema.json"]
|
|
131
154
|
# Log calls only change diagnostics; their mutants would all survive.
|
|
132
155
|
do_not_mutate_patterns = ['^\s*_logger\.\w+\(']
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Fetch or record a dataset's public files with provenance, and release it without files whose terms forbid it.
|
|
2
|
+
|
|
3
|
+
Every file keeps a provenance record, and every output row names the bytes it came from.
|
|
4
|
+
|
|
5
|
+
The names below are the public API. Until 1.0, a breaking change to them, to the keys of
|
|
6
|
+
sources.toml, or to the fetch-record format comes only in a minor version, listed in the
|
|
7
|
+
changelog. The submodules, such as `sourceledger.ledger`, may change in any release.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from sourceledger.builder import Parser, build, parse_csv, parse_json, parse_source, parse_xlsx, read_output
|
|
11
|
+
from sourceledger.cli import entry, main
|
|
12
|
+
from sourceledger.fetcher import USER_AGENT, fetch
|
|
13
|
+
from sourceledger.ledger import FetchError, FetchRecord, record, revisions, verified
|
|
14
|
+
from sourceledger.manifest import Source, load_manifest, load_output_format, load_package_name, load_release_formats
|
|
15
|
+
from sourceledger.releaser import (
|
|
16
|
+
ReleaseError,
|
|
17
|
+
RestrictedSourceError,
|
|
18
|
+
ValidatorCouldNotRun,
|
|
19
|
+
ValidatorFailed,
|
|
20
|
+
ValidatorMissing,
|
|
21
|
+
check_release,
|
|
22
|
+
release,
|
|
23
|
+
)
|
|
24
|
+
from sourceledger.report import attribution, report, status, validate, verify
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"USER_AGENT",
|
|
28
|
+
"FetchError",
|
|
29
|
+
"FetchRecord",
|
|
30
|
+
"Parser",
|
|
31
|
+
"ReleaseError",
|
|
32
|
+
"RestrictedSourceError",
|
|
33
|
+
"Source",
|
|
34
|
+
"ValidatorCouldNotRun",
|
|
35
|
+
"ValidatorFailed",
|
|
36
|
+
"ValidatorMissing",
|
|
37
|
+
"attribution",
|
|
38
|
+
"build",
|
|
39
|
+
"check_release",
|
|
40
|
+
"entry",
|
|
41
|
+
"fetch",
|
|
42
|
+
"load_manifest",
|
|
43
|
+
"load_output_format",
|
|
44
|
+
"load_package_name",
|
|
45
|
+
"load_release_formats",
|
|
46
|
+
"main",
|
|
47
|
+
"parse_csv",
|
|
48
|
+
"parse_json",
|
|
49
|
+
"parse_source",
|
|
50
|
+
"parse_xlsx",
|
|
51
|
+
"read_output",
|
|
52
|
+
"record",
|
|
53
|
+
"release",
|
|
54
|
+
"report",
|
|
55
|
+
"revisions",
|
|
56
|
+
"status",
|
|
57
|
+
"validate",
|
|
58
|
+
"verified",
|
|
59
|
+
"verify",
|
|
60
|
+
]
|