0

I am working on a library with some others. Our git repo (called modulename) looks like this

modulename/
  src_file_1.py
  src_file_2.py
tests/
  ...
.../

The instructions are to clone this somewhere in home, so I now have

~/
  modulename/
    modulename/
      src_file_1.py
      src_file_2.py
    tests/
      ...
    .../

and then run pip install . from inside the first modulename. After that, when I look in site-packages, I have

site-packages/
  modulename/
    src_file_1.py
    src_file_2.py

so pip has copied the source into site-packages

The problem I how have, is that when I make changes to the cloned repository, those changes are not copied into site-packages, so when I use the module in some other code, I only see the version copied when I did pip install .. I'm in a bit of a mess here. What is the proper way to work on this library so I can commit my changes back to git and also import the module from other places on my machine?

2
  • 1
    You need to "reinstall" your package after changes. Or use a package directly from the cloned repo. In general, packages installed in site-packages should be properly versioned, i.e. if there are changes in the package, the version should be updated and reinstalled. Commented Sep 11, 2024 at 10:58
  • @ACarter please do not accept answers immediately, wait for a day or two for a better answer Commented Sep 11, 2024 at 11:27

1 Answer 1

3

When using pip install for development, you are supposed to use a flag --editable.

pip install -e .

That way, no copy of implementation is done and your edits to original files affect all programs executed in that Python environment.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.