| 1 | --- |
| 2 | hide-toc: true |
| 3 | --- |
| 4 | |
| 5 | # Welcome to installer's documentation |
| 6 | |
| 7 | ```{include} ../README.md |
| 8 | :start-after: <!-- start readme-pitch --> |
| 9 | :end-before: <!-- end readme-pitch --> |
| 10 | ``` |
| 11 | |
| 12 | ```{toctree} |
| 13 | :hidden: |
| 14 | |
| 15 | concepts |
| 16 | ``` |
| 17 | |
| 18 | ```{toctree} |
| 19 | :caption: API reference |
| 20 | :hidden: |
| 21 | :glob: |
| 22 | |
| 23 | api/* |
| 24 | ``` |
| 25 | |
| 26 | ```{toctree} |
| 27 | :caption: CLI reference |
| 28 | :hidden: |
| 29 | :glob: |
| 30 | |
| 31 | cli/* |
| 32 | ``` |
| 33 | |
| 34 | ```{toctree} |
| 35 | :caption: Project |
| 36 | :hidden: |
| 37 | |
| 38 | development/index |
| 39 | changelog |
| 40 | license |
| 41 | GitHub <https://github.com/pypa/installer> |
| 42 | PyPI <https://pypi.org/project/installer> |
| 43 | ``` |
| 44 | |
| 45 | ## Basic Usage |
| 46 | |
| 47 | ```python |
| 48 | import sys |
| 49 | import sysconfig |
| 50 | |
| 51 | from installer import install |
| 52 | from installer.destinations import SchemeDictionaryDestination |
| 53 | from installer.sources import WheelFile |
| 54 | |
| 55 | # Handler for installation directories and writing into them. |
| 56 | destination = SchemeDictionaryDestination( |
| 57 | sysconfig.get_paths(), |
| 58 | interpreter=sys.executable, |
| 59 | script_kind="posix", |
| 60 | ) |
| 61 | |
| 62 | with WheelFile.open("sampleproject-1.3.1-py2.py3-none-any.whl") as source: |
| 63 | install( |
| 64 | source=source, |
| 65 | destination=destination, |
| 66 | # Additional metadata that is generated by the installation tool. |
| 67 | additional_metadata={ |
| 68 | "INSTALLER": b"amazing-installer 0.1.0", |
| 69 | }, |
| 70 | ) |
| 71 | ``` |