You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Commit `d936262e` switched the `test` script to use `cz` instead of
`commitizen`, but forgot the prefix to the command is
`poetry run python -m`, which looks for a python module.
`cz` is not a module: it is an entry point script (specified in the
`pyproject.toml` table `[tool.poetry.scripts]`).
Switching `$PREFIX` to `venv/bin/` creates two problems:
- The subdirectory `venv` creates differs depending on OS. On
Linux/MacOS, the subdirectory containing copies/symlinks to
Python binaries is `bin`, but on Windows it is `Scripts`.
Similiarly, the `site-packages` directory on Linux/MacOS is
`lib/pythonX.Y/site-packages`, but on Windows it is
`Lib\site-packages`.
See: https://docs.python.org/3/library/venv.html#module-venv
- Since `commitizen` isn't the entry-point script, but rather
`cz`, the command `venv/bin/commitizen` will fail on
Linux/MacOS and Windows.
Poetry will check to see if it is currently running inside a
virtual environment, and if it is, it will use it directly
without creating a new one. If it isn't, it will use one that
it has already created or create a brand new one for you.
See: https://python-poetry.org/docs/managing-environments/
A better solution than switching the prefix would be to activate
the virtual environment. However, users can create virtual
environments with any name they choose (`venv/`, `.venv/`, or
otherwise). In addition, they can specify whether or not `poetry`
should create a virtual environment in the project folder
`virtualenvs.in-project`), or at all (`virtualenvs.create`).
Since switching to `venv/bin` only affects developers running
scripts locally (the GitHub Actions CI scripts run `poetry install`
and let it manage the virtual environment), it's best to
remove changing the `$PREFIX` and instead add instructions to
`README`/`CONTRIBUTING`/etc. to tell users to configure `poetry`
and activate their virtual environment appropriately if running
these scripts locally.
0 commit comments