thoth-station/micropipenv

RFE: support directory-based dependencies

abompard opened this issue · 4 comments

I'm using Poetry as a dependencies manager. If one of my dependencies is directory-based, micropipenv stops with the message:

micropipenv supports Git VCS, got directory instead

I think it's a common pattern for project that have multiple components to have directory-based dependencies from a subproject to another. My pyproject.toml file has:

[tool.poetry.dependencies]
myproject = {path = "./myproject"}

I propose the following change:

@@ -703,11 +703,13 @@
             requirement["markers"] = entry["marker"]
 
         if "source" in entry:
-            if entry["source"]["type"] != "git":
-                raise NotSupportedError("micropipenv supports Git VCS, got {} instead".format(entry["source"]["type"]))
-
-            requirement["git"] = entry["source"]["url"]
-            requirement["ref"] = entry["source"]["reference"]
+            if entry["source"]["type"] == "git":
+                requirement["git"] = entry["source"]["url"]
+                requirement["ref"] = entry["source"]["reference"]
+            elif entry["source"]["type"] == "directory":
+                requirement["path"] = entry["source"]["url"]
+            else:
+                raise NotSupportedError("micropipenv supports Git VCS or directories, got {} instead".format(entry["source"]["type"]))
 
         # Poetry does not store information about extras in poetry.lock
         # (directly).  It stores extras used for direct dependencies in

I'm totally willing to send a proper PR with unit tests, but first I wanted to check whether you'd be interested in this feature, and if you think I'm on the right track.

Thanks.

In my opinion, it makes sense and it seems to work fine. The pipfile.lock produced by your implementation seems to be valid and micropipenv is able to install it. @fridex do you know about any issues or blockers?

Cool, thanks. I have created a PR with the change: #204

+1 from my side. @abompard thanks for the idea and contribution 👍🏻

/kind feature