Skip to content

Commit

Permalink
Merge branch 'main' into version
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Jul 7, 2023
2 parents a81a38d + 5262b9e commit 56aa082
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
This file contains tracks the changes landing in Rye. It includes changes
that were not yet released.

## 0.10.0
## 0.11.0

_Unreleased_

- The `version` command can show dynamic versions now. #355

- `rye add` now properly checks some incompatible argument combinations. #347

- There is now more toolchain validation. This better supports cases where
rye was interrupted during sync. #351

<!-- released start -->

## 0.10.0

Released on 2023-07-07

- Fixed a bug with `rye init` not operating correctly due to a argument conflict. #346

- Scripts now support a PDM style `call` script type. #345
Expand All @@ -17,8 +28,6 @@ _Unreleased_

- Fixed the global shim behavior on Windows. #344

<!-- released start -->

## 0.9.0

Released on 2023-06-21
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/guide/shims.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ After installation Rye places two shims on your `PATH`: `python` and `python3`.
shims have specific behavior that changes depending on if they are used within a Rye
managed project or outside.

Inside a Rye managed project the resolve to the Python interpreter of the virtualenv.
Inside a Rye managed project they resolve to the Python interpreter of the virtualenv.
This means that even if you do not enable the virtualenv, you can just run `python`
in a shell, and it will automatically operate in the right environment.

Expand Down
2 changes: 1 addition & 1 deletion rye/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rye"
version = "0.10.0"
version = "0.11.0"
edition = "2021"
license = "MIT"

Expand Down
11 changes: 11 additions & 0 deletions rye/src/cli/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ impl From<Pin> for Operator {
}

impl ReqExtras {
/// Return true if any path, url, features or similar are set
/// (anything specific for 1 requirement).
pub fn has_specifiers(&self) -> bool {
self.path.is_some() || self.url.is_some() || self.git.is_some() || !self.features.is_empty()
}

pub fn force_absolute(&mut self) {
self.absolute = true;
}
Expand Down Expand Up @@ -182,6 +188,7 @@ impl ReqExtras {
#[derive(Parser, Debug)]
pub struct Args {
/// The package to add as PEP 508 requirement string. e.g. 'flask==2.2.3'
#[arg(required = true)]
requirements: Vec<String>,
#[command(flatten)]
req_extras: ReqExtras,
Expand Down Expand Up @@ -234,6 +241,10 @@ pub fn execute(cmd: Args) -> Result<(), Error> {
None => Config::current().default_dependency_operator(),
};

if cmd.req_extras.has_specifiers() && cmd.requirements.len() != 1 {
bail!("path/url/git/features is not compatible with passing multiple requirements: expected one requirement.")
}

for str_requirement in cmd.requirements {
let mut requirement = Requirement::from_str(&str_requirement)?;
cmd.req_extras.apply_to_requirement(&mut requirement)?;
Expand Down
1 change: 1 addition & 0 deletions rye/src/cli/remove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::utils::{format_requirement, CommandOutput};
#[derive(Parser, Debug)]
pub struct Args {
/// The packages to remove.
#[arg(required = true)]
requirements: Vec<String>,
/// Remove this from dev dependencies.
#[arg(long)]
Expand Down
3 changes: 3 additions & 0 deletions rye/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ pub fn list_known_toolchains() -> Result<Vec<(PythonVersion, PathBuf)>, Error> {
.parse::<PythonVersion>()
{
let target = get_toolchain_python_bin(&ver)?;
if !target.exists() {
continue
}
rv.push((ver, target));
}
}
Expand Down

0 comments on commit 56aa082

Please sign in to comment.