@@ -19,7 +19,9 @@ 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 , ExcludeNewerTimestamp , ForkStrategy , PrereleaseMode , ResolutionMode ,
24
+ } ;
23
25
use uv_static:: EnvVars ;
24
26
use uv_torch:: TorchMode ;
25
27
use uv_workspace:: pyproject_mut:: AddBoundsKind ;
@@ -29,6 +31,34 @@ pub mod compat;
29
31
pub mod options;
30
32
pub mod version;
31
33
34
+ /// A package-specific exclude-newer entry.
35
+ #[ derive( Debug , Clone , PartialEq , Eq ) ]
36
+ pub struct ExcludeNewerPackageEntry {
37
+ pub package : PackageName ,
38
+ pub timestamp : ExcludeNewerTimestamp ,
39
+ }
40
+
41
+ impl FromStr for ExcludeNewerPackageEntry {
42
+ type Err = String ;
43
+
44
+ /// Parses a [`ExcludeNewerPackageEntry`] from a string in the format `PACKAGE=DATE`.
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` value `{s}`: expected format `PACKAGE=DATE`"
49
+ ) ) ;
50
+ } ;
51
+
52
+ let package = PackageName :: from_str ( package) . map_err ( |err| {
53
+ format ! ( "Invalid `exclude-newer-package` package name `{package}`: {err}" )
54
+ } ) ?;
55
+ let timestamp = ExcludeNewerTimestamp :: from_str ( date)
56
+ . map_err ( |err| format ! ( "Invalid `exclude-newer-package` timestamp `{date}`: {err}" ) ) ?;
57
+
58
+ Ok ( Self { package, timestamp } )
59
+ }
60
+ }
61
+
32
62
#[ derive( Debug , Clone , Copy , clap:: ValueEnum ) ]
33
63
pub enum VersionFormat {
34
64
/// Display the version as plain text.
@@ -2644,7 +2674,16 @@ pub struct VenvArgs {
2644
2674
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
2645
2675
/// format (e.g., `2006-12-02`) in your system's configured time zone.
2646
2676
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER ) ]
2647
- pub exclude_newer : Option < ExcludeNewer > ,
2677
+ pub exclude_newer : Option < ExcludeNewerTimestamp > ,
2678
+
2679
+ /// Limit candidate packages for a specific package to those that were uploaded prior to the given date.
2680
+ ///
2681
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
2682
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
2683
+ ///
2684
+ /// Can be provided multiple times for different packages.
2685
+ #[ arg( long) ]
2686
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
2648
2687
2649
2688
/// The method to use when installing packages from the global cache.
2650
2689
///
@@ -4626,7 +4665,16 @@ pub struct ToolUpgradeArgs {
4626
4665
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
4627
4666
/// format (e.g., `2006-12-02`) in your system's configured time zone.
4628
4667
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
4629
- pub exclude_newer : Option < ExcludeNewer > ,
4668
+ pub exclude_newer : Option < ExcludeNewerTimestamp > ,
4669
+
4670
+ /// Limit candidate packages for specific packages to those that were uploaded prior to the given date.
4671
+ ///
4672
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
4673
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
4674
+ ///
4675
+ /// Can be provided multiple times for different packages.
4676
+ #[ arg( long, help_heading = "Resolver options" ) ]
4677
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
4630
4678
4631
4679
/// The method to use when installing packages from the global cache.
4632
4680
///
@@ -5367,7 +5415,16 @@ pub struct InstallerArgs {
5367
5415
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
5368
5416
/// format (e.g., `2006-12-02`) in your system's configured time zone.
5369
5417
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5370
- pub exclude_newer : Option < ExcludeNewer > ,
5418
+ pub exclude_newer : Option < ExcludeNewerTimestamp > ,
5419
+
5420
+ /// Limit candidate packages for specific packages to those that were uploaded prior to the given date.
5421
+ ///
5422
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
5423
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
5424
+ ///
5425
+ /// Can be provided multiple times for different packages.
5426
+ #[ arg( long, help_heading = "Resolver options" ) ]
5427
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
5371
5428
5372
5429
/// The method to use when installing packages from the global cache.
5373
5430
///
@@ -5560,7 +5617,16 @@ pub struct ResolverArgs {
5560
5617
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
5561
5618
/// format (e.g., `2006-12-02`) in your system's configured time zone.
5562
5619
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5563
- pub exclude_newer : Option < ExcludeNewer > ,
5620
+ pub exclude_newer : Option < ExcludeNewerTimestamp > ,
5621
+
5622
+ /// Limit candidate packages for a specific package to those that were uploaded prior to the given date.
5623
+ ///
5624
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
5625
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
5626
+ ///
5627
+ /// Can be provided multiple times for different packages.
5628
+ #[ arg( long, help_heading = "Resolver options" ) ]
5629
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
5564
5630
5565
5631
/// The method to use when installing packages from the global cache.
5566
5632
///
@@ -5749,7 +5815,16 @@ pub struct ResolverInstallerArgs {
5749
5815
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
5750
5816
/// format (e.g., `2006-12-02`) in your system's configured time zone.
5751
5817
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5752
- pub exclude_newer : Option < ExcludeNewer > ,
5818
+ pub exclude_newer : Option < ExcludeNewerTimestamp > ,
5819
+
5820
+ /// Limit candidate packages for specific packages to those that were uploaded prior to the given date.
5821
+ ///
5822
+ /// Accepts package-date pairs in the format `PACKAGE=DATE`, where `DATE` is an RFC 3339 timestamp
5823
+ /// (e.g., `2006-12-02T02:07:43Z`) or local date (e.g., `2006-12-02`) in your system's configured time zone.
5824
+ ///
5825
+ /// Can be provided multiple times for different packages.
5826
+ #[ arg( long, help_heading = "Resolver options" ) ]
5827
+ pub exclude_newer_package : Option < Vec < ExcludeNewerPackageEntry > > ,
5753
5828
5754
5829
/// The method to use when installing packages from the global cache.
5755
5830
///
@@ -5838,7 +5913,7 @@ pub struct FetchArgs {
5838
5913
/// Accepts both RFC 3339 timestamps (e.g., `2006-12-02T02:07:43Z`) and local dates in the same
5839
5914
/// format (e.g., `2006-12-02`) in your system's configured time zone.
5840
5915
#[ arg( long, env = EnvVars :: UV_EXCLUDE_NEWER , help_heading = "Resolver options" ) ]
5841
- pub exclude_newer : Option < ExcludeNewer > ,
5916
+ pub exclude_newer : Option < ExcludeNewerTimestamp > ,
5842
5917
}
5843
5918
5844
5919
#[ derive( Args ) ]
0 commit comments