4

I'm able to have the source files I'm working on installed to an editable package directory following the instructions here.

So my pipenv looks like

[dev-packages]
pytest = "*"
my-package= {editable = true, path = "."}

This allows me to run

pipenv install --dev

then

pytest

to test.

Is it possible to put my package into in ./src? I've tried that and I'm told the path is invalid.

ValueError: Invalid path './src'

*After Carlo's answer + the improvement from hoefling Here's a project that verified Carlo's answer https://github.com/ollyjshaw/alan_pytridge/

Oliver Shaw
  • 5,235
  • 4
  • 26
  • 35
  • 3
    Don't shoot the messenger, but you've accepted the wrong answer. Instead of moving the setup script to `src`, making it the new project root, you should map the source root in the setup script correctly. `setup(name="alan_pytridge", packages=find_packages(where='src'), package_dir={'': 'src'})` is already sufficient. Check out the docs for detailed explanation: [Listing whole packages](https://docs.python.org/3/distutils/setupscript.html#listing-whole-packages). – hoefling Jan 02 '19 at 15:39
  • That works too, thanks. I'll read up the link you have provided. https://github.com/ollyjshaw/alan_pytridge/commit/7c7b1b3288fd77683a45de438e6d51704fc63388 – Oliver Shaw Jan 03 '19 at 08:03

1 Answers1

1

In order to be able install a path as editable, it needs to be a package and that means you need to have a setup.py file in that directory.