Skip to content

Pre-commit hook is not configured to work with the venv created with instructions from CONTRIBUTING.md #3455

@caue-paiva

Description

@caue-paiva

In the CONTRIBUTING.md file, new contributers are instructed to create the following virtual environment:

python3 -m venv .venv/dev

This creates a venv named "dev" with the bin path
.venv/dev/bin

When you activate this environment and try to commit you get the following error:

✔ Backed up original state in git stash (54dc06a2)
⚠ Running tasks for staged files...
  ❯ .lintstagedrc.js — 1 file
    ❯ dash/*.py — 1 file
      ✖ Command failed: .venv/bin/python -m pylint '--rcfile=.pylintrc' 
        : new SubprocessError(`Command failed: ${command}`, {cause: error});
          ^

SubprocessError: Command failed: .venv/bin/python -m pylint '--rcfile=.pylintrc' 
  exitCode: undefined,
  signalName: undefined,
  stdout: '',
  stderr: '',
  output: '',
  command: ".venv/bin/python -m pylint '--rcfile=.pylintrc' 
  durationMs: 0.824125,
  [cause]: Error: spawn .venv/bin/python ENOENT
      at ChildProcess._handle.onexit (node:internal/child_process:286:19)
      at onErrorNT (node:internal/child_process:484:16)
      at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
    errno: -2,
    code: 'ENOENT',
    syscall: 'spawn .venv/bin/python',
    path: '.venv/bin/python',
    spawnargs: [
      '-m',
      'pylint',
      '--rcfile=.pylintrc',
      '{filepath}/Dash/dash/_compression.py'
    ]
  }
}

This happens because of the command .
venv/bin/python -m pylint '--rcfile=.pylintrc

The issue is that the venv you create has the path:
venv/dev/bin
Whereas the linter is executed from the path
venv/bin

So when executing pylint you get a path not found error.

Metadata

Metadata

Assignees

Labels

P1needed for current cyclebugsomething brokencommunitycommunity contributioninfrastructurebuild process etc.regressionthis used to work

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions