cjolowicz / cookiecutter-hypermodern-python

Hypermodern Python Cookiecutter
http://cookiecutter-hypermodern-python.readthedocs.io/
MIT License
1.81k stars 235 forks source link

Default Github Actions test workflow fails when running Nox #1045

Closed dtch1997 closed 2 years ago

dtch1997 commented 2 years ago

When running the tests.yml workflow in Github Actions, I get the following error:

This is for ubuntu-latest with python 3.8.

Run nox --force-color --python=3.8
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.12/x64/bin/nox", line 8, in <module>
    sys.exit(main())
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox/__main__.py", line 49, in main
    exit_code = workflow.execute(
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox/workflow.py", line 49, in execute
    return_value = function_(*args, global_config=global_config)
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox/tasks.py", line 59, in load_nox_module
    return importlib.machinery.SourceFileLoader(
  File "<frozen importlib._bootstrap_external>", line 522, in _check_name_wrapper
  File "<frozen importlib._bootstrap_external>", line 1022, in load_module
  File "<frozen importlib._bootstrap_external>", line 847, in load_module
  File "<frozen importlib._bootstrap>", line 265, in _load_module_shim
  File "<frozen importlib._bootstrap>", line 702, in _load
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/runner/work/mlops/mlops/noxfile.py", line 10, in <module>
    from nox_poetry import Session
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox_poetry/__init__.py", line 29, in <module>
    from nox_poetry.core import build_package
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox_poetry/core.py", line 15, in <module>
    from nox_poetry.sessions import Session
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox_poetry/sessions.py", line 93, in <module>
    class _PoetrySession:
  File "/opt/hostedtoolcache/Python/3.8.12/x64/lib/python3.8/site-packages/nox_poetry/sessions.py", line 96, in _PoetrySession
    def __init__(self, session: nox.Session) -> None:
AttributeError: module 'nox' has no attribute 'Session'
cjolowicz commented 2 years ago

Thanks for the report. Which version of Nox was installed in the workflow run? Take a look at the "Install Nox" step. It should match what's in your .github/workflows/constraints.txt. Old versions of Nox had the import of Session in nox.sessions instead of nox.

For me to reproduce this, a link to your repo and to the workflow run would be helpful. If that's not possible, a full log of the workflow run would be good.

cjolowicz commented 2 years ago

Closing for now, happy to reopen if this is still an issue.