Import forked module in Python instead of installed module

DChaps

I would like to make changes (and possibly contribute if its any good) to a public project on GitHub. I've forked and cloned the module but Im unclear how to get my program to import the local library instead of the 'official' installed module.

I tried cloning it into my project folder but when I imported it and tried to use it things got weird calmap\calmap.plot()

I also tried doing sys.path.append and the folder location. But it seems to still import the official one instead of the forked.

I'm assuming that I could put my program inside the module folder so that module would be found first but I can't image thats the 'correct' way to do it.

|
|-->My_Project_Folder/
|
|-->Forked_Module/
     |-->docs/
     |-->Forked_Module/
          |-->__init__.py
mgilson

If you're already using anaconda, then you can create a new environment just for the development of this feature.

First, create a new environment:

# develop_lib is the name of the environment.
# You can pick anything that is memorable instead.
# You can also use whatever python version you require ...
conda create -n develop_lib python3.5

Once you have the environment, then you probably want to enter that environment in your current session:

source activate develop_lib

Ok, now that you have the environment set up, you'll probably need to install some requirements for whatever third party library you're developing. I don't know what those dependencies are, but you can install them in your environment using conda install (if they're available) or using pip. Now you're ready to start working with the library that you want to update. python setup.py develop should be available assuming that the package has a standard build process. After you've run that, things should be good to go. You can make changes, run tests, etc.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related