I was thinking about packaging one of my django project into a reusable package.
How to package is given quite nicely at https://docs.djangoproject.com/en/dev/intro/reusable-apps/ and of course in many other websites.
What all these suggest is to include the re-suable app in your django project's INSTALLED_APPS list in settings.py.
Cool, but what I've multiple (3rd party) dependencies to the project. Should I tell in the documentation to include all those packages in the INSTALLED_APPS list!!
I feel that there should be a better way, that you just include one app and all it's dependencies are added to INSTALLED_APPS automatically by the app.
Now, let me give an example of clarity: (you may want to read from here)
Now:
My question is: Is there a way, by which adding 'A' to your project include 'B' and 'C' automatically?
That being said, I know how to add custom settings and provide sensible defaults. It's only that, I'm not able to think my head over dependent apps problem (may be it's because it's going to be the next day now)
I nailed it with install_requires
option in setup.py
We also have tests_require
option and an extras_require
directive which all goes to setuptools.setup()
if you are using distribute.
install_requires
and extras_require
both are a list of requirements (packages).extras_require
is a dictionary with 'testing', 'doc' etc., are keys and a list of requirements as list.These are added into distribute in version 0.5a4
Relevant links:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With