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