Skip to content

Commit

Permalink
Ensure setuptools also installed for build
Browse files Browse the repository at this point in the history
- Document that the build process requires the dependencies be already
  installed and available for use.
  • Loading branch information
metatoaster committed Oct 28, 2023
1 parent bb903f8 commit 11bec99
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install coverage flake8 ply
# must install all dependencies so the tab modules can be generated
python -m pip install coverage flake8 ply setuptools
python -m pip install -e .
- name: Lint with flake8
run: |
Expand Down
58 changes: 42 additions & 16 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,20 @@ git like so:

.. code:: console
$ pip install ply # this MUST be done first; see below for reason
$ pip install ply setuptools # this MUST be done first; see below for reason
$ pip install -e git+https://github.com/calmjs/calmjs.parse.git#egg=calmjs.parse
Note that |ply| MUST be pre-installed for the ``setup.py build`` step to
run, otherwise the build step required to create the pre-generated
modules will result in the following failure condition, even when trying
to package this library:
Note that all dependencies MUST be pre-installed ``setup.py build`` step
to run, otherwise the build step required to create the pre-generated
modules will result in failure.

If |ply| isn't installed:

.. code:: console
$ python setup.py sdist --format=zip
running sdist
$ python -m pip install -e .
...
running egg_info
...
WARNING: cannot find distribution for 'ply'; using default value,
assuming 'ply==3.11' for pre-generated modules
Expand All @@ -130,9 +132,25 @@ to package this library:
before attempting to use the setup.py to build this package; please
refer to the top level README for further details
If ``setuptools`` isn't installed:

.. code:: console
$ python -m pip install -e .
...
running egg_info
...
Traceback (most recent call last):
...
File ".../calmjs.parse/src/calmjs/__init__.py", line 1, in <module>
__import__('pkg_resources').declare_namespace(__name__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'pkg_resources'
Naturally, the git repository can be cloned directly and execute
``python setup.py develop`` while inside the root of the source
directory; again, |ply| MUST already be available.
directory; again, both |ply| AND ``setuptools`` MUST already have be
available for import.

As the git repository does NOT contain any pre-generated modules or
code, the above message is likely to be seen by developers or distro
Expand Down Expand Up @@ -817,12 +835,20 @@ are regenerated every time that happens and this extra computational
overhead should be corrected through the generation of that optimization
module).

This optimization module is included with the wheel release and the
The optimization modules are included with the wheel release and the
source release on PyPI, but it is not part of the source repository as
generated code are never committed. Should a binary release made by
a third-party results in this warning upon import, their release should
be corrected to include the optimization module.

Moreover, there are safeguards in place that prevent this warning from
being generated for releases made for releases from 1.3.1 onwards by
a more heavy handed enforcement of this optimization step at build time,
but persistent (or careless) actors may circumvent this during the build
process, but official releases made through PyPI should include the
required optimization for all supported |ply| versions (which are
versions 3.6 to 3.11, inclusive).

Slow performance
~~~~~~~~~~~~~~~~

Expand All @@ -836,17 +862,17 @@ this will may require both the token and layout functions not having
arguments with name collisions, and the new function will take in all
of those arguments in one go.

ERROR message about `import ply` when trying to run setup.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ERROR message about import error when trying to install
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As noted in the full message, the |ply|_) package must be installed
before attempting to build the package through ``setup.py`` in the
As noted in the error message, the |ply|_ and ``setuptools`` package
must be installed before attempting to install build the package in the
situation where the pre-generated modules are missing. This situation
may be caused by building directly using the source provided by the
source code repository, or where there is no matching pre-generated
module matching with the installed version of |ply|. Please ensure
that |ply| is installed and available first before installing from
source if this error message is sighted.
module matching with the installed version of |ply|. Please ensure that
|ply| is installed and available first before installing from source if
this error message is sighted.


Contribute
Expand Down

0 comments on commit 11bec99

Please sign in to comment.