Conan: Create a standalone installer for Conan that bundles the Python dependency

Created on 1 Mar 2018  路  7Comments  路  Source: conan-io/conan

To help us debug your issue please explain:

  • [X] I've read the CONTRIBUTING guide.
  • [X] I've specified the Conan version, operating system version and any tool that can be relevant.
  • [X] I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

This isn't specific to a particular version of conan. This is a feature request, so there are no repro steps.

TL;DR

My real goal is making it easier to consume conan packages. The current python dependency creates extra steps for package consumers that feel burdensome to beginners.

Use Case

I maintain the C++ language track on exercism.io. One of our ongoing pain points is the dependency on Boost.Test for unit testing. Now the boost support in conan is great considering that a bunch of hardworking volunteers took it upon themselves to split out the various boost libraries into separate conan packages and pulling down packages with conan is easy and straightforward.

However, if the C++ language track at exercism were to adopt a conan-style package model, it would replace figuring out how to download/build/install boost with installing python and installing conan on top of that.

So I'm wondering if we can encapsulate everything that conan needs from Python along with conan itself into a single end-user install package so that people don't need to worry about Python. I know, I know, you're saying to yourself "what self respecting developer doesn't already have Python installed or is intimidated by it?", but lots of people trying out languages in exercism for the first time are new developers and every little dependency that we add into the equation just complicates matters by an order of magnitude for them.

From the point of view of a package consumer, I don't actually need to know anything about python and conan installation itself doesn't need anything beyond knowing where python is installed so that it can do it's thing. Basically I'm arguing that a self-contained solution for package management is simpler and easier for consumers of packages. Do consumers ever really need to know anything about conan python package recipes? I would argue that they don't.

This, of course, necessitates creating such an installer package for the different end-user platforms where conan might be used and realistically that means Windows, macOS and linux. I know how it would/could work on Windows, but I have less familiarity with macOS and linux packaging to know if it is feasible there.

Thoughts?

question

All 7 comments

Hi @LegalizeAdulthood and thnaks for your thoughts.

If I understand your point well, you would need an easier way to install Conan withou messing with python an its dependendencies... Although we recomed the installation of conan using pip, we al so have installers for it: https://conan.io/downloads.html

As you may know, those installers are generated with pyinstaller gathering its dependencies. For both package consumers and creators, installers should be ok. Is this your real pain here?

The pyinstaller code is already in the repo! :)

You can try to get conan from sources, install its python dependencies (http://docs.conan.io/en/latest/installation.html#install-from-source), and:

$ python pyinstaller.py

This will create the executables that bundle the python interpreter. With minor modifications to the pyinstaller.py`` code you should be able to create also standalone executables that unzip when executed, so these executables are very easy to deploy anywhere without requiring python.

I've tried pyinstaller and it looks cool.
However one drawback is that it's not possible to use via Python API (moreover as I understand pyinstaller may additionally obfuscate the code).

Intermediate solution is to install pip dependencies locally:
pip install --target=dist --ignore-installed --upgrade conan

and create simple runner (put into dist folder or adjust sys.path):

#!/usr/bin/env python
import sys
from conans.conan import main
main(sys.argv[1:])

then dist folder will contain most of dependencies minus what already available on the system.
It also smaller: on my Linux machine it's 24M vs 92M, which makes difference if this package is downloaded and unpacked for every build (as in my case).

Yes, exactly, to use the Python API you need to have a full fledged python installation. I wouldn't recommend to use the Python API with the pyinstaller version.

Your solution looks good. But I am a bit surprised regarding size, I have checked a new pip install conan in Windows and it is only 46Mb, I typically expect installation in Linux to be a bit more space efficient.

No contradictions here. pip install version on Linux takes just 24M. (python 2.7.5 x64 with few site packages coming from repos).

Hey, that looks great. I will take a look at the standalone installers and try out the experience. It could be exactly what we're looking for!

When I had tried conan myself, I had done the pip route because I already had python installed and it was the recommended approach for package development.

Seems this was solved. Please comment/reopen if needed! Thanks 馃槃

Was this page helpful?
0 / 5 - 0 ratings