Commit 382b678
feat(py_wheel): Normalize name and version (#1331)
Added the `incompatible_normalize_name` feature flag to normalize the
package distribution name according to latest Python packaging
standards. Defaults to `False` for the time being.
Added the `incompatible_normalize_version` feature flag to normalize the
package version according to PEP440 standard. This also adds support for
local version specifiers (versions with a `+` in them), in accordance
with PEP440. Defaults to `False` for the time being.
Instead of following the obsolete PEP 427 escaping procedure for
distribution names and versions, we should use the rules specified by
https://packaging.python.org/en/latest/specifications (sections "Package
name normalization" and "Binary distribution format"). For the versions,
this means normalizing them according to PEP 440.
Added as feature flags to avoid forcing the user to deal with breaking
changes when upgrading `rules_python`:
- Distribution names have stronger requirements now: "A valid name
consists only of ASCII letters and numbers, period, underscore and
hyphen. It must start and end with a letter or number."
https://packaging.python.org/en/latest/specifications/name-normalization/
- Versions must be valid PEP 440 version identifiers. Previously
versions such as "0.1-2-3" would have been accepted; that is no longer
the case.
- The file name of generated wheels may have changed, if the
distribution name or the version identifier wasn't in normalized form.
- The wheelmaker now depends on `packaging.version`, which means the
`py_wheel` user now needs to load pip dependencies in their
`WORKSPACE.bazel` file:
```
load("@rules_python//python/pip_install:repositories.bzl",
"pip_install_dependencies")
pip_install_dependencies()
```
Fixes #883. Fixes #1132.
---------
Co-authored-by: Ignas Anikevicius <[email protected]>
Co-authored-by: Ignas Anikevicius <[email protected]>1 parent 423c1de commit 382b678
File tree
11 files changed
+906
-23
lines changed- docs
- examples/wheel
- python
- private
- tests/py_wheel
- tools
11 files changed
+906
-23
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
76 | 78 | | |
77 | 79 | | |
78 | 80 | | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| 102 | + | |
| 103 | + | |
98 | 104 | | |
99 | 105 | | |
100 | 106 | | |
| |||
123 | 129 | | |
124 | 130 | | |
125 | 131 | | |
| 132 | + | |
| 133 | + | |
126 | 134 | | |
127 | 135 | | |
128 | 136 | | |
| |||
156 | 164 | | |
157 | 165 | | |
158 | 166 | | |
| 167 | + | |
| 168 | + | |
159 | 169 | | |
160 | 170 | | |
161 | 171 | | |
| |||
177 | 187 | | |
178 | 188 | | |
179 | 189 | | |
| 190 | + | |
| 191 | + | |
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
| |||
191 | 203 | | |
192 | 204 | | |
193 | 205 | | |
| 206 | + | |
| 207 | + | |
194 | 208 | | |
195 | 209 | | |
196 | 210 | | |
| |||
206 | 220 | | |
207 | 221 | | |
208 | 222 | | |
| 223 | + | |
| 224 | + | |
209 | 225 | | |
210 | 226 | | |
211 | 227 | | |
| |||
220 | 236 | | |
221 | 237 | | |
222 | 238 | | |
| 239 | + | |
| 240 | + | |
223 | 241 | | |
224 | 242 | | |
225 | 243 | | |
| |||
231 | 249 | | |
232 | 250 | | |
233 | 251 | | |
| 252 | + | |
| 253 | + | |
234 | 254 | | |
235 | 255 | | |
236 | 256 | | |
| |||
244 | 264 | | |
245 | 265 | | |
246 | 266 | | |
| 267 | + | |
| 268 | + | |
247 | 269 | | |
248 | 270 | | |
249 | 271 | | |
| |||
258 | 280 | | |
259 | 281 | | |
260 | 282 | | |
261 | | - | |
| 283 | + | |
262 | 284 | | |
263 | 285 | | |
264 | 286 | | |
265 | 287 | | |
| 288 | + | |
| 289 | + | |
266 | 290 | | |
267 | 291 | | |
268 | 292 | | |
269 | 293 | | |
270 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
271 | 309 | | |
272 | 310 | | |
273 | 311 | | |
| |||
277 | 315 | | |
278 | 316 | | |
279 | 317 | | |
| 318 | + | |
280 | 319 | | |
281 | 320 | | |
282 | 321 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
153 | 153 | | |
154 | 154 | | |
155 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
156 | 194 | | |
157 | 195 | | |
158 | 196 | | |
159 | 197 | | |
160 | 198 | | |
161 | 199 | | |
162 | | - | |
| 200 | + | |
163 | 201 | | |
164 | 202 | | |
165 | 203 | | |
| |||
172 | 210 | | |
173 | 211 | | |
174 | 212 | | |
175 | | - | |
176 | | - | |
177 | | - | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
178 | 216 | | |
179 | 217 | | |
180 | 218 | | |
181 | | - | |
| 219 | + | |
182 | 220 | | |
183 | 221 | | |
184 | 222 | | |
185 | 223 | | |
186 | 224 | | |
187 | | - | |
188 | | - | |
| 225 | + | |
| 226 | + | |
189 | 227 | | |
190 | 228 | | |
191 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
| 80 | + | |
80 | 81 | | |
81 | 82 | | |
82 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
239 | 240 | | |
240 | 241 | | |
241 | 242 | | |
| |||
0 commit comments