Repository: conan-io/conan

Issue:
--update is not working with python-requires with version-ranges
@memsharded This is still not functioning. `conan version 1.15.1`

I'm using python requires in the manner described here:
https://docs.conan.io/en/latest/extending/python_requires.html#python-requires-reusing-code-experimental

I'm defining base ConanFile recipes, which works great!

In my downstream conanfiles:
```
common = python_requires('ConanRecipes/[>=0.1.0-0, include_prerelease=True]@mh/testing')

class ThisIsAPackage(common.BaseRecipe):
```

However, it still does not get updated with `--update` 
I have to remove the ConanRecipes locally to get latest version.

`conan remove ConanRecipes* -f`

Then it downloads the latest one.

_Originally posted by @Mark-Hatch-Bose in https://github.com/conan-io/conan/issues/4650#issuecomment-497464305_


Discussion:

Resolving patch:
diff --git a/conans/client/graph/python_requires.py b/conans/client/graph/python_requires.py
--- a/conans/client/graph/python_requires.py
+++ b/conans/client/graph/python_requires.py
@@ -45,7 +45,7 @@ def _look_for_require(self, require):
         except KeyError:
             ref = ConanFileReference.loads(require)
             requirement = Requirement(ref)
-            self._range_resolver.resolve(requirement, "python_require", update=False,
+            self._range_resolver.resolve(requirement, "python_require", update=self._update,
                                          remotes=self._remotes)
             ref = requirement.ref
             result = self._proxy.get_recipe(ref, self._check_updates, self._update,


Test patch:
diff --git a/conans/test/functional/python_requires/python_requires_test.py b/conans/test/functional/python_requires/python_requires_test.py
--- a/conans/test/functional/python_requires/python_requires_test.py
+++ b/conans/test/functional/python_requires/python_requires_test.py
@@ -502,6 +502,40 @@ def configure(self):
         client2.run("install . --update")
         self.assertIn("conanfile.py: PYTHON REQUIRE VAR 143", client2.out)
 
+    def update_ranges_test(self):
+        # https://github.com/conan-io/conan/issues/4650#issuecomment-497464305
+        client = TestClient(servers={"default": TestServer()},
+                            users={"default": [("lasote", "mypass")]})
+        conanfile = """from conans import ConanFile
+somevar = 42
+class MyConanfileBase(ConanFile):
+    pass
+"""
+        client.save({"conanfile.py": conanfile})
+        client.run("export . MyConanfileBase/1.1@lasote/testing")
+        client.run("upload * --confirm")
+
+        client2 = TestClient(servers=client.servers, users={"default": [("lasote", "mypass")]})
+
+        reuse = """from conans import python_requires
+base = python_requires("MyConanfileBase/[>1.0]@lasote/testing")
+class PkgTest(base.MyConanfileBase):
+    def configure(self):
+        self.output.info("PYTHON REQUIRE VAR %s" % base.somevar)
+"""
+
+        client2.save({"conanfile.py": reuse})
+        client2.run("install .")
+        self.assertIn("conanfile.py: PYTHON REQUIRE VAR 42", client2.out)
+
+        client.save({"conanfile.py": conanfile.replace("42", "143")})
+        # Make sure to bump the version!
+        client.run("export . MyConanfileBase/1.2@lasote/testing")
+        client.run("upload * --confirm")
+
+        client2.run("install . --update")
+        self.assertIn("conanfile.py: PYTHON REQUIRE VAR 143", client2.out)
+
     def duplicate_pyreq_test(self):
         t = TestClient()
         conanfile = textwrap.dedent("""