-
Notifications
You must be signed in to change notification settings - Fork 44
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
List venvs #308
List venvs #308
Conversation
Hello! Thanks for this work!! I'll do a general analysis on the example you shown above, and after you consider this feedback, a proper review. So, some items (numbered, in case you want to refer them, feel free to discuss this here or in the Telegram group):
|
Some tests failing because of #309 (comment) |
Now #309 seems Fixed. Is this Ok?. 🤔 |
fades/helpers.py
Outdated
pac=v_dct_get("installed"), | ||
pyv=v_dct_get("interpreter"), | ||
opt=v_dct_get("options"), | ||
dat=datetime.fromtimestamp(v_dct_get("timestamp")).replace( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use {:%Y-%m-%d %H:%m}
(or similar) in tmplt and here you only need to use fromtimestamp
as fades is a CLI maybe we have to provide a way to "grep" the output.
Or maybe is better to add a filter ? |
Not sure I follow, output IS grep-able. 🤔 You want an Option for it to spit out the pretty printed JSON, then you can use any JSON specific tool to parse/highlight/filter/whatever ?. |
Being able to grep is a nice thing... we could show them one per line, like...
However, that escalates really quickly to "horrible". We could output a real json with all the info... but how would we consume it? if we're making that into a Python code anyway, probable it's easier to do ... ?
However, having to process a full json only to see those venvs that have some dependency installed is not really nice. Is this a use case? I think it's a nice to have. Note that we should have a different |
Right now |
This adds optional Filtering of the list of venvs!. Filter by UUID: juan@x ~/code/fades list-venvs|✓ $ bin/fades --list-venvs 9affefcf-1a7b-4545-8bf5-52739ee90299
Virtualenv UUID: 9affefcf-1a7b-4545-8bf5-52739ee90299
timestamp: 2018-04-06 21:55:55
full path: /home/juan/.local/share/fades/9affefcf-1a7b-4545-8bf5-52739ee90299
dependencies: {'pypi': {'ipython': '6.3.1', 'fades': '7.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
juan@x ~/code/fades list-venvs|✓ $ Filter by Dependency: juan@x ~/code/fades list-venvs|✓ $ bin/fades --list-venvs ipython
Virtualenv UUID: 158c5d41-10b1-412b-8522-f5ad3caba62c
timestamp: 2017-12-16 04:32:32
full path: /home/juan/.local/share/fades/158c5d41-10b1-412b-8522-f5ad3caba62c
dependencies: {'pypi': {'ipython': '6.2.1', 'scrapy': '1.4.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
Virtualenv UUID: 9affefcf-1a7b-4545-8bf5-52739ee90299
timestamp: 2018-04-06 21:55:55
full path: /home/juan/.local/share/fades/9affefcf-1a7b-4545-8bf5-52739ee90299
dependencies: {'pypi': {'ipython': '6.3.1', 'fades': '7.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
juan@x ~/code/fades list-venvs|✓ $ Filter by Dependencies: juan@x ~/code/fades list-venvs|✓ $ bin/fades --list-venvs ipython,pep257
Virtualenv UUID: b07962da-5719-47a9-a8d0-e5ae29232e6e
timestamp: 2017-06-22 22:55:51
full path: /home/juan/.local/share/fades/b07962da-5719-47a9-a8d0-e5ae29232e6e
dependencies: {'pypi': {'flake8': '2.5.2', 'logassert': '2', 'mccabe': '0.4.0', 'nose': '1.3.7', 'pep8': '1.7.0', 'pyflakes': '1.0.0', 'pyxdg': '0.25', 'wheel': '0.26.0', 'rst2html5': '1.7.5', 'setuptools': '28.8.0', 'nosexcover': '1.0.10', 'pep257': '0.7.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 158c5d41-10b1-412b-8522-f5ad3caba62c
timestamp: 2017-12-16 04:32:32
full path: /home/juan/.local/share/fades/158c5d41-10b1-412b-8522-f5ad3caba62c
dependencies: {'pypi': {'ipython': '6.2.1', 'scrapy': '1.4.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
Virtualenv UUID: 9affefcf-1a7b-4545-8bf5-52739ee90299
timestamp: 2018-04-06 21:55:55
full path: /home/juan/.local/share/fades/9affefcf-1a7b-4545-8bf5-52739ee90299
dependencies: {'pypi': {'ipython': '6.3.1', 'fades': '7.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
Virtualenv UUID: 5f11ebe8-46a7-45d1-ba01-6bf5011818a8
timestamp: 2018-04-06 23:53:57
full path: /home/juan/.local/share/fades/5f11ebe8-46a7-45d1-ba01-6bf5011818a8
dependencies: {'pypi': {'pycodestyle': '2.3.1', 'nose': '1.3.7', 'wheel': '0.26.0', 'rst2html5': '1.9.3', 'flake8': '3.5.0', 'pyflakes': '1.6.0', 'pyxdg': '0.25', 'pyuca': '1.1.2', 'nosexcover': '1.0.10', 'logassert': '2', 'pep257': '0.7.0', 'mccabe': '0.6.1', 'pep8': '1.7.0', 'setuptools': '28.8.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
juan@x ~/code/fades list-venvs|✓ $ Filter by non-existent: juan@x ~/code/fades list-venvs|✓ $ bin/fades --list-venvs non_existent
juan@x ~/code/fades list-venvs|✓ $ Dont Filter: juan@x ~/code/fades list-venvs|✓ $ bin/fades --list-venvs
Virtualenv UUID: 9dbbe58b-94ef-40a7-8a35-098a04cf4dfd
timestamp: 2017-02-21 00:54:00
full path: /home/juan/.local/share/fades/9dbbe58b-94ef-40a7-8a35-098a04cf4dfd
dependencies: {'pypi': {'microraptor': '1.9.5'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 6852052a-da4a-4b48-8542-d1c183f82cdd
timestamp: 2017-04-26 20:02:30
full path: /home/juan/.local/share/fades/6852052a-da4a-4b48-8542-d1c183f82cdd
dependencies: {'pypi': {'unicodemoticon': '3.0.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 9fc04480-b2f2-43da-a7ed-6afc32321522
timestamp: 2017-04-27 14:48:40
full path: /home/juan/.local/share/fades/9fc04480-b2f2-43da-a7ed-6afc32321522
dependencies: {'pypi': {'requests': '2.13.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: ce84c8de-ea4a-4b56-b992-0f284cb8bafd
timestamp: 2017-06-22 22:09:21
full path: /home/juan/.local/share/fades/ce84c8de-ea4a-4b56-b992-0f284cb8bafd
dependencies: {'pypi': {}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: b07962da-5719-47a9-a8d0-e5ae29232e6e
timestamp: 2017-06-22 22:55:51
full path: /home/juan/.local/share/fades/b07962da-5719-47a9-a8d0-e5ae29232e6e
dependencies: {'pypi': {'flake8': '2.5.2', 'logassert': '2', 'mccabe': '0.4.0', 'nose': '1.3.7', 'pep8': '1.7.0', 'pyflakes': '1.0.0', 'pyxdg': '0.25', 'wheel': '0.26.0', 'rst2html5': '1.7.5', 'setuptools': '28.8.0', 'nosexcover': '1.0.10', 'pep257': '0.7.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 95bf380a-b164-4c3c-8c50-b9edc3e18667
timestamp: 2017-06-28 12:20:44
full path: /home/juan/.local/share/fades/95bf380a-b164-4c3c-8c50-b9edc3e18667
dependencies: {'pypi': {'anglerfish': '2.5.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 158c5d41-10b1-412b-8522-f5ad3caba62c
timestamp: 2017-12-16 04:32:32
full path: /home/juan/.local/share/fades/158c5d41-10b1-412b-8522-f5ad3caba62c
dependencies: {'pypi': {'ipython': '6.2.1', 'scrapy': '1.4.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
Virtualenv UUID: 9affefcf-1a7b-4545-8bf5-52739ee90299
timestamp: 2018-04-06 21:55:55
full path: /home/juan/.local/share/fades/9affefcf-1a7b-4545-8bf5-52739ee90299
dependencies: {'pypi': {'ipython': '6.3.1', 'fades': '7.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': ['--system-site-packages'], 'virtualenv_options': ['--system-site-packages']}
Virtualenv UUID: 5f11ebe8-46a7-45d1-ba01-6bf5011818a8
timestamp: 2018-04-06 23:53:57
full path: /home/juan/.local/share/fades/5f11ebe8-46a7-45d1-ba01-6bf5011818a8
dependencies: {'pypi': {'pycodestyle': '2.3.1', 'nose': '1.3.7', 'wheel': '0.26.0', 'rst2html5': '1.9.3', 'flake8': '3.5.0', 'pyflakes': '1.6.0', 'pyxdg': '0.25', 'pyuca': '1.1.2', 'nosexcover': '1.0.10', 'logassert': '2', 'pep257': '0.7.0', 'mccabe': '0.6.1', 'pep8': '1.7.0', 'setuptools': '28.8.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 158988c8-abbe-4a35-ad71-d82221b0c065
timestamp: 2018-04-24 15:24:45
full path: /home/juan/.local/share/fades/158988c8-abbe-4a35-ad71-d82221b0c065
dependencies: {}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
juan@x ~/code/fades list-venvs|✓ $ 🐈 |
I really don't like having to filter ourselves. You would be adding a lot of code, and it will never be enough, like... hey, I now want to filter by interpreter! The best filtering tool is |
Filter by Interpreter: juan@x ~/code/fades list-venvs|✓ $ bin/fades --list-venvs /usr/bin/python3.6
Virtualenv UUID: 9dbbe58b-94ef-40a7-8a35-098a04cf4dfd
timestamp: 2017-02-21 00:54:00
full path: /home/juan/.local/share/fades/9dbbe58b-94ef-40a7-8a35-098a04cf4dfd
dependencies: {'pypi': {'microraptor': '1.9.5'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
Virtualenv UUID: 6852052a-da4a-4b48-8542-d1c183f82cdd
timestamp: 2017-04-26 20:02:30
full path: /home/juan/.local/share/fades/6852052a-da4a-4b48-8542-d1c183f82cdd
dependencies: {'pypi': {'unicodemoticon': '3.0.0'}}
interpreter: /usr/bin/python3.6
options: {'pyvenv_options': [], 'virtualenv_options': []}
juan@x ~/code/fades list-venvs|✓ $ |
The Template is now an arg of the function so anyone can customize I think the point of |
Ok, we discussed with @gilgamezh about this PR. We have chosen the desired output. There will not be any template, and no internal heuristic for filtering. The user will have two options: I think that with this info you can continue and prepare the PR for the next review, right? Please let me know if you have any doubt (or we can talk in fades' IRC channel or Telegram group. Thanks!!!! |
fades.helpers.list_venvs(index_path, logger=None)
function.--list-venvs
to CLI args.Example:
(The
logger=None
allows more clean output without the line*** fades *** 2018-04-06 23:38:49,233 INFO
)🐍💻🐱👍