@@ -19,7 +19,10 @@ use uv_pep508::{MarkerTree, Requirement};
19
19
use uv_pypi_types:: VerbatimParsedUrl ;
20
20
use uv_python:: { PythonDownloads , PythonPreference , PythonVersion } ;
21
21
use uv_redacted:: DisplaySafeUrl ;
22
- use uv_resolver:: { AnnotationStyle , ExcludeNewer , ForkStrategy , PrereleaseMode , ResolutionMode } ;
22
+ use uv_resolver:: {
23
+ AnnotationStyle , ExcludeNewer , ExcludeNewerTimestamp , ForkStrategy , PrereleaseMode ,
24
+ ResolutionMode ,
25
+ } ;
23
26
use uv_static:: EnvVars ;
24
27
use uv_torch:: TorchMode ;
25
28
use uv_workspace:: pyproject_mut:: AddBoundsKind ;
@@ -29,6 +32,31 @@ pub mod compat;
29
32
pub mod options;
30
33
pub mod version;
31
34
35
+ /// A package-specific exclude-newer entry in the format `PACKAGE=DATE`.
36
+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
37
+ pub struct ExcludeNewerPackageEntry {
38
+ pub package : PackageName ,
39
+ pub timestamp : ExcludeNewerTimestamp ,
40
+ }
41
+
42
+ impl FromStr for ExcludeNewerPackageEntry {
43
+ type Err = String ;
44
+
45
+ fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
46
+ let Some ( ( package, date) ) = s. split_once ( '=' ) else {
47
+ return Err ( format ! (
48
+ "Invalid exclude-newer-package: {s} (expected `PACKAGE=DATE`)"
49
+ ) ) ;
50
+ } ;
51
+
52
+ let package = PackageName :: from_str ( package)
53
+ . map_err ( |err| format ! ( "Invalid package name `{package}`: {err}" ) ) ?;
54
+ let timestamp = ExcludeNewerTimestamp :: from_str ( date) ?;
55
+
56
+ Ok ( Self { package, timestamp } )
57
+ }
58
+ }
59
+
32
60
#[ derive( Debug , Clone , Copy , clap:: ValueEnum ) ]
33
61
pub enum VersionFormat {
34
62
/// Display the version as plain text.
@@ -2646,6 +2674,15 @@ pub struct VenvArgs {
2646
2674
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER ) ]
2647
2675
pub exclude_newer : Option < ExcludeNewer > ,
2648
2676
2677
+ /// Limit candidate packages for a specific package to those that were uploaded prior to the given date.
2678
+ ///
2679
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
2680
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
2681
+ ///
2682
+ /// Can be provided multiple times for different packages.
2683
+ #[ arg( long) ]
2684
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
2685
+
2649
2686
/// The method to use when installing packages from the global cache.
2650
2687
///
2651
2688
/// This option is only used for installing seed packages.
@@ -4628,6 +4665,15 @@ pub struct ToolUpgradeArgs {
4628
4665
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
4629
4666
pub exclude_newer : Option < ExcludeNewer > ,
4630
4667
4668
+ /// Limit candidate packages for specific packages to those that were uploaded prior to the given date.
4669
+ ///
4670
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
4671
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
4672
+ ///
4673
+ /// Can be provided multiple times for different packages.
4674
+ #[ arg( long, help_heading = "Resolver options" ) ]
4675
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
4676
+
4631
4677
/// The method to use when installing packages from the global cache.
4632
4678
///
4633
4679
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
@@ -5369,6 +5415,15 @@ pub struct InstallerArgs {
5369
5415
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5370
5416
pub exclude_newer : Option < ExcludeNewer > ,
5371
5417
5418
+ /// Limit candidate packages for specific packages to those that were uploaded prior to the given date.
5419
+ ///
5420
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
5421
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
5422
+ ///
5423
+ /// Can be provided multiple times for different packages.
5424
+ #[ arg( long, help_heading = "Resolver options" ) ]
5425
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
5426
+
5372
5427
/// The method to use when installing packages from the global cache.
5373
5428
///
5374
5429
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
@@ -5562,6 +5617,15 @@ pub struct ResolverArgs {
5562
5617
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5563
5618
pub exclude_newer : Option < ExcludeNewer > ,
5564
5619
5620
+ /// Limit candidate packages for a specific package to those that were uploaded prior to the given date.
5621
+ ///
5622
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
5623
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
5624
+ ///
5625
+ /// Can be provided multiple times for different packages.
5626
+ #[ arg( long, help_heading = "Resolver options" ) ]
5627
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
5628
+
5565
5629
/// The method to use when installing packages from the global cache.
5566
5630
///
5567
5631
/// This option is only used when building source distributions.
@@ -5751,6 +5815,15 @@ pub struct ResolverInstallerArgs {
5751
5815
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5752
5816
pub exclude_newer : Option < ExcludeNewer > ,
5753
5817
5818
+ /// Limit candidate packages for specific packages to those that were uploaded prior to the given date.
5819
+ ///
5820
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
5821
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
5822
+ ///
5823
+ /// Can be provided multiple times for different packages.
5824
+ #[ arg( long, help_heading = "Resolver options" ) ]
5825
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
5826
+
5754
5827
/// The method to use when installing packages from the global cache.
5755
5828
///
5756
5829
/// Defaults to `clone` (also known as Copy-on-Write) on macOS, and `hardlink` on Linux and
0 commit comments