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

[Feature Request] Ability to show python package releases for python interpreter #10

Closed
gaborbernat opened this issue Nov 2, 2021 · 14 comments
Assignees
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@gaborbernat
Copy link

gaborbernat commented Nov 2, 2021

Is your feature request related to a problem/bug/intentional feature? Please describe if it is.

Ability to view when your project dependencies have updated/changed.

Describe the solution you'd like.

pypi history --python env/bin/python --limit 1

# nested tree entries for version when limit > 1 else inline at the root level for the tree
- X - 1.2.0 3 hours ago (Sat Oct 23 11:00:04 2021)
- A - 1.0.0 5 days ago (Sat Oct 23 11:00:04 2021) 

would display in reverse chronological order the latest release for all packages found in the env/bin/python interpreter. Bonus point for showing the last n releases, where n is a CLI argument.

@gaborbernat gaborbernat added the enhancement New feature or request label Nov 2, 2021
@wasi-master
Copy link
Owner

wasi-master commented Nov 2, 2021

So something like pip freeze (with better formatting ofc) but for the latest version rather than the installed version?

@gaborbernat
Copy link
Author

It's more like a combination of pip list --outdated and reverse pip freeze 🤔. And would formulate it as the latest n version, rather than always latest, though by default could be just latest. If the local version is less than the latest display the release date of the local version and latest (in this case latest could be italic to show not yet installed). The idea is to see for a given interpreter what packages are out of date/up to date and when those versions have been released.

@wasi-master
Copy link
Owner

wasi-master commented Nov 2, 2021

I see. I'll start working on it tomorrow.

Although the name history seems a bit off to me 🤔.

@gaborbernat
Copy link
Author

Not sure what's a better name though.

@wasi-master
Copy link
Owner

wasi-master commented Nov 2, 2021

After doing some research I figured that you can already do this with the version command combined with pip list --outdated

Windows

pip list --outdated --format=freeze | %{$_.split('==')[0]} | %{pypi version --limit 1 --no-pre-releases --show-installed-version $_}

Linux/MacOS

pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n 1 pypi version --limit 1 --no-pre-releases --show-installed-version

Notes:

  • You need to update pypi-command-line to the latest version for the new arguments to work
    pip install -U pypi-command-line
  • You can also save these to a script file (extension: .bat on windows and .sh on linux) and then run the file whenever you need to

@gaborbernat
Copy link
Author

gaborbernat commented Nov 2, 2021

Would be nice if this would be supported out of box (even though can be worked around with various shell scripts). Also the versions printed are not in reverse chronological order 🤔

@wasi-master
Copy link
Owner

wasi-master commented Nov 2, 2021

The versions not being printed in chronological order is because it shows them in the same order pip list --outdated displays them as. This as a command would be hard to implement since there is no direct way of getting a list of all the installed packages programmatically, not really sure what to do

@gaborbernat
Copy link
Author

Couldn't this app collect internally those versions and sort them before displaying?

@wasi-master
Copy link
Owner

wasi-master commented Nov 2, 2021

Collect them how though, because I can't seem to find any way of doing that, most of the answers on stackoverflow are outdated. currently the only solution I can think of is to parse the output of pip list. I can try to do that

@wasi-master
Copy link
Owner

As much as I would like to do this, this is currently a bit out of scope for this library because it would rely on running and parsing the output of pip list --outdated just to sort them and a sufficiently good solution already exists.

Running and parsing shell commands within python just to sort the output is a bit too convoluted for this library in my opinion

Sorry, Please don't mind :)

@wasi-master wasi-master added the wontfix This will not be worked on label Nov 3, 2021
@gaborbernat
Copy link
Author

That's fine thank you, created https://github.com/gaborbernat/pypi_changes that achieves what I mostly wanted.

@wasi-master
Copy link
Owner

@gaborbernat Great, Looking forward to that :))

@gaborbernat
Copy link
Author

has been released now https://twitter.com/gjbernat/status/1456207118470684674
fyi

@wasi-master
Copy link
Owner

@gaborbernat looks nice, good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants