sphinx-needs
sphinx-needs copied to clipboard
Contributor documentation and nox set-up instructions incomplete
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:
-
install pipx (
sudo apt install pipx) -
install poetry via pipx (
cd sphinx-needs && pipx install poetry) -
install nox and nox-poetry via pipx (
pipx install nox && pipx inject nox nox-poetry) -
install pyenv (
curl https://pyenv.run | bash) -
add pyenv to my .bashrc (pyenv prints the instructions after "install")
-
restart bash shell
-
Install
pyenv install 3.8-> failure -
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 -
Retry step 7 -> now it works (
pyenv versionsshows system, which is 3.10, and 3.8.18) -
restart bash shell
-
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.
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: 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?
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?
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! 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
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
Love that guy
Maybe one day we'll get one-to-rule-them-all 😂