pip install時のライブラリバージョンをyolkで確認する

Python

概要

あるライブラリが必要となり、最新バージョンっていくつだろう?となったときに使えるyolkライブラリ。

yolk:インストールされている Python パッケージの情報を取得し、PyPI (Python Package Index) で利用可能なパッケージを照会するための Python ツール。

yolk3k:オリジナルのyolkをフォークし、Python2サポートを維持しつつ、Python3のサポートを追加したもの。どのパッケージがアクティブか、ノンアクティブか、開発中かを確認でき、PyPIに問い合わせることで、より新しいバージョンが利用できるものを表示するなどの機能が追加されている。実行時のコマンドはyolkのまま。

インストール

以下のコマンドでyolk3kをインストールします。

pip install yolk3k

パッケージのバージョンおよびメタデータの表示

オプション「-V」でパッケージの最新バージョンが取得されます。

yolk -V [パッケージ名]

例えばDjangoであれば以下の通り。

> yolk -V Django
Django 4.1.4

また、オプション「-M」で確認すると、そのパッケージのメタデータをPyPIから取得して表示します。

> yolk -M Django
name: Django
version: 4.1.4
stable_version: None
bugtrack_url: None
package_url: https://pypi.org/project/Django/
release_url: https://pypi.org/project/Django/4.1.4/
docs_url: None
home_page: https://www.djangoproject.com/
download_url:
project_url: ['Documentation, https://docs.djangoproject.com/', 'Funding, https://www.djangoproject.com/fundraising/', 'Release notes, https://docs.djangoproject.com/en/stable/releases/', 'Source, https://github.com/django/django', 'Tracker, https://code.djangoproject.com/']
author: Django Software Foundation
author_email: foundation@djangoproject.com
maintainer:
maintainer_email:
summary: A high-level Python web framework that encourages rapid development and clean, pragmatic design.
description: ======
Django
======

Django is a high-level Python web framework that encourages rapid development
and clean, pragmatic design. Thanks for checking it out.

All documentation is in the "``docs``" directory and online at
Django documentation | Django documentation
The web framework for perfectionists with deadlines.
If you're just getting started, here's how we recommend you read the docs: * First, read ``docs/intro/install.txt`` for instructions on installing Django. * Next, work through the tutorials in order (``docs/intro/tutorial01.txt``, ``docs/intro/tutorial02.txt``, etc.). * If you want to set up an actual deployment server, read ``docs/howto/deployment/index.txt`` for instructions. * You'll probably want to read through the topical guides (in ``docs/topics``) next; from there you can jump to the HOWTOs (in ``docs/howto``) for specific problems, and check out the reference (``docs/ref``) for gory details. * See ``docs/README`` for instructions on building an HTML version of the docs. Docs are updated rigorously. If you find any problems in the docs, or think they should be clarified in any way, please take 30 seconds to fill out a ticket here: https://code.djangoproject.com/newticket To get more help: * Join the ``#django`` channel on ``irc.libera.chat``. Lots of helpful people hang out there. See https://web.libera.chat if you're new to IRC. * Join the django-users mailing list, or read the archives, at https://groups.google.com/group/django-users. To contribute to Django: * Check out https://docs.djangoproject.com/en/dev/internals/contributing/ for information about getting involved. To run Django's test suite: * Follow the instructions in the "Unit tests" section of ``docs/internals/contributing/writing-code/unit-tests.txt``, published online at https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests Supporting the Development of Django ==================================== Django's development depends on your contributions. If you depend on Django, remember to support the Django Software Foundation: https://www.djangoproject.com/fundraising/ license: BSD-3-Clause keywords: platform: None classifiers: ['Development Status :: 5 - Production/Stable', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Topic :: Internet :: WWW/HTTP', 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', 'Topic :: Internet :: WWW/HTTP :: WSGI', 'Topic :: Software Development :: Libraries :: Application Frameworks', 'Topic :: Software Development :: Libraries :: Python Modules'] requires: [] requires_dist: ['asgiref (<4,>=3.5.2)', 'sqlparse (>=0.2.2)', 'backports.zoneinfo ; python_version < "3.9"', 'tzdata ; sys_platform == "win32"', "argon2-cffi (>=19.1.0) ; extra == 'argon2'", "bcrypt ; extra == 'bcrypt'"] provides: [] provides_dist: [] obsoletes: [] obsoletes_dist: [] requires_python: >=3.8 requires_external: [] _pypi_ordering: 312 downloads: {'last_day': -1, 'last_week': -1, 'last_month': -1} cheesecake_code_kwalitee_id: None cheesecake_documentation_id: None cheesecake_installability_id: None

yolkのヘルプ

その他のオプションについてはyolkのヘルプを参照

> yolk -h
usage: yolk [-h] [--version] [--debug] [-q] [-l] [-a] [-n] [-m] [-f FIELDS] [-d PKG_SPEC] [--entry-points MODULE]
            [--entry-map PACKAGE_NAME] [-C HOURS] [-D PKG_SPEC] [-F PKG_SPEC] [-H PKG_SPEC] [-I PYPI_INDEX] [-L HOURS]
            [-M PKG_SPEC] [-S SEARCH_SPEC <AND/OR SEARCH_SPEC>] [-T FILE_TYPE] [-U] [--upgrade] [--user] [-V PKG_SPEC]
            [pkg_spec]

positional arguments:
  pkg_spec

options:
  -h, --help            show this help message and exit
  --version             show yolk version and exit
  --debug               show debugging information
  -q, --quiet           show less output

Query installed Python packages:
  The following options show information about installed Python packages. Activated packages are normal packages on
  sys.path that can be imported. Non-activated packages need 'pkg_resources.require()' before they can be imported,
  such as packages installed with 'easy_install --multi-version'. PKG_SPEC can be either a package name or package
  name and version e.g. Paste==0.9

  -l, --list            list all Python packages installed by distutils or setuptools. Use PKG_SPEC to narrow results
  -a, --activated       list activated packages installed by distutils or setuptools. Use PKG_SPEC to narrow results
  -n, --non-activated   list non-activated packages installed by distutils or setuptools. Use PKG_SPEC to narrow
                        results
  -m, --metadata        show all metadata for packages installed by setuptools (use with -l -a or -n)
  -f FIELDS, --fields FIELDS
                        show specific metadata (comma-separated) fields; use with -m or -M
  -d PKG_SPEC, --depends PKG_SPEC
                        show dependencies for a package installed by setuptools if they are available
  --entry-points MODULE
                        list entry points for a module. e.g. --entry-points nose.plugins
  --entry-map PACKAGE_NAME
                        list entry map for a package. e.g. --entry-map yolk

PyPI (Cheese Shop) options:
  The following options query the Python Package Index:

  -C HOURS, --changelog HOURS
                        show detailed ChangeLog for PyPI for last n hours
  -D PKG_SPEC, --download-links PKG_SPEC
                        show download URL's for package listed on PyPI. Use with -T to specify egg, source etc
  -F PKG_SPEC, --fetch-package PKG_SPEC
                        download package source or egg; You can specify a file type with -T
  -H PKG_SPEC, --browse-homepage PKG_SPEC
                        launch web browser at home page for package
  -I PYPI_INDEX, --pypi-index PYPI_INDEX
                        specify PyPI mirror for package index
  -L HOURS, --latest-releases HOURS
                        show PyPI releases for last n hours
  -M PKG_SPEC, --query-metadata PKG_SPEC
                        show metadata for a package listed on PyPI. Use -f to show particular fields
  -S SEARCH_SPEC <AND/OR SEARCH_SPEC>
                        search PyPI by spec and optional AND/OR operator
  -T FILE_TYPE, --file-type FILE_TYPE
                        You may specify 'source', 'egg', 'svn' or 'all' when using -D.
  -U, --show-updates    check PyPI for updates on package(s)
  --upgrade, --pip      run pip command to upgrade outdated packages; may be used with --user
  --user                run pip with --user; for use with --upgrade
  -V PKG_SPEC, --versions-available PKG_SPEC
                        show available versions for given package listed on PyPI

コメント

タイトルとURLをコピーしました