Skip to content

Commit

Permalink
rearrange README
Browse files Browse the repository at this point in the history
  • Loading branch information
wimglenn committed Aug 26, 2020
1 parent 9c4bc2e commit cdfb07b
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
This project shows how to package data files within a Python distribution, and has some example code for reading the data files.

To build this distribution, create a venv with setuptools, wheel, and pep517 installed, then execute the latter as a module:
This project shows how to package data files within a Python distribution, and has some example code for reading the data files. To build this distribution, create a venv with setuptools, wheel, and pep517 installed, then execute the latter as a module:

.. code-block:: bash
python -m pep517.build .
The distributions (an sdist .tar.gz and a bdist .whl) will be written to ./dist/ subdirectory.

To test it out, install the distribution and run the console script ``resources-example``.

For creating an executable zip, you can use stdlib `zipapp <https://docs.python.org/3/library/zipapp.html>`_ utility (Python 3.5+):

.. code-block:: bash
python3 -m zipapp --compress /path/to/resources-example --main="myapp:main" --output=myapp.zip
And now you can run the zip directly with the interpreter (any Python version):

.. code-block:: bash
python myapp.zip
The distributions (an sdist .tar.gz and a bdist .whl) will be written to ./dist/ subdirectory. To test it out, install the distribution and run the console script ``resources-example``.

Here's a compatibility summary of the five approaches shown:
Here's a compatibility summary of the five approaches demonstrated:

+-------------+---------------------+------------+---------------+---------------+-------------------+
| Module | Description | In stdlib? | Works on Py2? | Works on Py3? | Works in zipfile? |
Expand All @@ -37,3 +21,15 @@ Here's a compatibility summary of the five approaches shown:
+-------------+---------------------+------------+---------------+---------------+-------------------+
| example5.py | importlib_resources | no | yes | yes | yes |
+-------------+---------------------+------------+---------------+---------------+-------------------+

If you are interested in creating an executable zip from source, you can use stdlib `zipapp <https://docs.python.org/3/library/zipapp.html>`_ utility (Python 3.5+):

.. code-block:: bash
python3 -m zipapp --compress /path/to/resources-example --main="myapp:main" --output=myapp.zip
And now you can run the zip directly with the interpreter (any Python version):

.. code-block:: bash
python myapp.zip

0 comments on commit cdfb07b

Please sign in to comment.