Editable package command line interface installation under windows
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
Under Ubuntu I’m totally happy with my current setup. However under Windows I regularly run into issues w.r.t. this. I’m not sure if this is an issue or related to undocumented instructions.
On Windows 10 I’m running Python 3.8.6
. My project.toml
looks like follows:
[virtualenvs]
in-project = true
My setup.py
looks like follows:
from setuptools import find_packages, setup
import my-package
setup(
...
entry_points={"console_scripts": [my-cli=my_package.cli:main]},
...
)
...
The project structure looks as follows:
my-package
.venv (contains virtual env)
my_package (contains production code)
setup.py
poetry.toml
...
On windows if I install a new venv which implicitly installs the package in an editable manner via poetry install
and without activating the venv (no execution of poetry shell
) I can run python; >>>import my_package; >>>help(my_package)
and get the expected help output. It seems like the package is installed into the system level Python installation instead of into the venv Python installation. If I try to run the CLI in the activated venv (poetry shell
) my-cli --help
the executable is not found. However if I try to run the CLI in the activated venv the CLI executable is not found as well.
What’s the recommended way to handle my setup under Windows properly?
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
You can refer to https://github.com/python-poetry/poetry-core/tree/master/tests/masonry/builders/fixtures/extended_with_no_setup for an example. Your
build.py
should be defined to handle building etc.A real-world example is https://github.com/sdispater/pendulum/blob/master/build.py.
@abn I’ve tried on another windows machine with
poetry run my-cli --help
and gotImportError: C extension: tzutc not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.
. What to do here?