pythonpipsetup.pysite-packages

How to rename the site-package using pip install git +"git repo"?


How to give a specify site package name when doing following command:

pip install git+"git_repo"

I can see that "dremio_client" is successfully install under site package, but I want it call "dremio_client_test".

 -python
  -external libraries 
   -site package
    - dremio_client

What I have done:

I fork this project (https://github.com/rymurr/dremio_client/blob/master/setup.py) and want to know how to modify setup.py to achieve me goals.

setup.py

keywords="dremio_client",
name="dremio_client",
packages=find_packages(
    include=[
        "dremio_client",
        "dremio_client.flight",
        "dremio_client.auth",
        "dremio_client.model",
        "dremio_client.util",
        "dremio_client.conf",
    ]
),

I try to give it another name: "dremio_client_test" and keywords: "dremio_client_test", but it dosen't work.

I have to modify the folder name and setup.py(packages=find_packages) then it works. Wanna know is there any efficient way to do that?

Rename folder from dremio_client to dremio_client_test

-dremio_client
  -dremio_client_test

Rename the package name
packages=find_packages(
    include=[
        "dremio_client_test",
        "dremio_client_test.flight",
        "dremio_client_test.auth",
        "dremio_client_test.model",
        "dremio_client_test.util",
        "dremio_client_test.conf",
    ]

Thanks!


Solution

  • I have to modify the folder name and setup.py(packages=find_packages) then it works. Wanna know is there any efficient way to do that?

    This is the only way to do it. The name of the directory is always the name of the package.

    1. You must rename dremio_client to dremio_client_test
    2. You must rename every reference to dremio_client inside the code to dremio_client_test
    3. You must change every reference in setup.py from dremio_client to dremio_client_test.

    Yes, it is tedious. No, it's not something you are expected to do frequently. However an IDE like PyCharm can help automate renaming operations.

    Also make sure that you also change the name= in setup.py, otherwise it will clash with the actual dremio-client distribution.