Skip to content
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

no longer upgrading toml files #784

Closed
crawfish-storeroom opened this issue Sep 8, 2022 · 17 comments
Closed

no longer upgrading toml files #784

crawfish-storeroom opened this issue Sep 8, 2022 · 17 comments

Comments

@crawfish-storeroom
Copy link

when i run cargo upgrade it used to actually change the .toml files, now all i get is a printout saying it found updates.

> cargo upgrade --workspace
    Updating 'https://github.com/rust-lang/crates.io-index' index
    Checking mylib's dependencies
note: Re-run with `--verbose` to show all dependencies
  compatible: anyhow, url
  unchanged: httpmock, serde, serde_json, toml_edit, ureq
    Checking myapp's dependencies
note: Re-run with `--verbose` to show all dependencies
  compatible: anyhow
  unchanged: clap, dirs, mylib, log, rpassword, serde, simplelog
note: Re-run with `--to-lockfile` to upgrade compatible version requirements

running with --verbose only gives a table but still does nothing. even running without workspace in a crate dir only prints the same. --to-lockfile does nothing since the toml doesnt change.

behavior doesnt match description of either the app or the args. can either the app or docs be fix please for correct behavior otherwise app is useless since someone needs to manually find versions and update the tomls and then upgrade the lockfile

@epage
Copy link
Collaborator

epage commented Sep 9, 2022

cargo upgrade is telling you that there is no upgrade to be performed, that there are no breaking changes to upgrade to. However, if you want to bump your minimum required versions (which have no bearing on your usage, just on people building against your crate), then you can pass in the --to-lockfile as the message says.

We are looking at changing this behavior again. In a discussion on merging cargo upgrade into cargo, we raised some concerns. If you scroll down on that, you will see a Proposal. While there is some concern on whether it is right to merge cargo-update and cargo-upgrade, I'm assuming the planned behavior is in that direction. If you have constructive feedback on that proposal, feel free to post in that thread.

@epage epage closed this as completed Sep 9, 2022
@crawfish-storeroom
Copy link
Author

this is a bug report of it not upgrading my toml files. your comment doesnt make sense, there ARE updates see below, this used to work fine and updated my toml and locks without extra flags

> cargo upgrade --workspace --verbose
    Updating 'https://github.com/rust-lang/crates.io-index' index
    Checking mylib's dependencies
name       old req locked  latest  new req note      
====       ======= ======  ======  ======= ====
anyhow     1.0.63  1.0.63  1.0.64  1.0.63  compatible
serde      1.0.144 1.0.144 1.0.144 1.0.144
serde_json 1.0.85  1.0.85  1.0.85  1.0.85
toml_edit  0.14.4  0.14.4  0.14.4  0.14.4
ureq       2.5.0   2.5.0   2.5.0   2.5.0
url        2.2.2   2.2.2   2.3.1   2.2.2   compatible
httpmock   0.6.6   0.6.6   0.6.6   0.6.6
    Checking myapp's dependencies
name      old req locked  latest  new req note      
====      ======= ======  ======  ======= ====
mylib 0.1.0   0.1.0   -       0.1.0
anyhow    1.0.63  1.0.63  1.0.64  1.0.63  compatible
clap      3.2.20  3.2.20  3.2.20  3.2.20
dirs      4.0.0   4.0.0   4.0.0   4.0.0
rpassword 7.0.0   7.0.0   7.0.0   7.0.0
serde     1.0.144 1.0.144 1.0.144 1.0.144
log       0.4.17  0.4.17  0.4.17  0.4.17
simplelog 0.12.0  0.12.0  0.12.0  0.12.0
note: Re-run with `--to-lockfile` to upgrade compatible version requirements

it says its compatible to upgrade to and my lockfile matches existing version already. --to-lockfile does nothing as i note before.

it looks to me there is nothing to merge if this doesnt work. what is the last version that does upgrade the toml so i can downgrade to?

@epage
Copy link
Collaborator

epage commented Sep 9, 2022

it says its compatible to upgrade to

It is saying that the existing version requirement is already compatible

--to-lockfile does nothing as i note before.

Please provide verbose output of that run.

@crawfish-storeroom
Copy link
Author

> cargo upgrade --workspace --verbose --to-lockfile
    Checking mylib's dependencies
name       old req locked  latest  new req
====       ======= ======  ======  =======
anyhow     1.0.63  1.0.63  1.0.64  1.0.63
serde      1.0.144 1.0.144 1.0.144 1.0.144
serde_json 1.0.85  1.0.85  1.0.85  1.0.85
toml_edit  0.14.4  0.14.4  0.14.4  0.14.4
ureq       2.5.0   2.5.0   2.5.0   2.5.0
url        2.2.2   2.2.2   2.3.1   2.2.2  
httpmock   0.6.6   0.6.6   0.6.6   0.6.6
    Checking myapp's dependencies
name      old req locked  latest  new req
====      ======= ======  ======  =======
mylib  0.1.0   0.1.0   -       0.1.0
anyhow    1.0.63  1.0.63  1.0.64  1.0.63
clap      3.2.20  3.2.20  3.2.20  3.2.20
dirs      4.0.0   4.0.0   4.0.0   4.0.0
rpassword 7.0.0   7.0.0   7.0.0   7.0.0
serde     1.0.144 1.0.144 1.0.144 1.0.144
log       0.4.17  0.4.17  0.4.17  0.4.17
simplelog 0.12.0  0.12.0  0.12.0  0.12.0

@crawfish-storeroom
Copy link
Author

if its compatible i want new version in my toml automatically not for me to go manually update it all. behavior is not clear or documented right. https://github.com/killercup/cargo-edit#examples-1 specially says upgrades deps but that is not what happens, usage says updates the toml too again which doesnt happen

@epage
Copy link
Collaborator

epage commented Sep 9, 2022

Could you also include full reproduction steps, including a copy of the relevant Cargo.toml file?

@crawfish-storeroom
Copy link
Author

crawfish-storeroom commented Sep 9, 2022

i literally just did but here is my toml. also see #761 which repros the issue and has the same problem i do

use this toml, run cargo upgrade and see nothing change. i have my files in git so i can prove it doesnt change with git status. not even lockfile change. so its not just cargo upgrade showing no change its git too.

[package]
name = "mylib"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = { version = "1.0.63", default-features = false, features = ["std"] }
serde = { version = "1.0.144", features = ["derive"] }
serde_json = "1.0.85"
toml_edit = { version = "0.14.4", features = ["easy"] }
ureq = { version = "2.5.0", features = ["json", "tls"] }
url = { version = "2.2.2", default-features = false }

[dev-dependencies]
httpmock = { version = "0.6.6", default-features = false }

i just downgrade to 0.9.1 and it WORKS and upgrades my TOML files like i expect. this is regression in new version and no longer work. 0.10.0 and newer does nothing and changes no files.

with 0.9.1 i see this which updates files and is different that my original comment output

> cargo upgrade --workspace
    Updating 'https://github.com/rust-lang/crates.io-index' index
mylib:
    Upgrading anyhow v1.0.63 -> v1.0.64
    Upgrading url v2.2.2 -> v2.3.1
myapp:
    Upgrading anyhow v1.0.63 -> v1.0.64

cc @U007D @mqudsi from that thread if they want to add info or get a working version of this

@epage
Copy link
Collaborator

epage commented Sep 9, 2022

i literally just did but here is my toml. also see #761 which repros the issue and has the same problem i do

In terms of --to-lockfile doing nothing, that wasn't part of that issue. That issue is focused on expected changes of behavior which is also in this thread. As I said both in this thread and that thread, we expect to be changing the behavior. Most likely that change will better match what you expect, see the linked thread above. I'd recommend people focus their energy on the proposal rather than on what currently is. I am not in too much of a hurry in address what currently is because people can still get all of the functionality they want (pending bugs), I was waiting for further settling on the idea, and I have other priorities I am focusing on at the moment.

use this toml, run cargo upgrade and see nothing change. i have my files in git so i can prove it doesnt change with git status. not even lockfile change. so its not just cargo upgrade showing no change its git too.

$ cargo upgrade
note: Re-run with `--verbose` to show all dependencies
  compatible: anyhow, url
  unchanged: httpmock, serde, serde_json, toml_edit, ureq
note: Re-run with `--to-lockfile` to upgrade compatible version requirements 

That got the same results as you and ran according to expected behavior

$ cargo upgrade --to-lockfile --verbose
name       old req locked  latest  new req
====       ======= ======  ======  =======
anyhow     1.0.63  1.0.64  1.0.64  1.0.64
serde      1.0.144 1.0.144 1.0.144 1.0.144
serde_json 1.0.85  1.0.85  1.0.85  1.0.85
toml_edit  0.14.4  0.14.4  0.14.4  0.14.4
ureq       2.5.0   2.5.0   2.5.0   2.5.0
url        2.2.2   2.3.1   2.3.1   2.3.1
httpmock   0.6.6   0.6.6   0.6.6   0.6.6
``
That works as expected

Oh, I had missed this part
```console
> cargo upgrade --workspace --verbose --to-lockfile
    Checking mylib's dependencies
name       old req locked  latest  new req
====       ======= ======  ======  =======
anyhow     1.0.63  1.0.63  1.0.64  1.0.63
serde      1.0.144 1.0.144 1.0.144 1.0.144
serde_json 1.0.85  1.0.85  1.0.85  1.0.85
toml_edit  0.14.4  0.14.4  0.14.4  0.14.4
ureq       2.5.0   2.5.0   2.5.0   2.5.0
url        2.2.2   2.2.2   2.3.1   2.2.2  
httpmock   0.6.6   0.6.6   0.6.6   0.6.6
    Checking myapp's dependencies
name      old req locked  latest  new req
====      ======= ======  ======  =======
mylib  0.1.0   0.1.0   -       0.1.0
anyhow    1.0.63  1.0.63  1.0.64  1.0.63
clap      3.2.20  3.2.20  3.2.20  3.2.20
dirs      4.0.0   4.0.0   4.0.0   4.0.0
rpassword 7.0.0   7.0.0   7.0.0   7.0.0
serde     1.0.144 1.0.144 1.0.144 1.0.144
log       0.4.17  0.4.17  0.4.17  0.4.17
simplelog 0.12.0  0.12.0  0.12.0  0.12.0

The lock file isn't up-to-date. If you run cargo update first, then it will update (note the name of the flag, --to-lockfile, it is making the manifest match the lock file)

@crawfish-storeroom
Copy link
Author

crawfish-storeroom commented Sep 9, 2022

doing a cargo update first and any of the upgrade commands still doesnt update my tomls. i am updating your proposal linking these issues so they know this isnt working right compared to past versions and CURRENT docs.

the behavior already change and should go back to what is advertised and was working otherwise its regressed and isnt benefit to anyone when merged imo

@frederikhors
Copy link

Same here. No more upgrades to latest versions which is the only reason I need this tool.

Why???

@epage
Copy link
Collaborator

epage commented Sep 12, 2022

@frederikhors as discussed in both threads you posted on, there are upgrades happening, just not all version requirements being bumped up. As for "why", the answer is also earlier in this thread.

Rather than spamming multiple threads, retreading the same ground, a more constructive way of responding is listed in both threads (adding your use case if it isn't there already and highlighting how well the current options for cargo-upgrade work or don't work for your use case).

master is already matching most of the current proposal but isn't released yet as we try to work out the last details in hopes to minimize further surprises to users by dramatic changes. The best way to get that released is to help the conversation move forward in a constructive manner.

@frederikhors
Copy link

The best way to get that released is to help the conversation move forward in a constructive manner.

  1. sorry
  2. it works by first executing cargo update and then cargo upgrade --to-lockfile
  3. sorry again

@epage
Copy link
Collaborator

epage commented Sep 14, 2022

@frederikhors
Copy link

frederikhors commented Sep 15, 2022

Please see https://github.com/killercup/cargo-edit/releases/tag/v0.11.0

And it changed again! 😄

Can you please help me understand how can I use it now with 0.11.0?

It was working with 0.10.14 with: cargo update and then cargo upgrade --workspace --to-lockfile.

What now?

🙏

@epage
Copy link
Collaborator

epage commented Sep 15, 2022

The new behavior is described in that link but the tl;dr is that cargo upgrade -i will give you most of the old-old cargo upgrade behavior; no cargo update needed.

@U007D
Copy link

U007D commented Sep 28, 2022

i just downgrade to 0.9.1 and it WORKS and upgrades my TOML files like i expect. this is regression in new version and no longer work. 0.10.0 and newer does nothing and changes no files.
...
cc @U007D @mqudsi from that thread if they want to add info or get a working version of this

Thank you. I just need my Cargo.toml dependencies brought up to the latest available versions like it used to. I'll downgrade to version 0.9.1 too--thanks for letting me know the version number.

@frederikhors
Copy link

i just downgrade to 0.9.1 and it WORKS and upgrades my TOML files like i expect. this is regression in new version and no longer work. 0.10.0 and newer does nothing and changes no files.
...
cc @U007D @mqudsi from that thread if they want to add info or get a working version of this

Thank you. I just need my Cargo.toml dependencies brought up to the latest available versions like it used to. I'll downgrade to version 0.9.1 too--thanks for letting me know the version number.

It works with the latest. Please read carefully. @epage did a very incredible job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants