PEP 582: Updates to internal directory structure (#2750)
* Updates 582 with internal directory example Now we have working example in both Cpython & in PyPy. * Fixes Python version
This commit is contained in:
parent
be96146cae
commit
949dc03304
21
pep-0582.rst
21
pep-0582.rst
|
@ -10,7 +10,7 @@ Type: Standards Track
|
||||||
Topic: Packaging
|
Topic: Packaging
|
||||||
Content-Type: text/x-rst
|
Content-Type: text/x-rst
|
||||||
Created: 16-May-2018
|
Created: 16-May-2018
|
||||||
Python-Version: 3.8
|
Python-Version: 3.12
|
||||||
|
|
||||||
|
|
||||||
Abstract
|
Abstract
|
||||||
|
@ -89,14 +89,15 @@ the Python executable and any script will behave.
|
||||||
|
|
||||||
foo
|
foo
|
||||||
__pypackages__
|
__pypackages__
|
||||||
3.8
|
|
||||||
lib
|
lib
|
||||||
|
python3.10
|
||||||
|
site-packages
|
||||||
bottle
|
bottle
|
||||||
myscript.py
|
myscript.py
|
||||||
|
|
||||||
/> python foo/myscript.py
|
/> python foo/myscript.py
|
||||||
sys.path[0] == 'foo'
|
sys.path[0] == 'foo'
|
||||||
sys.path[1] == 'foo/__pypackages__/3.8/lib'
|
sys.path[1] == 'foo/__pypackages__/lib/python3.10/site-packages/'
|
||||||
|
|
||||||
|
|
||||||
cd foo
|
cd foo
|
||||||
|
@ -109,15 +110,17 @@ the Python executable and any script will behave.
|
||||||
|
|
||||||
foo> python
|
foo> python
|
||||||
sys.path[0] == '.'
|
sys.path[0] == '.'
|
||||||
sys.path[1] == './__pypackages__/3.8/lib'
|
sys.path[1] == './__pypackages__/lib/python3.10/site-packages'
|
||||||
|
|
||||||
foo> python -m bottle
|
foo> python -m bottle
|
||||||
|
|
||||||
We have a project directory called ``foo`` and it has a ``__pypackages__``
|
We have a project directory called ``foo`` and it has a ``__pypackages__``
|
||||||
inside of it. We have ``bottle`` installed in that
|
inside of it. We have ``bottle`` installed in that
|
||||||
``__pypackages__/3.8/lib``, and have a ``myscript.py`` file inside of the
|
``__pypackages__/lib/python3.10/stie-packages/``, and have a ``myscript.py``
|
||||||
project directory. We have used whatever tool we generally use to install ``bottle``
|
file inside of the project directory. We have used whatever tool we generally
|
||||||
in that location.
|
use to install ``bottle`` in that location. This actual internal path will
|
||||||
|
depend on the Python implementation name, as mentioned in the
|
||||||
|
``sysconfig._INSTALL_SCHEMES['posix_prefix']`` dictionary.
|
||||||
|
|
||||||
For invoking a script, Python will try to find a ``__pypackages__`` inside of
|
For invoking a script, Python will try to find a ``__pypackages__`` inside of
|
||||||
the directory that the script resides[1]_, ``/usr/bin``. The same will happen
|
the directory that the script resides[1]_, ``/usr/bin``. The same will happen
|
||||||
|
@ -180,8 +183,8 @@ adding it the ``sys.path`` just before site packages, if it is present.
|
||||||
Reference Implementation
|
Reference Implementation
|
||||||
========================
|
========================
|
||||||
|
|
||||||
`Here <https://github.com/kushaldas/cpython/tree/pypackages>`_ is a PoC
|
`Here <https://github.com/kushaldas/pep582>`_ is a small script which will
|
||||||
implementation (in the ``pypackages`` branch).
|
enable the implementation for ``Cpython`` & in ``PyPy``.
|
||||||
|
|
||||||
|
|
||||||
Rejected Ideas
|
Rejected Ideas
|
||||||
|
|
Loading…
Reference in New Issue