Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: optional strict parsing of matchspec and versionspec #552

Merged
merged 9 commits into from
Mar 6, 2024

Conversation

baszalmstra
Copy link
Collaborator

Adds a mode to all from_str functions for MatchSpec, NamelessMatchSpec, VersionSpec, and Constraint.

Strict mode disallows some ambigous syntax like:

  • >=1.* should just be >=1
  • *.* should just be *

All parsing functions accept a ParseStrictness that can either be Strict or Lenient. Lenient mode should be used when parsing repodata etc, but Strict mode can be used to validate new user input.

@wolfv
Copy link
Contributor

wolfv commented Mar 4, 2024

Looks good to me!

I wonder if we should expose parse() and parse_strict() vs. the enum but that's my only comment.

@baszalmstra
Copy link
Collaborator Author

baszalmstra commented Mar 5, 2024

I wonder if we should expose parse() and parse_strict() vs. the enum but that's my only comment.

">=1.2.3".parse() will still work, it will use the lenient parser (because the types also implement FromStr). If you want strict parsing you have to call VersionSpec::from_str("1.2.3", Strict).

I used an enum because I expect that in the future we might possibly introduce more modes.

@wolfv wolfv merged commit f97c97b into conda:main Mar 6, 2024
14 checks passed
@baszalmstra baszalmstra mentioned this pull request Mar 6, 2024
baszalmstra added a commit that referenced this pull request Mar 6, 2024
## 🤖 New release
* `rattler`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_conda_types`: 0.19.0 -> 0.20.0 (✓ API compatible changes)
* `rattler_digest`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_macros`: 0.19.0 -> 0.19.1
* `rattler_package_streaming`: 0.19.0 -> 0.19.1 (✓ API compatible
changes)
* `rattler_networking`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_lock`: 0.19.0 -> 0.20.0 (⚠️ API breaking changes)
* `rattler_repodata_gateway`: 0.19.0 -> 0.19.1 (✓ API compatible
changes)
* `rattler_solve`: 0.19.0 -> 0.20.0 (✓ API compatible changes)
* `rattler_libsolv_c`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_virtual_packages`: 0.19.0 -> 0.19.1 (✓ API compatible
changes)
* `rattler_index`: 0.19.0 -> 0.19.1 (✓ API compatible changes)
* `rattler_shell`: 0.19.0 -> 0.19.1 (✓ API compatible changes)

### ⚠️ `rattler_lock` breaking changes

```
--- failure enum_variant_added: enum variant added on exhaustive enum ---

Description:
A publicly-visible enum without #[non_exhaustive] has a new variant.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new
       impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.29.1/src/lints/enum_variant_added.ron

Failed in:
  variant ParseCondaLockError:InvalidPypiPackageName in /tmp/.tmpLu7Njp/rattler/crates/rattler_lock/src/parse/mod.rs:37
```

<details><summary><i><b>Changelog</b></i></summary><p>

## `rattler`
<blockquote>

##
[0.19.1](rattler-v0.19.0...rattler-v0.19.1)
- 2024-03-06

### Added
- generalised CLI authentication
([#537](#537))

### Fixed
- removal of multiple packages that clobber each other
([#556](#556))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_conda_types`
<blockquote>

##
[0.20.0](rattler_conda_types-v0.19.0...rattler_conda_types-v0.20.0)
- 2024-03-06

### Added
- [**breaking**] optional strict parsing of matchspec and versionspec
([#552](#552))

### Fixed
- patch unsupported glob operators
([#551](#551))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_digest`
<blockquote>

##
[0.19.1](rattler_digest-v0.19.0...rattler_digest-v0.19.1)
- 2024-03-06

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_macros`
<blockquote>

##
[0.19.1](rattler_macros-v0.19.0...rattler_macros-v0.19.1)
- 2024-03-06

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_package_streaming`
<blockquote>

##
[0.19.1](rattler_package_streaming-v0.19.0...rattler_package_streaming-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_networking`
<blockquote>

##
[0.19.1](rattler_networking-v0.19.0...rattler_networking-v0.19.1)
- 2024-03-06

### Fixed
- add snapshot test and use btreemap in file backend
([#543](#543))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_lock`
<blockquote>

##
[0.20.0](rattler_lock-v0.19.0...rattler_lock-v0.20.0)
- 2024-03-06

### Added
- sort extras by name and urls by filename
([#540](#540))

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
- bump pep508_rs and pep440_rs
([#549](#549))
</blockquote>

## `rattler_repodata_gateway`
<blockquote>

##
[0.19.1](rattler_repodata_gateway-v0.19.0...rattler_repodata_gateway-v0.19.1)
- 2024-03-06

### Fixed
- correct condition to downweigh track-feature packages
([#545](#545))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_solve`
<blockquote>

##
[0.20.0](rattler_solve-v0.19.0...rattler_solve-v0.20.0)
- 2024-03-06

### Added
- [**breaking**] optional strict parsing of matchspec and versionspec
([#552](#552))

### Fixed
- removal of multiple packages that clobber each other
([#556](#556))
- correct condition to downweigh track-feature packages
([#545](#545))
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_libsolv_c`
<blockquote>

##
[0.19.1](rattler_libsolv_c-v0.19.0...rattler_libsolv_c-v0.19.1)
- 2024-03-06

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_virtual_packages`
<blockquote>

##
[0.19.1](rattler_virtual_packages-v0.19.0...rattler_virtual_packages-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_index`
<blockquote>

##
[0.19.1](rattler_index-v0.19.0...rattler_index-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>

## `rattler_shell`
<blockquote>

##
[0.19.1](rattler_shell-v0.19.0...rattler_shell-v0.19.1)
- 2024-03-06

### Fixed
- dont use workspace dependencies for local crates
([#546](#546))

### Other
- every crate should have its own version
([#557](#557))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/MarcoIeni/release-plz/).

Signed-off-by: Bas <4995967+baszalmstra@users.noreply.github.com>
Co-authored-by: Bas <4995967+baszalmstra@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants