Reputation: 27855
I write a reusable django app. This app uses the are-you-sure jquery library.
Installing my app with all dependencies should be easy.
If a developer wants to use my app, then the following line should install the whole app (including the are-you-sure plugin):
pip install myreusableapp
What is the common solution to pull in dependency to open source JS code?
install_requires
in setup.py
. Works fine.Upvotes: 3
Views: 544
Reputation: 6939
As Dekel said, the easiest solution is to use a third-party CDN.
If, however, you don't want to rely on a third-party CDN, the common solution is to include a copy of the JS library in your app's repository. For example, django itself does this with jquery. You will need to use the package_data argument of setup()
to include the JS library in your distributable.
Upvotes: 2
Reputation: 62566
Since you are talking about open-source javascript library you can rely on CDNs (same way you rely on jQuery in your code).
In this specific example - you can use cdnjs for that:
https://cdnjs.com/libraries/jquery.AreYouSure
Just make sure the template you are using includes the relevant script file:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.AreYouSure/1.9.0/jquery.are-you-sure.min.js"></script>
Upvotes: 3