pkgmap-py 0.1.0__tar.gz → 0.2.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pkgmap-py
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Cross-distribution Linux package name resolution
5
5
  Author: Levizor
6
6
  Author-email: Levizor <levizor@disroot.org>
@@ -19,7 +19,10 @@ Cross-distribution Linux package name resolution.
19
19
 
20
20
  Different distributions often package the exact same software under different names (for example, `ninja` on Arch is `ninja-build` on Debian and Alpine; `bat` on Arch is `rust-bat` on Debian and Fedora; `fd` on Arch is `rust-fd-find` on Debian; Nixpkgs uses specific attribute paths). `pkgmap` provides an offline SQLite database and a companion Python library/CLI to translate package names between any pair of Linux distributions, resolve packages across all repositories, or look up native packages by upstream project name.
21
21
 
22
- Data is updated daily from [Repology](https://repology.org) and indexed for instant local lookups. On first run, `pkgmap` automatically downloads and decompresses the latest daily database release (`~/.cache/pkgmap/pkgmap.db`).
22
+ Data is updated daily from [Repology](https://repology.org) and indexed for instant local lookups. On first run, `pkgmap` automatically downloads and decompresses the latest daily database snapshot (`~/.cache/pkgmap/`).
23
+
24
+ - **PyPI**: [`pkgmap-py`](https://pypi.org/project/pkgmap-py/)
25
+ - **Web Interface**: [levizor.github.io/pkgmap](https://levizor.github.io/pkgmap/) (runs 100% client-side via SQLite WebAssembly + OPFS)
23
26
 
24
27
  ---
25
28
 
@@ -32,13 +35,28 @@ Use `--from` (`-f`) and `--to` (`-t`):
32
35
  ```bash
33
36
  # What is Arch's 'bat' called in Debian?
34
37
  pkgmap resolve bat --from arch --to debian
35
- # Output: rust-bat (0.22.1) [category: misc]
38
+ # Output: rust-bat (0.24.0)
36
39
 
37
40
  # What is Arch's 'fd' in Nixpkgs?
38
41
  pkgmap resolve fd -f arch -t nixpkgs
39
42
  # Output: fd (10.5.0)
40
43
  ```
41
44
 
45
+ ### Batch resolution
46
+
47
+ Pass multiple package names to resolve them in a single query:
48
+
49
+ ```bash
50
+ pkgmap resolve git gcc bat --from nix --to gnuguix
51
+ ```
52
+
53
+ Output:
54
+ ```text
55
+ git -> git (2.54.0)
56
+ gcc -> gcc (15.2.0)
57
+ bat -> bat (0.26.1)
58
+ ```
59
+
42
60
  ### Resolve across all distributions
43
61
 
44
62
  Omit `--to` to see equivalents across every indexed distribution:
@@ -49,8 +67,8 @@ pkgmap resolve bat --from arch
49
67
 
50
68
  Output:
51
69
  ```text
52
- alpine_3_20: bat (0.24.0)
53
- debian_12: rust-bat (0.22.1) [category: misc]
70
+ alpine_edge: bat (0.24.0)
71
+ debian_unstable: rust-bat (0.24.0)
54
72
  fedora_rawhide: rust-bat (0.26.1)
55
73
  nix_unstable: bat (0.26.1)
56
74
  ubuntu_24_04: rust-bat (0.24.0)
@@ -63,7 +81,7 @@ Omit `--from` (or pass `--project` / `-p`) to resolve packages directly from an
63
81
 
64
82
  ```bash
65
83
  pkgmap resolve ripgrep --to debian
66
- # Output: rust-ripgrep (13.0.0) [category: misc]
84
+ # Output: rust-ripgrep (14.1.0)
67
85
  ```
68
86
 
69
87
  ### JSON output
@@ -78,15 +96,15 @@ pkgmap resolve bat -f arch -t debian --json
78
96
  [
79
97
  {
80
98
  "name": "rust-bat",
81
- "version": "0.22.1",
82
- "category": "misc",
83
- "repo": "debian_12",
84
- "repo_family": "debuntu",
85
- "install_name": "rust-bat"
99
+ "version": "0.24.0",
100
+ "repo": "debian_unstable",
101
+ "repo_family": "debuntu"
86
102
  }
87
103
  ]
88
104
  ```
89
105
 
106
+ When multiple packages are passed with `--json`, the output is a dictionary keyed by each input package name.
107
+
90
108
  ### Other commands
91
109
 
92
110
  ```bash
@@ -95,27 +113,47 @@ pkgmap repos
95
113
 
96
114
  # Manually refresh the local database snapshot
97
115
  pkgmap update
116
+
117
+ # Download the full database (all 330+ Repology repositories)
118
+ pkgmap update --full
98
119
  ```
99
120
 
100
121
  ---
101
122
 
123
+ ## Core vs. Full Database Variants
124
+
125
+ `pkgmap` publishes two database snapshots with every daily release:
126
+
127
+ | Variant | File | Compressed Size | Coverage | Default For |
128
+ | :--- | :--- | :--- | :--- | :--- |
129
+ | **Core** | `pkgmap-core.db` | ~7 MB | Top 10 repositories (Nixpkgs, Arch, AUR, Debian, Ubuntu, Fedora, Alpine, openSUSE, Gentoo, Void) | **CLI & Web UI** |
130
+ | **Full** | `pkgmap.db` | ~37 MB | All 330+ Repology repositories | **Python Library** |
131
+
132
+ - **CLI behavior**: Defaults to the **Core** database (`~/.cache/pkgmap/pkgmap-core.db`) unless the Full database is already downloaded locally or `--full` is passed. If you query a repository not present in Core, the CLI prompts you to run `pkgmap update --full`. You can also pass `--core` or `--full` to any CLI command (`resolve`, `update`, `repos`).
133
+ - **Python library behavior**: Defaults to the **Full** database (`~/.cache/pkgmap/pkgmap.db`). Call `set_default_variant("core")` (or set `PKGMAP_DB_VARIANT=core`) to use the Core database instead.
134
+
135
+ ---
136
+
102
137
  ## Python API
103
138
 
104
- You can also use `pkgmap` as a Python library:
139
+ You can use `pkgmap` as a Python library:
105
140
 
106
141
  ```python
107
- from pkgmap import resolve, resolve_all, resolve_batch
142
+ from pkgmap import resolve, resolve_all, resolve_batch, set_default_variant
143
+
144
+ # Optional: switch library default from 'full' to 'core'
145
+ # set_default_variant("core")
108
146
 
109
147
  # 1. Single package resolution
110
148
  res = resolve("bat", from_repo="arch", to_repo="debian")
111
149
  if res:
112
- print(res.install_name, res.version)
113
- # Output: rust-bat 0.22.1
150
+ print(res.name, res.version)
151
+ # Output: rust-bat 0.24.0
114
152
 
115
153
  # 2. Query all repositories for equivalents
116
154
  matches = resolve_all("bat", from_repo="arch")
117
155
  for r in matches:
118
- print(f"{r.repo}: {r.install_name}")
156
+ print(f"{r.repo}: {r.name}")
119
157
 
120
158
  # 3. High-performance batch resolution (executed in a single SQL query)
121
159
  packages = ["bat", "fd", "ripgrep"]
@@ -123,7 +161,7 @@ results = resolve_batch(packages, from_repo="arch", to_repo="nixpkgs")
123
161
 
124
162
  for pkg, match in results.items():
125
163
  if match:
126
- print(f"{pkg} -> {match.install_name}")
164
+ print(f"{pkg} -> {match.name}")
127
165
  ```
128
166
 
129
167
  ### API Methods
@@ -133,20 +171,24 @@ for pkg, match in results.items():
133
171
  - `resolve_batch(packages, from_repo=None, to_repo=None, db_path=None)`: Resolves a sequence of packages in a single batch query, returning `{package: PackageResolution | None}`.
134
172
  - `resolve_batch_all(packages, from_repo=None, to_repo=None, db_path=None)`: Batch resolution returning `{package: list[PackageResolution]}`.
135
173
  - `list_repositories(db_path=None)`: Returns all repositories with package counts and families.
174
+ - `set_default_variant(variant)`: Sets the default database variant (`"full"` or `"core"`).
175
+ - `get_default_variant()`: Returns the active default database variant.
136
176
 
137
177
  ---
138
178
 
139
179
  ## Configuration
140
180
 
141
- By default, the database is stored at:
142
- - `~/.cache/pkgmap/pkgmap.db`
181
+ By default, databases are cached at:
182
+ - Full database: `~/.cache/pkgmap/pkgmap.db`
183
+ - Core database: `~/.cache/pkgmap/pkgmap-core.db`
143
184
 
144
- You can customize the location using:
145
- - The `PKGMAP_DB_PATH` environment variable:
185
+ You can customize behavior using environment variables:
186
+ - `PKGMAP_DB_VARIANT`: Set to `core` or `full` to override the default database variant.
187
+ - `PKGMAP_DB_PATH`: Override the database file path directly:
146
188
  ```bash
147
189
  export PKGMAP_DB_PATH="/path/to/custom/pkgmap.db"
148
190
  ```
149
- - Or the `--db-path` argument on the CLI / `db_path` parameter in Python.
191
+ - Or pass `--db-path` on the CLI / `db_path` in Python.
150
192
 
151
193
  ---
152
194
 
@@ -4,7 +4,10 @@ Cross-distribution Linux package name resolution.
4
4
 
5
5
  Different distributions often package the exact same software under different names (for example, `ninja` on Arch is `ninja-build` on Debian and Alpine; `bat` on Arch is `rust-bat` on Debian and Fedora; `fd` on Arch is `rust-fd-find` on Debian; Nixpkgs uses specific attribute paths). `pkgmap` provides an offline SQLite database and a companion Python library/CLI to translate package names between any pair of Linux distributions, resolve packages across all repositories, or look up native packages by upstream project name.
6
6
 
7
- Data is updated daily from [Repology](https://repology.org) and indexed for instant local lookups. On first run, `pkgmap` automatically downloads and decompresses the latest daily database release (`~/.cache/pkgmap/pkgmap.db`).
7
+ Data is updated daily from [Repology](https://repology.org) and indexed for instant local lookups. On first run, `pkgmap` automatically downloads and decompresses the latest daily database snapshot (`~/.cache/pkgmap/`).
8
+
9
+ - **PyPI**: [`pkgmap-py`](https://pypi.org/project/pkgmap-py/)
10
+ - **Web Interface**: [levizor.github.io/pkgmap](https://levizor.github.io/pkgmap/) (runs 100% client-side via SQLite WebAssembly + OPFS)
8
11
 
9
12
  ---
10
13
 
@@ -17,13 +20,28 @@ Use `--from` (`-f`) and `--to` (`-t`):
17
20
  ```bash
18
21
  # What is Arch's 'bat' called in Debian?
19
22
  pkgmap resolve bat --from arch --to debian
20
- # Output: rust-bat (0.22.1) [category: misc]
23
+ # Output: rust-bat (0.24.0)
21
24
 
22
25
  # What is Arch's 'fd' in Nixpkgs?
23
26
  pkgmap resolve fd -f arch -t nixpkgs
24
27
  # Output: fd (10.5.0)
25
28
  ```
26
29
 
30
+ ### Batch resolution
31
+
32
+ Pass multiple package names to resolve them in a single query:
33
+
34
+ ```bash
35
+ pkgmap resolve git gcc bat --from nix --to gnuguix
36
+ ```
37
+
38
+ Output:
39
+ ```text
40
+ git -> git (2.54.0)
41
+ gcc -> gcc (15.2.0)
42
+ bat -> bat (0.26.1)
43
+ ```
44
+
27
45
  ### Resolve across all distributions
28
46
 
29
47
  Omit `--to` to see equivalents across every indexed distribution:
@@ -34,8 +52,8 @@ pkgmap resolve bat --from arch
34
52
 
35
53
  Output:
36
54
  ```text
37
- alpine_3_20: bat (0.24.0)
38
- debian_12: rust-bat (0.22.1) [category: misc]
55
+ alpine_edge: bat (0.24.0)
56
+ debian_unstable: rust-bat (0.24.0)
39
57
  fedora_rawhide: rust-bat (0.26.1)
40
58
  nix_unstable: bat (0.26.1)
41
59
  ubuntu_24_04: rust-bat (0.24.0)
@@ -48,7 +66,7 @@ Omit `--from` (or pass `--project` / `-p`) to resolve packages directly from an
48
66
 
49
67
  ```bash
50
68
  pkgmap resolve ripgrep --to debian
51
- # Output: rust-ripgrep (13.0.0) [category: misc]
69
+ # Output: rust-ripgrep (14.1.0)
52
70
  ```
53
71
 
54
72
  ### JSON output
@@ -63,15 +81,15 @@ pkgmap resolve bat -f arch -t debian --json
63
81
  [
64
82
  {
65
83
  "name": "rust-bat",
66
- "version": "0.22.1",
67
- "category": "misc",
68
- "repo": "debian_12",
69
- "repo_family": "debuntu",
70
- "install_name": "rust-bat"
84
+ "version": "0.24.0",
85
+ "repo": "debian_unstable",
86
+ "repo_family": "debuntu"
71
87
  }
72
88
  ]
73
89
  ```
74
90
 
91
+ When multiple packages are passed with `--json`, the output is a dictionary keyed by each input package name.
92
+
75
93
  ### Other commands
76
94
 
77
95
  ```bash
@@ -80,27 +98,47 @@ pkgmap repos
80
98
 
81
99
  # Manually refresh the local database snapshot
82
100
  pkgmap update
101
+
102
+ # Download the full database (all 330+ Repology repositories)
103
+ pkgmap update --full
83
104
  ```
84
105
 
85
106
  ---
86
107
 
108
+ ## Core vs. Full Database Variants
109
+
110
+ `pkgmap` publishes two database snapshots with every daily release:
111
+
112
+ | Variant | File | Compressed Size | Coverage | Default For |
113
+ | :--- | :--- | :--- | :--- | :--- |
114
+ | **Core** | `pkgmap-core.db` | ~7 MB | Top 10 repositories (Nixpkgs, Arch, AUR, Debian, Ubuntu, Fedora, Alpine, openSUSE, Gentoo, Void) | **CLI & Web UI** |
115
+ | **Full** | `pkgmap.db` | ~37 MB | All 330+ Repology repositories | **Python Library** |
116
+
117
+ - **CLI behavior**: Defaults to the **Core** database (`~/.cache/pkgmap/pkgmap-core.db`) unless the Full database is already downloaded locally or `--full` is passed. If you query a repository not present in Core, the CLI prompts you to run `pkgmap update --full`. You can also pass `--core` or `--full` to any CLI command (`resolve`, `update`, `repos`).
118
+ - **Python library behavior**: Defaults to the **Full** database (`~/.cache/pkgmap/pkgmap.db`). Call `set_default_variant("core")` (or set `PKGMAP_DB_VARIANT=core`) to use the Core database instead.
119
+
120
+ ---
121
+
87
122
  ## Python API
88
123
 
89
- You can also use `pkgmap` as a Python library:
124
+ You can use `pkgmap` as a Python library:
90
125
 
91
126
  ```python
92
- from pkgmap import resolve, resolve_all, resolve_batch
127
+ from pkgmap import resolve, resolve_all, resolve_batch, set_default_variant
128
+
129
+ # Optional: switch library default from 'full' to 'core'
130
+ # set_default_variant("core")
93
131
 
94
132
  # 1. Single package resolution
95
133
  res = resolve("bat", from_repo="arch", to_repo="debian")
96
134
  if res:
97
- print(res.install_name, res.version)
98
- # Output: rust-bat 0.22.1
135
+ print(res.name, res.version)
136
+ # Output: rust-bat 0.24.0
99
137
 
100
138
  # 2. Query all repositories for equivalents
101
139
  matches = resolve_all("bat", from_repo="arch")
102
140
  for r in matches:
103
- print(f"{r.repo}: {r.install_name}")
141
+ print(f"{r.repo}: {r.name}")
104
142
 
105
143
  # 3. High-performance batch resolution (executed in a single SQL query)
106
144
  packages = ["bat", "fd", "ripgrep"]
@@ -108,7 +146,7 @@ results = resolve_batch(packages, from_repo="arch", to_repo="nixpkgs")
108
146
 
109
147
  for pkg, match in results.items():
110
148
  if match:
111
- print(f"{pkg} -> {match.install_name}")
149
+ print(f"{pkg} -> {match.name}")
112
150
  ```
113
151
 
114
152
  ### API Methods
@@ -118,20 +156,24 @@ for pkg, match in results.items():
118
156
  - `resolve_batch(packages, from_repo=None, to_repo=None, db_path=None)`: Resolves a sequence of packages in a single batch query, returning `{package: PackageResolution | None}`.
119
157
  - `resolve_batch_all(packages, from_repo=None, to_repo=None, db_path=None)`: Batch resolution returning `{package: list[PackageResolution]}`.
120
158
  - `list_repositories(db_path=None)`: Returns all repositories with package counts and families.
159
+ - `set_default_variant(variant)`: Sets the default database variant (`"full"` or `"core"`).
160
+ - `get_default_variant()`: Returns the active default database variant.
121
161
 
122
162
  ---
123
163
 
124
164
  ## Configuration
125
165
 
126
- By default, the database is stored at:
127
- - `~/.cache/pkgmap/pkgmap.db`
166
+ By default, databases are cached at:
167
+ - Full database: `~/.cache/pkgmap/pkgmap.db`
168
+ - Core database: `~/.cache/pkgmap/pkgmap-core.db`
128
169
 
129
- You can customize the location using:
130
- - The `PKGMAP_DB_PATH` environment variable:
170
+ You can customize behavior using environment variables:
171
+ - `PKGMAP_DB_VARIANT`: Set to `core` or `full` to override the default database variant.
172
+ - `PKGMAP_DB_PATH`: Override the database file path directly:
131
173
  ```bash
132
174
  export PKGMAP_DB_PATH="/path/to/custom/pkgmap.db"
133
175
  ```
134
- - Or the `--db-path` argument on the CLI / `db_path` parameter in Python.
176
+ - Or pass `--db-path` on the CLI / `db_path` in Python.
135
177
 
136
178
  ---
137
179
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pkgmap-py"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Cross-distribution Linux package name resolution"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pkgmap-py"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  description = "Cross-distribution Linux package name resolution"
5
5
  authors = [{ name = "Levizor", email = "levizor@disroot.org" }]
6
6
  license = { text = "MIT" }
@@ -1,6 +1,13 @@
1
1
  """Cross-distribution Linux package name resolution library."""
2
2
 
3
- from pkgmap.db import ensure_database, get_database_path, update_database
3
+ from pkgmap.db import (
4
+ DatabaseVariant,
5
+ ensure_database,
6
+ get_database_path,
7
+ get_default_variant,
8
+ set_default_variant,
9
+ update_database,
10
+ )
4
11
  from pkgmap.resolver import (
5
12
  PackageResolution,
6
13
  list_repositories,
@@ -11,16 +18,19 @@ from pkgmap.resolver import (
11
18
  resolve_project,
12
19
  )
13
20
 
14
- __version__ = "0.1.0"
21
+ __version__ = "0.2.0"
15
22
  __all__ = [
23
+ "DatabaseVariant",
16
24
  "PackageResolution",
17
25
  "ensure_database",
18
26
  "get_database_path",
27
+ "get_default_variant",
19
28
  "list_repositories",
20
29
  "resolve",
21
30
  "resolve_all",
22
31
  "resolve_batch",
23
32
  "resolve_batch_all",
24
33
  "resolve_project",
34
+ "set_default_variant",
25
35
  "update_database",
26
36
  ]
@@ -53,6 +53,21 @@ def pipeline_build(
53
53
  help="Path for the output SQLite database",
54
54
  ),
55
55
  ] = Path("pkgmap.db"),
56
+ core_output_file: Annotated[
57
+ Path | None,
58
+ typer.Option(
59
+ "-c",
60
+ "--core-output-path",
61
+ help="Optional path for the core subset SQLite database (e.g. pkgmap-core.db)",
62
+ ),
63
+ ] = None,
64
+ repos_config: Annotated[
65
+ Path | None,
66
+ typer.Option(
67
+ "--repos-config",
68
+ help="Optional path to repos.toml configuration file",
69
+ ),
70
+ ] = None,
56
71
  batch_size: Annotated[
57
72
  int,
58
73
  typer.Option(
@@ -73,6 +88,8 @@ def pipeline_build(
73
88
  pipeline.main(
74
89
  dump_file=input_dump,
75
90
  output_file=output_file,
91
+ core_output_file=core_output_file,
92
+ repos_config=repos_config,
76
93
  batch_size=batch_size,
77
94
  release_notes=release_notes,
78
95
  dump_date=dump_date,