pydata / pydata-sphinx-theme

A clean, three-column Sphinx theme with Bootstrap for the PyData community
https://pydata-sphinx-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
617 stars 320 forks source link

figure out how to control node version in CIs #998

Open drammock opened 2 years ago

drammock commented 2 years ago

EDIT the original question below is now moot and hidden behind details. This issue has been converted to focus on @jarrodmillman's question in the first comment

I have system-level nodejs 10.x, and 16.x installed into my mamba env. When I try to make a commit, I git this error from pre-commit: ```console (pst) [/o/pydata-sphinx-theme] $ git commit -m 'update version string' [INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier. [INFO] Initializing environment for https://github.com/pre-commit/mirrors-prettier:prettier@2.7.1. [INFO] Initializing environment for https://github.com/psf/black. [INFO] Initializing environment for https://gitlab.com/pycqa/flake8. [INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks. [INFO] Initializing environment for https://github.com/asottile/pyupgrade. [INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier. [INFO] Once installed this environment will be reused. [INFO] This may take a few minutes... An unexpected error has occurred: CalledProcessError: command: ('/home/drmccloy/.cache/pre-commit/repoy7s0rbuo/node_env-system/bin/node', '/opt/node_global/bin/npm', 'install', '--dev', '--prod', '--ignore-prepublish', '--no-progress', '--no-save') return code: 1 expected return code: 0 stdout: (none) stderr: ERROR: npm is known not to run on Node.js v10.19.0 You'll need to upgrade to a newer Node.js version in order to use this version of npm. You can find the latest version at https://nodejs.org/ Check the log at /home/drmccloy/.cache/pre-commit/pre-commit.log (pst) [/o/pydata-sphinx-theme] $ which node /opt/miniforge3/envs/pst/bin/node (pst) [/o/pydata-sphinx-theme] $ node --version v16.17.1 ``` clearing out the contents `~/.cache/precommit/` did not fix this. Anyone know what I'm doing wrong?
jarrodmillman commented 2 years ago

I am not sure how node works and need to spend some time looking into it. Since you already asked a question about node, I am going to add another question (maybe it is related?).

I noticed that node-version = "16.13.2" is set in pyproject.toml. I wanted to update that to "16.17.1" and I wanted to check what version of node is being used in our CI. In the tests run on https://github.com/pydata/pydata-sphinx-theme/pull/996/commits/739fe00cbbb70169202e341b9768cfb25cde2e52, it says it is using "16.17.1" (see https://github.com/pydata/pydata-sphinx-theme/actions/runs/3206578864/jobs/5240503666). Then I noticed that it also says it is using "16.17.1" (see https://github.com/pydata/pydata-sphinx-theme/actions/runs/3206598156/jobs/5240545764) when node-version = "16.13.2" is set in pyproject.toml (see https://github.com/pydata/pydata-sphinx-theme/pull/996/commits/5667f6bb444f3baea6f7a3d8bc00d79741e7ab50).

Am I checking in the right place? Does setting node-version in pyproject.toml do anything?

drammock commented 2 years ago

after sleeping on it, I developed the suspicion that pre-commit was starting subshells and that's why it was using the wrong node... but that doesn't make sense because $PATH is a global env variable. then I simply tried again, and didn't get the error 🤷🏻

I'll leave this open though, and change the title to reflect the question @jarrodmillman just raised.

choldgraf commented 1 year ago

Here's how [the Sphinx Theme Builder](https://sphinx-theme-builder.readthedocs.io/en/latest/build-process/#nodeenv-validation describes the node environment management).

I suggest that we move this from the v0.13 milestone, I don't think it's crucial for the next release.

12rambau commented 1 year ago

I think we should remove it from any milestone, it's there for 3 releases and it's not bothering that much. I hope a solution will be found eventually