#[SOLVED] Cannot run dagger when a package is a local folder.

1 messages · Page 1 of 1 (latest)

glacial cobalt
#

Hello!
I'm having issue in importing a local package with a common dagger module into another dagger module in a different package, when I try to run it I get this error:

dagger.mod._exceptions.UserError: Main object not found. You can configure it explicitly by adding an entry point to your pyproject.toml file. For example:
[project.entry-points."dagger.mod"]
main_object = 'main:Tool'

after I add those lines it fails with this error:

ModuleNotFoundError: No module named 'dagger_common'

where the dagger_common module is included in the package I've installed pointing to a local folder.

I reference the local package in the .toml file in this way:
dependencies = [
"dagger-io",
{ path = "//path/to/local/package" }
]

Thanks!

#

Cannot run dagger when a package is a local folder.

mint beacon
#

Hey @glacial cobalt, you can follow how dagger-io itself is configured since it's installed from a local path too.

#

However, if dagger_common is a Dagger module, and not just a Python package, then it should be installed as a module dependency with dagger install ./path/to/local/module.

#

If it's a pure Python dependency, here's an example:

# ...
dependencies = [
  "dagger-io",
  "dagger_common",
]

[tool.uv.sources]
dagger-io = { path = "sdk", editable = true }
dagger_common = { path = "path/to/local/package" }
#

Defining the entrypoint "dagger.mod" should not be necessary for this use case, but need to know more about your setup to see if that error can be improved.

glacial cobalt
#

@mint beacon Thanks, I was able to make it work. I also removed the entrypoint definition.