pythonfinder


Namepythonfinder JSON
Version 2.1.0 PyPI version JSON
download
home_page
SummaryA cross-platform python discovery tool to help locate python on any system.
upload_time2024-01-28 14:36:53
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords pythonfinder path finder pathfinder which pep514 pyenv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PythonFinder: Cross Platform Search Tool for Finding Pythons
=============================================================

.. image:: https://img.shields.io/pypi/v/pythonfinder.svg
    :target: https://pypi.org/project/pythonfinder

.. image:: https://img.shields.io/pypi/l/pythonfinder.svg
    :target: https://pypi.org/project/pythonfinder

.. image:: https://img.shields.io/pypi/pyversions/pythonfinder.svg
    :target: https://pypi.org/project/pythonfinder

.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
    :target: https://saythanks.io/to/techalchemy

.. image:: https://readthedocs.org/projects/pythonfinder/badge/?version=master
    :target: http://pythonfinder.readthedocs.io/en/master/?badge=master
    :alt: Documentation Status

Installation
*************

Install from `PyPI`_:

.. code-block:: console

    $ pipenv install pythonfinder

Install from `Github`_:

.. code-block:: console

    $ pipenv install -e git+https://github.com/sarugaku/pythonfinder.git#egg=pythonfinder


.. _PyPI: https://www.pypi.org/project/pythonfinder
.. _Github: https://github.com/sarugaku/pythonfinder


.. _`Usage`:

Usage
******

Using PythonFinder is easy.  Simply import it and ask for a python:

.. code-block:: pycon

    >>> from pythonfinder import Finder
    >>> f = Finder()
    >>> f.find_python_version(3, minor=6)
    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=False, only_python=False, py_version=PythonVersion(major=3, minor=6, patch=5, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('3.6.5')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)
    >>> f.find_python_version(2)
    PathEntry(path=PosixPath('/home/hawk/.pyenv/shims/python2'), ...py_version=PythonVersion(major=2, minor=7, patch=15, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('2.7.15')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/shims/python2'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)
    >>> f.find_python_version("anaconda3-5.3.0")

Find a named distribution, such as ``anaconda3-5.3.0``:

.. code-block:: pycon

    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/anaconda3-5.3.0/bin/python3.7m'), _children={'/home/hawk/.pyenv/versions/anaconda3-5.3.0/bin/python3.7m': ...}, only_python=False, name='anaconda3-5.3.0', _py_version=PythonVersion(major=3, minor=7, patch=0, is_prerelease=False, is_postrelease=False, is_devrelease=False,...))

PythonFinder can even find beta releases:

.. code-block:: pycon

    >>> f.find_python_version(3, minor=7)
    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.7.0b1/bin/python'), _children={}, is_root=False, only_python=False, py_version=PythonVersion(major=3, minor=7, patch=0, is_prerelease=True, is_postrelease=False, is_devrelease=False, version=<Version('3.7.0b1')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.7.0b1/bin/python'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)

    >>> f.which('python')
    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=False, only_python=False, py_version=PythonVersion(major=3, minor=6, patch=5, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('3.6.5')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)


Windows Support
****************

PythonFinder natively supports windows via both the *PATH* environment variable and `PEP-514 <https://www.python.org/dev/peps/pep-0514/>`_ compliant finder which comes by default with python 3. Usage on windows becomes:

.. code-block:: pycon

    >>> from pythonfinder import Finder
    >>> f = Finder()
    >>> f.find_python_version(3, minor=6)
    PythonVersion(major=3, minor=6, patch=4, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('3.6.4')>, architecture='64bit', comes_from=PathEntry(path=WindowsPath('C:/Program Files/Python36/python.exe'), _children={}, is_root=False, only_python=True, py_version=None, pythons=None), executable=WindowsPath('C:/Program Files/Python36/python.exe'))

    >>> f.find_python_version(3, minor=7, pre=True)
    PythonVersion(major=3, minor=7, patch=0, is_prerelease=True, is_postrelease=False, is_devrelease=False, version=<Version('3.7.0b5')>, architecture='64bit', comes_from=PathEntry(path=WindowsPath('C:/Program Files/Python37/python.exe'), _children={}, is_root=False, only_python=True, py_version=None, pythons=None), executable=WindowsPath('C:/Program Files/Python37/python.exe'))

    >>> f.which('python')
    PathEntry(path=WindowsPath('C:/Python27/python.exe'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)

Finding Executables
///////////////////

PythonFinder also provides **which** functionality across platforms, and it uses lazy loading and fast-returns to be performant at this task.

.. code-block:: pycon

    >>> f.which('cmd')
    PathEntry(path=WindowsPath('C:/windows/system32/cmd.exe'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)

    >>> f.which('code')
    PathEntry(path=WindowsPath('C:/Program Files/Microsoft VS Code/bin/code'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)

     >>> f.which('vim')
    PathEntry(path=PosixPath('/usr/bin/vim'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)

    >>> f.which('inv')
    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/inv'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)


Architecture support
////////////////////

PythonFinder supports architecture specific lookups on all platforms:

.. code-block:: pycon

    >>> f.find_python_version(3, minor=6, arch="64")
    PathEntry(path=PosixPath('/usr/bin/python3'), _children={'/usr/bin/python3': ...}, only_python=False, name='python3', _py_version=PythonVersion(major=3, minor=6, patch=7, is_prerelease=False, is_postrelease=False, is_devrelease=False, is_debug=False, version=<Version('3.6.7')>, architecture='64bit', comes_from=..., executable='/usr/bin/python3', name='python3'), _pythons=defaultdict(None, {}), is_root=False)


Integrations
*************

* `Pyenv <https://github.com/pyenv/pyenv>`_
* `ASDF <https://github.com/asdf-vm/asdf>`_
* `PEP-514 <https://www.python.org/dev/peps/pep-0514/>`_
* `Virtualenv <https://github.com/pypa/virtualenv>`_
* `Pipenv <https://pipenv.org>`_

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pythonfinder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "pythonfinder,path,finder,pathfinder,which,pep514,pyenv",
    "author": "",
    "author_email": "Dan Ryan <dan@danryan.co>",
    "download_url": "https://files.pythonhosted.org/packages/15/74/b9764e9655f47860dd87505d9bc561b462cb900662516e1a33b04efdc070/pythonfinder-2.1.0.tar.gz",
    "platform": null,
    "description": "PythonFinder: Cross Platform Search Tool for Finding Pythons\n=============================================================\n\n.. image:: https://img.shields.io/pypi/v/pythonfinder.svg\n    :target: https://pypi.org/project/pythonfinder\n\n.. image:: https://img.shields.io/pypi/l/pythonfinder.svg\n    :target: https://pypi.org/project/pythonfinder\n\n.. image:: https://img.shields.io/pypi/pyversions/pythonfinder.svg\n    :target: https://pypi.org/project/pythonfinder\n\n.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg\n    :target: https://saythanks.io/to/techalchemy\n\n.. image:: https://readthedocs.org/projects/pythonfinder/badge/?version=master\n    :target: http://pythonfinder.readthedocs.io/en/master/?badge=master\n    :alt: Documentation Status\n\nInstallation\n*************\n\nInstall from `PyPI`_:\n\n.. code-block:: console\n\n    $ pipenv install pythonfinder\n\nInstall from `Github`_:\n\n.. code-block:: console\n\n    $ pipenv install -e git+https://github.com/sarugaku/pythonfinder.git#egg=pythonfinder\n\n\n.. _PyPI: https://www.pypi.org/project/pythonfinder\n.. _Github: https://github.com/sarugaku/pythonfinder\n\n\n.. _`Usage`:\n\nUsage\n******\n\nUsing PythonFinder is easy.  Simply import it and ask for a python:\n\n.. code-block:: pycon\n\n    >>> from pythonfinder import Finder\n    >>> f = Finder()\n    >>> f.find_python_version(3, minor=6)\n    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=False, only_python=False, py_version=PythonVersion(major=3, minor=6, patch=5, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('3.6.5')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)\n    >>> f.find_python_version(2)\n    PathEntry(path=PosixPath('/home/hawk/.pyenv/shims/python2'), ...py_version=PythonVersion(major=2, minor=7, patch=15, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('2.7.15')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/shims/python2'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)\n    >>> f.find_python_version(\"anaconda3-5.3.0\")\n\nFind a named distribution, such as ``anaconda3-5.3.0``:\n\n.. code-block:: pycon\n\n    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/anaconda3-5.3.0/bin/python3.7m'), _children={'/home/hawk/.pyenv/versions/anaconda3-5.3.0/bin/python3.7m': ...}, only_python=False, name='anaconda3-5.3.0', _py_version=PythonVersion(major=3, minor=7, patch=0, is_prerelease=False, is_postrelease=False, is_devrelease=False,...))\n\nPythonFinder can even find beta releases:\n\n.. code-block:: pycon\n\n    >>> f.find_python_version(3, minor=7)\n    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.7.0b1/bin/python'), _children={}, is_root=False, only_python=False, py_version=PythonVersion(major=3, minor=7, patch=0, is_prerelease=True, is_postrelease=False, is_devrelease=False, version=<Version('3.7.0b1')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.7.0b1/bin/python'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)\n\n    >>> f.which('python')\n    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=False, only_python=False, py_version=PythonVersion(major=3, minor=6, patch=5, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('3.6.5')>, architecture='64bit', comes_from=PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/python'), _children={}, is_root=True, only_python=False, py_version=None, pythons=None), executable=None), pythons=None)\n\n\nWindows Support\n****************\n\nPythonFinder natively supports windows via both the *PATH* environment variable and `PEP-514 <https://www.python.org/dev/peps/pep-0514/>`_ compliant finder which comes by default with python 3. Usage on windows becomes:\n\n.. code-block:: pycon\n\n    >>> from pythonfinder import Finder\n    >>> f = Finder()\n    >>> f.find_python_version(3, minor=6)\n    PythonVersion(major=3, minor=6, patch=4, is_prerelease=False, is_postrelease=False, is_devrelease=False, version=<Version('3.6.4')>, architecture='64bit', comes_from=PathEntry(path=WindowsPath('C:/Program Files/Python36/python.exe'), _children={}, is_root=False, only_python=True, py_version=None, pythons=None), executable=WindowsPath('C:/Program Files/Python36/python.exe'))\n\n    >>> f.find_python_version(3, minor=7, pre=True)\n    PythonVersion(major=3, minor=7, patch=0, is_prerelease=True, is_postrelease=False, is_devrelease=False, version=<Version('3.7.0b5')>, architecture='64bit', comes_from=PathEntry(path=WindowsPath('C:/Program Files/Python37/python.exe'), _children={}, is_root=False, only_python=True, py_version=None, pythons=None), executable=WindowsPath('C:/Program Files/Python37/python.exe'))\n\n    >>> f.which('python')\n    PathEntry(path=WindowsPath('C:/Python27/python.exe'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)\n\nFinding Executables\n///////////////////\n\nPythonFinder also provides **which** functionality across platforms, and it uses lazy loading and fast-returns to be performant at this task.\n\n.. code-block:: pycon\n\n    >>> f.which('cmd')\n    PathEntry(path=WindowsPath('C:/windows/system32/cmd.exe'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)\n\n    >>> f.which('code')\n    PathEntry(path=WindowsPath('C:/Program Files/Microsoft VS Code/bin/code'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)\n\n     >>> f.which('vim')\n    PathEntry(path=PosixPath('/usr/bin/vim'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)\n\n    >>> f.which('inv')\n    PathEntry(path=PosixPath('/home/hawk/.pyenv/versions/3.6.5/bin/inv'), _children={}, is_root=False, only_python=False, py_version=None, pythons=None)\n\n\nArchitecture support\n////////////////////\n\nPythonFinder supports architecture specific lookups on all platforms:\n\n.. code-block:: pycon\n\n    >>> f.find_python_version(3, minor=6, arch=\"64\")\n    PathEntry(path=PosixPath('/usr/bin/python3'), _children={'/usr/bin/python3': ...}, only_python=False, name='python3', _py_version=PythonVersion(major=3, minor=6, patch=7, is_prerelease=False, is_postrelease=False, is_devrelease=False, is_debug=False, version=<Version('3.6.7')>, architecture='64bit', comes_from=..., executable='/usr/bin/python3', name='python3'), _pythons=defaultdict(None, {}), is_root=False)\n\n\nIntegrations\n*************\n\n* `Pyenv <https://github.com/pyenv/pyenv>`_\n* `ASDF <https://github.com/asdf-vm/asdf>`_\n* `PEP-514 <https://www.python.org/dev/peps/pep-0514/>`_\n* `Virtualenv <https://github.com/pypa/virtualenv>`_\n* `Pipenv <https://pipenv.org>`_\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A cross-platform python discovery tool to help locate python on any system.",
    "version": "2.1.0",
    "project_urls": {
        "Homepage": "https://github.com/sarugaku/pythonfinder"
    },
    "split_keywords": [
        "pythonfinder",
        "path",
        "finder",
        "pathfinder",
        "which",
        "pep514",
        "pyenv"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cdfb143592b8922965f99b5cb1b43726719446405ad03104f1cfbb8c85e0d647",
                "md5": "0426fb93be2eaf02f7ba4bc3254c86b5",
                "sha256": "aea197c2a596cd84fc0650d33f3ae74ebaf3aa2f255dffbb5020f37d2f5b1731"
            },
            "downloads": -1,
            "filename": "pythonfinder-2.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0426fb93be2eaf02f7ba4bc3254c86b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 26932,
            "upload_time": "2024-01-28T14:36:51",
            "upload_time_iso_8601": "2024-01-28T14:36:51.655513Z",
            "url": "https://files.pythonhosted.org/packages/cd/fb/143592b8922965f99b5cb1b43726719446405ad03104f1cfbb8c85e0d647/pythonfinder-2.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1574b9764e9655f47860dd87505d9bc561b462cb900662516e1a33b04efdc070",
                "md5": "bb157e732ceebc249e5600656ac4b497",
                "sha256": "bdd5352d8367ebd2c106988861e2583d412ab897aa81b783825ab5d6fd351c56"
            },
            "downloads": -1,
            "filename": "pythonfinder-2.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bb157e732ceebc249e5600656ac4b497",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 717240,
            "upload_time": "2024-01-28T14:36:53",
            "upload_time_iso_8601": "2024-01-28T14:36:53.205944Z",
            "url": "https://files.pythonhosted.org/packages/15/74/b9764e9655f47860dd87505d9bc561b462cb900662516e1a33b04efdc070/pythonfinder-2.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-28 14:36:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sarugaku",
    "github_project": "pythonfinder",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pythonfinder"
}
        
Elapsed time: 0.17993s