Conan-center-index: [question] Can we use python_requires?

Created on 4 Dec 2019  路  3Comments  路  Source: conan-io/conan-center-index

Hi!

The PR #416 has the current case:

  • We are using the generic folder all to keep a generic recipe which works for any version;
  • The latest version (6.1.0) contains a bug which does not work for Windows + MSVC 14 + shared=True;
  • Basically, we only need to add a configure() section and raise ConanInvalidConfiguration to the specific case.

Now we need to decide what to do with this situation:

  • As the generic recipe should not be contaminated with specific versions, we can create an entire new folder version, copying ALL files from all folder and only adding the configure(self) section.

    • Cons: "Duplication may be the root of all evil in software." If we need to fix a bug in one recipe, we will need to replicate the same fix
  • Use python_requires("fmt/6.0.0") for 6.1.0 as we only need to add a restriction.

    • Cons: We can't customize the test_package, so we will need to copy test folder. Also, python_requires is experimental.
  • Import all/conanfile.py as Python module and customize as we need.

    • Cons: Same situation as python_requires
  • Break the rule of purity and add configure() in the generic recipe to ignore only that specific configuration.

    • Cons: No cons.
question

Most helpful comment

python_requires("fmt/6.0.0")

I don't think so. This doesn't sound the right mechanism to solve this problem.
Besides other problems, like being experimental, it is not the right tool for this. Better explicit than implicit.

I don't see a strong reason why the recipe cannot use the version in configure() to raise an invalid configuration error. That would be flat, easy to read, easy to maintain and understandable by users.

All 3 comments

python_requires("fmt/6.0.0")

I don't think so. This doesn't sound the right mechanism to solve this problem.
Besides other problems, like being experimental, it is not the right tool for this. Better explicit than implicit.

I don't see a strong reason why the recipe cannot use the version in configure() to raise an invalid configuration error. That would be flat, easy to read, easy to maintain and understandable by users.

I don't see a strong reason why the recipe cannot use the version in configure() to raise an invalid configuration error

Great! At same time we have a formal definition for future similar cases.

Added this question to the FAQ https://github.com/conan-io/conan-center-index/wiki/FAQ#are-python-requires-allowed-in-the-conan-center-index Thanks!

Was this page helpful?
0 / 5 - 0 ratings