Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mix conanfile.py and conanfile.txt in the same project #307

Closed
monsdar opened this issue Jun 7, 2016 · 3 comments
Closed

Mix conanfile.py and conanfile.txt in the same project #307

monsdar opened this issue Jun 7, 2016 · 3 comments

Comments

@monsdar
Copy link
Contributor

monsdar commented Jun 7, 2016

As far as I understand there could either be a conanfile.txt or conanfile.py. However I would like to have the txt with easily-readable dependencies even in projects where I need a conanfile.py.

Usecase:
My component gets build and published via conanfile.py. A new user could easily see the dependencies of my project by taking a look at my conanfile.txt. During build the conanfile.py simply uses the txt file.

Does that make sense? Are there usecases where this is not practical?

@memsharded
Copy link
Member

It could make sense, but the cost would be too high. The thing is that conanfiles.py are moved all around. They are exported from your project to the local conan store. They are uploaded to conan servers. They are parsed in different places. They are published to the web. In the web they are parsed to get data. In all those steps you will have to attach the conanfile.txt, parse it too (different parser), store it too in the server, separately.... The complexity is too much for the use case. It is not that it is not practical, but the amount of work necessary to make it work is too high for the added value, and it will add a bit of overweight in many places so that development will be slower in the future.

Moreover, it has also other problems, it adds an extra level of indirection to other users. Many users, especially when you know a bit about conan will head to the conanfile.py, to get the requirements, but also the license, the author, the git repo to submit issues... only to discover that part of that information is stored in a different file, with fragmentation of the info. I would say that keeping ALL the information required for a package in a single file is really, really good idea.

So my suggestion would be, to have a conanfile.txt in your repository, with the requirements if you want, and adding/updatinga requirement to it manually a requirement is something that it is seldom done. You can have both files in the same folder, no problem. When you have both, the conanfile.py takes precedence. You can select the other if you want with

$ conan <command> -f=conanfile.txt

Sorry not being able to make that, thanks very much for your idea!

@monsdar
Copy link
Contributor Author

monsdar commented Jun 8, 2016

Thanks for your detailed answer. This all makes sense, so no worries about not implementing it.

As a new conan user I wasn't sure why there are two different types of configuration I can use. Perhaps in the docs it could be stated more clearly that the txt is just for using/consuming conan, the py if for also generating packets?

@monsdar monsdar closed this as completed Jun 8, 2016
@memsharded
Copy link
Member

Thanks very much for your understanding :)

Yes, that is exactly the idea, the txt is just a simplified version to allow easy consumption of existing packages without having to write a full conanfile.py. I have added a section in the reference to clarify this (http://docs.conan.io/en/latest/reference/conanfile.html), good idea (the section can be completed with further details, but enough by now), thanks very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants