uilianries
uilianries

Reputation: 3887

How to distribute specific files using setuptools?

I would to like to distribute a python package using my setup.py, where the user is able to choose which modules will be installed.

In my case, I have the test module, where It's useful in only few cases, so it doesn't make sense distribute that module.

I can exclude the module easily by packages=find_packages(exclude=("conans.test*",)). However, I can't distribute it dynamically.

My idea is, package all files, but only install according the pip command. I would like to install the test module, only when the extra is configured:

pip install package[test]

Otherwise, it will not install the test module.

When I say test module, it means a folder with all those tests, not the requirements_test.txt file.

Is it possible using setuptools?

Regards!

Upvotes: 1

Views: 507

Answers (1)

uilianries
uilianries

Reputation: 3887

Thanks to hoefling!

Since it's possible create a dynamic package, the best that I found is run a script after install the package:

https://github.com/uilianries/conan-ldap-authentication/blob/master/setup.py#L40

Upvotes: 1

Related Questions