bibliothecary 12.1.8 → 12.1.10

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 77ce2638e657925c2ce0457675ddafea27858758ec53f68f996667eb21ac290c
4
- data.tar.gz: 7027d2ce73799ee52fdb6665fbaa115d2d630676cf777a740d62fae5ffa90534
3
+ metadata.gz: dfc52a5290fe4f0518906698b7dc69cf16b2a7747a130796162d8b8c431b6d9b
4
+ data.tar.gz: a68f8983ff54598396bf82d02a844ca867bd29a62044bede38ba13354d0a3386
5
5
  SHA512:
6
- metadata.gz: 9f12ee44667a46ec862d620870f1372755efe70af26243320b785e854c37e6ed7047d0988eadbe9758a9194c32d5f85772f5b2f9d69ee2a9e19e13a9873f937a
7
- data.tar.gz: 660b68966106543fbc7c8326a77ca5cc89947321dacf8f35a19aa1ee6818e4d077a1f1f0e86f1f8a7d6e52da6d377a7f8c90ac43d1b809158fe65c94dbaeb5c5
6
+ metadata.gz: '08a5bd08b3864366e22eb1baf58b1a35bd819997fc59a51adf412b6e5090b3d7534f045f8793ac79315be49aa151bb1d18b5dba33d53b0a9c5cbe72c7909c190'
7
+ data.tar.gz: c0574ce28cb9bcb5b3e03bab3e69859eb0e679fb809a0750d5bf7c3ba3efcf2585f61c65dbebf0c2d94edf3cd9b86b14bfea153c242a91a4b057443887c965c2
data/CHANGELOG.md CHANGED
@@ -13,6 +13,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
 
14
14
  ### Removed
15
15
 
16
+ ## [12.1.10] - 2025-05-23
17
+
18
+ ### Added
19
+
20
+ ### Changed
21
+
22
+ - Normalize package names in Poetry manifests, storing the original in
23
+ Dependency#original_name if it differs. This is because Poetry normalizes/canoncalizes
24
+ names in its lockfile according to PyPa's rules, but doesn't provide the original name.
25
+ Storing the original_name will provide a connection from manifest to lockfile.
26
+
27
+ ### Removed
28
+
29
+ ## [12.1.9] - 2025-05-16
30
+
31
+ ### Added
32
+
33
+ ### Changed
34
+
35
+ - Fix 12.1.8 Poetry regression that ignored deps with no category or group.
36
+
37
+ ### Removed
38
+
16
39
  ## [12.1.8] - 2025-05-16
17
40
 
18
41
  ### Added
@@ -119,13 +119,15 @@ module Bibliothecary
119
119
 
120
120
  # We're combining both poetry+PEP621 deps instead of making them mutually exclusive, until we
121
121
  # find a reason not to ingest them both.
122
- deps.uniq
123
- end
124
-
125
- # TODO: this was deprecated in 8.6.0. Remove this in any major version bump >= 9.*
126
- def self.parse_poetry(file_contents, options: {})
127
- puts "Warning: parse_poetry() is deprecated, use parse_pyproject() instead."
128
- parse_pyproject(file_contents, options)
122
+ deps = deps.uniq
123
+
124
+ # Poetry normalizes names in lockfiles but doesn't provide the original, so we need to keep
125
+ # track of the original name so the dep is connected between manifest+lockfile.
126
+ deps.map do |dep|
127
+ normalized_name = normalize_name(dep.name)
128
+ Dependency.new(**dep.to_h, name: normalized_name,
129
+ original_name: normalized_name == dep.name ? nil : dep.name)
130
+ end
129
131
  end
130
132
 
131
133
  def self.parse_conda(file_contents, options: {})
@@ -204,7 +206,7 @@ module Bibliothecary
204
206
 
205
207
  # Poetry <1.2.0 used singular "category" for kind
206
208
  # Poetry >=1.2.0 uses plural "groups" field for kind(s)
207
- package.values_at("category", "groups").flatten.compact
209
+ groups = package.values_at("category", "groups").flatten.compact
208
210
  .map do |g|
209
211
  if g == "dev"
210
212
  "develop"
@@ -212,14 +214,21 @@ module Bibliothecary
212
214
  (g == "main" ? "runtime" : g)
213
215
  end
214
216
  end
215
- .each do |group|
216
- deps << Dependency.new(
217
- name: package["name"],
218
- requirement: map_requirements(package),
219
- type: group,
220
- source: options.fetch(:filename, nil)
221
- )
222
- end
217
+
218
+ groups = ["runtime"] if groups.empty?
219
+
220
+ groups.each do |group|
221
+ # Poetry lockfiles should already contain normalizated names, but we'll
222
+ # apply it here as well just to be consistent with pyproject.toml parsing.
223
+ normalized_name = normalize_name(package["name"])
224
+ deps << Dependency.new(
225
+ name: normalized_name,
226
+ original_name: normalized_name == package["name"] ? nil : package["name"],
227
+ requirement: map_requirements(package),
228
+ type: group,
229
+ source: options.fetch(:filename, nil)
230
+ )
231
+ end
223
232
  end
224
233
  deps
225
234
  end
@@ -335,6 +344,12 @@ module Bibliothecary
335
344
  requirement = "*" if requirement == ""
336
345
  [name, requirement]
337
346
  end
347
+
348
+ # Apply PyPa's name normalization rules to the package name
349
+ # https://packaging.python.org/en/latest/specifications/name-normalization/#name-normalization
350
+ def self.normalize_name(name)
351
+ name.downcase.gsub(/[-_.]+/, "-")
352
+ end
338
353
  end
339
354
  end
340
355
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bibliothecary
4
- VERSION = "12.1.8"
4
+ VERSION = "12.1.10"
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibliothecary
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.1.8
4
+ version: 12.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-05-16 00:00:00.000000000 Z
10
+ date: 2025-05-23 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: commander