-
Notifications
You must be signed in to change notification settings - Fork 444
feat: Complete exclude_newer policy
#4344
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
Open
jjerphan
wants to merge
41
commits into
mamba-org:main
Choose a base branch
from
jjerphan:feat/exclude-newer-policy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
844c5b8
Fix clang-format violations
jezdez d88fa4d
Address exclude-newer review feedback
jezdez 40cfc6b
feat: Wire global exclude_newer config and CLI to solver
jjerphan 386634f
Remove useless `static_cast`
jjerphan 407996e
Do not pass the context's instance
jjerphan 4ec42c7
Support `exclude_newer_package`
jjerphan 59fff4d
Use custom regex match for string_view
jjerphan f614ddc
Rename to and use `ExcludeNewerPolicy`
jjerphan 376768b
Replace `trim` in preference of `util::strip_if`
jjerphan 9c03ead
Include missing header file in libmamba sources list
jjerphan d005385
Minor adaptations to utility functions
jjerphan d669e92
Add tests for `{CONDA,MAMBA}_EXCLUDE_NEWER{,_PACKAGE}`
jjerphan 12c7fb6
Test abscence of `timestamp` and `indexed_timestamp`
jjerphan bdc7805
Test `exclude_newer{,_package}` further
jjerphan 815bc46
Reorder files in sources lists
jjerphan bd81f34
Remove leftover field
jjerphan af68afd
Use elements of `std::chrono` and apply review comments
jjerphan 469745f
Name and type `exclude_newer_*` parameters
jjerphan dde5a93
Adapt and test ISO 8601 durations parsing
jjerphan 4ad4d33
Adapt and test compact duration parsing
jjerphan 1d82cd5
Throw `mamba_error` when a `exclude_newer` string is unparseable
jjerphan 3406c79
Fall back on `HowardHinnant/date` for macOS
jjerphan e89a730
Add `howardhinnant_date` as a host dep for macOS micromamba builds
jjerphan 71f2d5f
Require `msvcp140_atomic_wait.dll` at runtime for micromamba on Windows
jjerphan 5e7df62
Use `howardhinnant_date-static` for macOS micromamba builds
jjerphan 7d312bd
Add reference and remark about ISO 8601 duration format
jjerphan aaf90d0
Document specification of `exclude_newer_package`
jjerphan 5cae342
Do not include user-provided values in `ExcludeNewerPolicy`
jjerphan 6c6e8ac
Make `exclude_newer_package` part of common options
jjerphan e635a88
Document `howardhinnant_date` dependency
jjerphan 951d03e
Move comment to `ExcludeNewerPolicy`'s definition
jjerphan 7612748
Add TODO to drop Howard Hinnant date when chrono::parse is ubiquitous
jjerphan 7ea5be7
Store exclude_newer_package as a vector of pairs
jjerphan 67f185b
Use Markdown single backticks in exclude_newer docs
jjerphan b36d3ca
Drop implementation details from resolve_exclude_newer_cutoff docs
jjerphan b7eb3fe
Use chrono for exclude_newer reference time
jjerphan 2bbb36e
Use fmt for exclude_newer parse error messages
jjerphan 59094e0
Use chrono duration units for exclude_newer parsing
jjerphan e764579
Accumulate chrono durations in compact exclude_newer parser
jjerphan 4424176
Adapt CMAKE_REQUIRED_FLAGS
jjerphan 1e56c01
Fix coercion of `exclude_newer_package`
jjerphan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Copyright (c) 2026, QuantStack and Mamba Contributors | ||
| // | ||
| // Distributed under the terms of the BSD 3-Clause License. | ||
| // | ||
| // The full license is in the file LICENSE, distributed with this software. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <chrono> | ||
| #include <optional> | ||
| #include <sstream> | ||
| #include <string> | ||
| #include <string_view> | ||
|
|
||
| #if defined(MAMBA_USE_HOWARD_HINNANT_DATE) | ||
| #include <date/date.h> | ||
| #include <date/tz.h> | ||
| #endif | ||
|
|
||
| namespace mamba::detail | ||
| { | ||
| /** | ||
| * Parse ``value`` with ``std::chrono::parse`` or ``date::from_stream`` using ``fmt``. | ||
| * | ||
| * When ``MAMBA_USE_HOWARD_HINNANT_DATE`` is set (libc++ lacks P0355; | ||
| * https://github.com/llvm/llvm-project/issues/166051), ``date::from_stream`` is used. | ||
| * | ||
| * TODO: Drop the Howard Hinnant ``date`` fallback once ``std::chrono::parse`` is | ||
| * available on all supported platforms (notably macOS/libc++). | ||
| * | ||
| * Returns ``std::nullopt`` when parsing fails or trailing characters remain. | ||
| */ | ||
| template <typename T> | ||
| [[nodiscard]] auto parse_chrono(std::string_view value, const char* fmt) -> std::optional<T> | ||
| { | ||
| std::istringstream stream{ std::string(value) }; | ||
| T out{}; | ||
| #if defined(MAMBA_USE_HOWARD_HINNANT_DATE) | ||
| date::from_stream(stream, fmt, out); | ||
| #else | ||
| stream >> std::chrono::parse(fmt, out); | ||
| #endif | ||
| if (stream.fail() || stream.peek() != std::istringstream::traits_type::eof()) | ||
| { | ||
| return std::nullopt; | ||
| } | ||
| return out; | ||
| } | ||
| } // namespace mamba::detail | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be clear: this is necessary only because MacOS's build toolchain doesnt implement
std::chrono::parseyet?If so, could you add a TODO about this in the documentation comments to replace it when
std::chrono::parsebecomes available everywhere?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a TODO to drop the Howard Hinnant fallback once std::chrono::parse is ubiquitous on supported platforms.