Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2022.11.21: pep517 build do not isntall nox/tox_to_nox.jinja2 #671

Closed
kloczek opened this issue Nov 23, 2022 · 5 comments · Fixed by #659
Closed

2022.11.21: pep517 build do not isntall nox/tox_to_nox.jinja2 #671

kloczek opened this issue Nov 23, 2022 · 5 comments · Fixed by #659
Labels

Comments

@kloczek
Copy link

kloczek commented Nov 23, 2022

Current Behavior

Looks like pep517 based build do not adds nox/tox_to_nox.jinja2 to generated .whl archive,

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:108: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  warnings.warn(msg, _BetaConfiguration)
running egg_info
creating nox.egg-info
writing nox.egg-info/PKG-INFO
writing dependency_links to nox.egg-info/dependency_links.txt
writing entry points to nox.egg-info/entry_points.txt
writing requirements to nox.egg-info/requires.txt
writing top-level names to nox.egg-info/top_level.txt
writing manifest file 'nox.egg-info/SOURCES.txt'
reading manifest file 'nox.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'nox.egg-info/SOURCES.txt'
* Building wheel...
/usr/lib/python3.8/site-packages/setuptools/config/pyprojecttoml.py:108: _BetaConfiguration: Support for `[tool.setuptools]` in `pyproject.toml` is still *beta*.
  warnings.warn(msg, _BetaConfiguration)
running bdist_wheel
running build
running build_py
creating build
creating build/lib
creating build/lib/nox
copying nox/__init__.py -> build/lib/nox
copying nox/__main__.py -> build/lib/nox
copying nox/_decorators.py -> build/lib/nox
copying nox/_option_set.py -> build/lib/nox
copying nox/_options.py -> build/lib/nox
copying nox/_parametrize.py -> build/lib/nox
copying nox/_typing.py -> build/lib/nox
copying nox/_version.py -> build/lib/nox
copying nox/command.py -> build/lib/nox
copying nox/logger.py -> build/lib/nox
copying nox/manifest.py -> build/lib/nox
copying nox/popen.py -> build/lib/nox
copying nox/registry.py -> build/lib/nox
copying nox/sessions.py -> build/lib/nox
copying nox/tasks.py -> build/lib/nox
copying nox/tox_to_nox.py -> build/lib/nox
copying nox/virtualenv.py -> build/lib/nox
copying nox/workflow.py -> build/lib/nox
running egg_info
writing nox.egg-info/PKG-INFO
writing dependency_links to nox.egg-info/dependency_links.txt
writing entry points to nox.egg-info/entry_points.txt
writing requirements to nox.egg-info/requires.txt
writing top-level names to nox.egg-info/top_level.txt
reading manifest file 'nox.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'nox.egg-info/SOURCES.txt'
copying nox/py.typed -> build/lib/nox
installing to build/bdist.linux-x86_64/wheel
running install
running install_lib
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/wheel
creating build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/__init__.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/__main__.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/_decorators.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/_option_set.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/_options.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/_parametrize.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/_typing.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/_version.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/command.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/logger.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/manifest.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/popen.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/registry.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/sessions.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/tasks.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/tox_to_nox.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/virtualenv.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/workflow.py -> build/bdist.linux-x86_64/wheel/nox
copying build/lib/nox/py.typed -> build/bdist.linux-x86_64/wheel/nox
running install_egg_info
Copying nox.egg-info to build/bdist.linux-x86_64/wheel/nox-2022.11.21-py3.8.egg-info
running install_scripts
creating build/bdist.linux-x86_64/wheel/nox-2022.11.21.dist-info/WHEEL
creating '/home/tkloczko/rpmbuild/BUILD/nox-2022.11.21/dist/tmpyh5nlv5c/nox-2022.11.21-py3-none-any.whl' and adding 'build/bdist.linux-x86_64/wheel' to it
adding 'nox/__init__.py'
adding 'nox/__main__.py'
adding 'nox/_decorators.py'
adding 'nox/_option_set.py'
adding 'nox/_options.py'
adding 'nox/_parametrize.py'
adding 'nox/_typing.py'
adding 'nox/_version.py'
adding 'nox/command.py'
adding 'nox/logger.py'
adding 'nox/manifest.py'
adding 'nox/popen.py'
adding 'nox/py.typed'
adding 'nox/registry.py'
adding 'nox/sessions.py'
adding 'nox/tasks.py'
adding 'nox/tox_to_nox.py'
adding 'nox/virtualenv.py'
adding 'nox/workflow.py'
adding 'nox-2022.11.21.dist-info/LICENSE'
adding 'nox-2022.11.21.dist-info/METADATA'
adding 'nox-2022.11.21.dist-info/WHEEL'
adding 'nox-2022.11.21.dist-info/entry_points.txt'
adding 'nox-2022.11.21.dist-info/top_level.txt'
adding 'nox-2022.11.21.dist-info/RECORD'
removing build/bdist.linux-x86_64/wheel
Successfully built nox-2022.11.21-py3-none-any.whl

Because of that pytest is failing

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nox-2022.11.21, configfile: pyproject.toml, testpaths: tests
plugins: mock-3.10.0
collected 437 items / 1 error

================================================================================== ERRORS ==================================================================================
________________________________________________________________ ERROR collecting tests/test_tox_to_nox.py _________________________________________________________________
tests/test_tox_to_nox.py:22: in <module>
    from nox import tox_to_nox
../../BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib/python3.8/site-packages/nox/tox_to_nox.py:27: in <module>
    pkgutil.get_data(__name__, "tox_to_nox.jinja2").decode("utf-8"),  # type: ignore[union-attr]
/usr/lib64/python3.8/pkgutil.py:638: in get_data
    return loader.get_data(resource_name)
<frozen importlib._bootstrap_external>:1032: in get_data
    ???
E   FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib/python3.8/site-packages/nox/tox_to_nox.jinja2'
========================================================================= short test summary info ==========================================================================
ERROR tests/test_tox_to_nox.py - FileNotFoundError: [Errno 2] No such file or directory: '/home/tkloczko/rpmbuild/BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib/python3.8/site-packages/nox/tox_...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.74s =============================================================================

After add in install prpocedure manuall install that file pytest is OK

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-nox-2022.11.21-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.15, pytest-7.2.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/nox-2022.11.21, configfile: pyproject.toml, testpaths: tests
collected 447 items

tests/test__option_set.py .......                                                                                                                                    [  1%]
tests/test__parametrize.py ....................                                                                                                                      [  6%]
tests/test__version.py .............                                                                                                                                 [  8%]
tests/test_action_helper.py ....................                                                                                                                     [ 13%]
tests/test_command.py ...................s.s..........                                                                                                               [ 20%]
tests/test_logger.py ...X.                                                                                                                                           [ 21%]
tests/test_main.py .......................................................                                                                                           [ 34%]
tests/test_manifest.py .............................................                                                                                                 [ 44%]
tests/test_registry.py ...........                                                                                                                                   [ 46%]
tests/test_sessions.py ..........................................................................................................................                    [ 73%]
tests/test_tasks.py ............................................                                                                                                     [ 83%]
tests/test_tox_to_nox.py ..........                                                                                                                                  [ 85%]
tests/test_virtualenv.py ....ssss.ss..............s..................................                                                                                [ 99%]
tests/test_workflow.py ...                                                                                                                                           [100%]

========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_command.py:361: Only run this test on Windows.
SKIPPED [1] tests/test_command.py:383: Only run this test on Windows.
SKIPPED [1] tests/test_virtualenv.py:133: Missing conda command.
SKIPPED [1] tests/test_virtualenv.py:162: Missing conda command.
SKIPPED [1] tests/test_virtualenv.py:174: Missing conda command.
SKIPPED [1] tests/test_virtualenv.py:188: Missing conda command.
SKIPPED [1] tests/test_virtualenv.py:218: Missing conda command.
SKIPPED [1] tests/test_virtualenv.py:224: Missing conda command.
SKIPPED [1] tests/test_virtualenv.py:482: Requires Python 2.7 installation.
XPASS tests/test_logger.py::test_no_color_timestamp[color]
================================================================ 437 passed, 9 skipped, 1 xpassed in 27.30s ================================================================

Expected Behavior

Looks like nox/tox_to_nox.jinja2 shopuld be part of the generated .whl archive.

Steps To Reproduce

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix>
  • run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>

Environment

- OS: Linux x86/64
- Python: 3.8.15
- Nox: 2022.11.21

Anything else?

No response

@kloczek kloczek added the bug label Nov 23, 2022
@FollowTheProcess
Copy link
Collaborator

I think this is because we don't explicitly mention it here: https://github.com/wntrblm/nox/blob/6957a4c1bf4f8f403fc30664812cbb19eb0b2417/pyproject.toml#LL70

I've just added:

- package-data = { "nox" = [ "py.typed" ] }
+ package-data = { "nox" = [ "py.typed", "tox_to_nox.jinja2" ] }

And I can now see the .jinja2 file appearing when running build:

image

@FollowTheProcess
Copy link
Collaborator

FollowTheProcess commented Nov 23, 2022

FYI: This would also be fixed by #659 as hatch includes the jinja2 file by default and would be my recommendation:

image

@henryiii have you got time to get #659 ready to go? AFAICT all it needs is a tiny format tweak in pyproject.toml

@henryiii
Copy link
Collaborator

Sure, done.

@FollowTheProcess FollowTheProcess linked a pull request Nov 23, 2022 that will close this issue
@kloczek
Copy link
Author

kloczek commented Nov 23, 2022

Thx 👍

@alex
Copy link

alex commented Mar 26, 2023

Any chance of a release with this fix? ATM pip install nox[tox_to_nox] and then tox-to-nox produces a FileNotFoundError: [Errno 2] No such file or directory: '/Users/alex_gaynor/projects/cryptography/.venv/lib/python3.10/site-packages/nox/tox_to_nox.jinja2'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

4 participants