conan-io / docs

conan.io reStructuredText documentation
http://docs.conan.io
MIT License
104 stars 352 forks source link

change order of methods in documentation #1931

Open SSE4 opened 3 years ago

SSE4 commented 3 years ago

follow up https://github.com/conan-io/conan-center-index/pull/3614 maybe it makes sense to change order of methods in conan docs, and just reference it on conan-center-index guidelines? right now documentation lists methods here: https://github.com/conan-io/docs/blob/develop/reference/conanfile/methods.rst

most conan center contributors find it convenient to have methods listed in so-called "order of execution". right now, the order of execution is:

- init
- set_name
- set_version
- export
- export_sources
- config_options
- configure
- requirements
- package_id
- build_id
- build_requirements
- system_requirements
- source
- imports
- build
- package
- package_info
- deploy
- test

does it make sense to list methods in reference in that order? or maybe you have another better alternative (e.g. have all **_requirements method grouped together)?

/cc @jgsogo @memsharded

memsharded commented 3 years ago

I think I like the proposal, do you refer to the order in https://docs.conan.io/en/latest/reference/conanfile/methods.html?

SSE4 commented 3 years ago

I think I like the proposal, do you refer to the order in https://docs.conan.io/en/latest/reference/conanfile/methods.html?

yes

jgsogo commented 3 years ago

I find it useful to list them using some meaningful order and recommend that order for ConanCenter recipes.

About the order in the first comment:


And probably, I'd also do an effort for the attributes, at least for those that are used like class-attributes and appear in ConanCenter recipes. Not sure if it makes sense to list these class-attributes first and then all the others.

SSE4 commented 3 years ago
  • I'd expect all the xxx-requirements to be together

could you tell me more about the motivation behind that expectation, is it just because of similar name? or do you think they always processed together?

I'm not sure what would be the right place for the package/build_id methods

it depends on the definition of right. if by right order we mean the order conan client calls methods, then it's crystal clear. otherwise, we need another definition.

And probably, I'd also do an effort for the attributes, at least for those that are used like class-attributes and appear in ConanCenter recipes.

do you think we should also check the order attributes are read/processed by conan client? let's go with methods first, as for them it's easier to process.

Croydon commented 3 years ago

could you tell me more about the motivation behind that expectation, is it just because of similar name? or do you think they always processed together?

Maybe I'm missing something, but according to the list above we have build_requirements directly followed by system_requirements so this expectation is already fulfilled?

jgsogo commented 3 years ago

@Croydon , my concern was about requirements() being separated from build_requirements() and system_requirements().

IMO it is not important the order Conan executes those functions, a Conan recipe is not a Python class in the sense that an object is instantiated and you can rely on its state. Conan does some magic behind the scenes: adds and removes attributes, populates values, depending on the Conan commands some methods are not called,... so talking about execution order can lead to some expectations that are not fulfilled.

IMO opinion it is more important the learning path, which methods are useful together, the order that will help you to understand what Conan is doing to build/retrieve a package.

Some methods are rare or very advanced, it makes sense to move them to the bottom. That way the amount of information provided to a newbie reading across the documentation is under control, they can understand the common/important method before entering in details like build_id or deploy/test that are not going to appear in a regular recipe.

Anyway, this is just my opinion, I'm ok with any order that has some motivation.