sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Contributor documentation and nox set-up instructions incomplete

Open arwedus opened this issue 1 year ago • 7 comments

Hello!

I've tried to run sphinx-needs nox test locally for testing sphinx-needs with python 3.8 on an Ubuntu 22.04 system. I have followed the contributing.rst file but got stuck.

These are the steps I have performed:

  1. install pipx (sudo apt install pipx)

  2. install poetry via pipx (cd sphinx-needs && pipx install poetry)

  3. install nox and nox-poetry via pipx (pipx install nox && pipx inject nox nox-poetry)

  4. install pyenv (curl https://pyenv.run | bash)

  5. add pyenv to my .bashrc (pyenv prints the instructions after "install")

  6. restart bash shell

  7. Install pyenv install 3.8-> failure

  8. Run on ubuntu:

    sudo apt update;
    sudo apt install build-essential libssl-dev zlib1g-dev \
       libbz2-dev libreadline-dev libsqlite3-dev curl \
       libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
    
  9. Retry step 7 -> now it works (pyenv versions shows system, which is 3.10, and 3.8.18)

  10. restart bash shell

  11. try nox -s 3.8. Gives error:

nox > Command /home/str2lr/.local/pipx/venvs/nox/bin/python -m virtualenv /home/str2lr/projects/public/sphinx-needs/.nox/tests-3-8-sphinx-5-0 -p python3.8 failed with exit code 1:
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.8'

I think it somehow is related to nox not being installed in the "global" python environment, but I won't to that. I have to avoid that nox, poetry etc. with all their dependencies pollute my global or user python environment (it's also what the contributing.rst says -> "use a python environment". It does not explicitly mention which, though... so I thought the choice would be open).

Is nox actually tested? I see that the github actions pipeline doesn't use it.

arwedus avatar Mar 07 '24 14:03 arwedus

Heya, From my side, I use nox via pipx, and have no problem:

$ pipx list
...
   package nox 2023.4.22, installed using Python 3.11.6
    - nox
    - tox-to-nox
$ nox -e "tests-3.10(sphinx='7.0')" -- tests/ -x
nox > Running session tests-3.10(sphinx='7.0')
...

I don't use pyenv though, jus a global installed python3.10 (technically Im in a base conda environment)

$ which python3.10
/Users/chrisjsewell/mambaforge/bin/python3.10

You might have to look for "generic" nox+pyenv help, like here: https://stackoverflow.com/questions/71454022/nox-does-not-find-my-pyenv-versions-in-my-python-poetry-project

chrisjsewell avatar Mar 07 '24 14:03 chrisjsewell

@chrisjsewell: That doesn't look like a matrix test with different python versions. What I'm trying to achieve is running the tests for python 3.8 and 3.10. I don't think that this is possible without having two python versions installed. And since I have a managed machine and can't simply install python 3.8 globally, I've tried pyenv as suggested by the nox documentation.

How do you test with different python versions locally?

arwedus avatar Mar 07 '24 14:03 arwedus

You might have to look for "generic" nox+pyenv help, like here: https://stackoverflow.com/questions/71454022/nox-does-not-find-my-pyenv-versions-in-my-python-poetry-project

Ah! pyenv local 3.8 system did the trick! Mind if I add this short step-by-step instructions to your contributing.rst?

arwedus avatar Mar 07 '24 14:03 arwedus

How do you test with different python versions locally?

Honestly, I don't 😅, I just test test against one and let the CI handle the rest. I've never had a problem (and you've seen the amount of PRs I've merged 😄 )

(Obviously I didn't set up this project originally, but in basically all my other projects, I actually steer clear of poetry and nox, and use flit and tox + tox-conda (which does everything through conda environments, and works for multiple python versions)

chrisjsewell avatar Mar 07 '24 14:03 chrisjsewell

Ah! pyenv local 3.8 system did the trick! Mind if I add this short step-by-step instructions to your contributing.rst?

Yeh no worries, I guess just add it as a tip for pyenv users

chrisjsewell avatar Mar 07 '24 14:03 chrisjsewell

How do you test with different python versions locally?

Honestly, I don't 😅, I just test test against one and let the CI handle the rest. I've never had a problem (and you've seen the amount of PRs I've merged 😄 )

(Obviously I didn't set up this project originally, but in basically all my other projects, I actually steer clear of poetry and nox, and use flit and tox + tox-conda (which does everything through conda environments, and works for multiple python versions)

Ah, the beauty of the Python ecosystem. Reminds me of: https://www.youtube.com/watch?v=BgxklT94W0I&t=20s :D

arwedus avatar Mar 07 '24 15:03 arwedus

Love that guy

Maybe one day we'll get one-to-rule-them-all 😂

chrisjsewell avatar Mar 07 '24 15:03 chrisjsewell