简体   繁体   中英

Use pip and requirements.txt to install non-Python repositories

So I'm making a Flask app, and I am managing Flask and some of the necessary plugins using pip and requirements.txt. However, my app also uses a couple of jQuery and JS projects from Github as well.

It would be very simple to deal with them in the same way as other Python packages - to list their git URL in requirements.txt and to clone that repository at a given tag. Of course, the issue is that these non-python projects don't have a setup.py file.

Is it possible to configure pip to simply clone these repos into a specific path even if there is no setup.py? Or do you have another recommended way of dealing with this?

In a way this is possible. For jQuery this is easy, as someone has already prepared the package for it: https://pypi.python.org/pypi/django-jquery .

For other JS projects on Github you would effectively have to fork them, and create a suitable setup.py file, and upload them to pypi.python.org.

I've not had any experience doing such as this, so I'm not sure if there would be any problems from the python community with using their packaging tools to package non-python software. In the django-jquery case they've added a bit of django glue to make it easy to use in django projects.

There is a fanstatic package that does that.

fanstatic has a list of pre-packaged libraries that can be found here . Those packages are basically ports of some popular javascript/css libraries with a setup.py .

It does have jquery and most of the useful plugins, knockout , knockback , underscore , yui , bootstrap , d3 , backbone ...

Most of those are published to pypi under the name js.<libraryname> .

No, you cannot use pip to install anything but python distributions.

Use another installation tool; buildout can manage both Python distributions and other installation tasks with python extensions called recipes.

Alternatively, you could package up your jQuery dependency as a python distribution, but such a distribution would be very tightly bound to your application. The Plone community does do this, but they include configuration for the Plone CMS to integrate the libraries into their registries; see plone.app.jquery for example, the contents of the package include more than just jQuery.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM