#@Helder Correia Any chance you could

1 messages · Page 1 of 1 (latest)

real drum
#

Hi!

#

That module should still work

charred peak
#

For some reason it's working fine in another module:

.
└── dagger
    ├── poetry.lock
    ├── pyproject.toml
    ├── sdk
    │   └── src
    │       └── dagger
    │           ├── client
    │           ├── _codegen
    │           ├── _engine
    │           └── mod
    └── src
        └── main.py
#

The difference is that the second module was created/init on 0.10, the first was updated to 0.10 manually...

real drum
#

How did you update manually?

#

Can you show the full pyproject.toml?

charred peak
real drum
#

I should probably default dagger init to src/main/__init__.py instead of src/main.py.

charred peak
#

That'd be ideal I think, I'd imagine multiple files to be quite common

real drum
#

Yep. Add ruff even complains. Because of INP001.

charred peak
#

Still getting that same error after moving the files into a package and renaming the module to main

#

Do I also need to include the package main, even when the name of the module is main...

#

That hasn't worked either, hah

real drum
#

This isn't correct:

packages = [{ include = "main" }]

Because you're missing src.

#

Your import from constants isn't right either, since it should be in the main package rather than top level constants.

#

@charred peak try this:

diff --git a/lambda/dagger/pyproject.toml b/lambda/dagger/pyproject.toml
index ea88973..25158f1 100644
--- a/lambda/dagger/pyproject.toml
+++ b/lambda/dagger/pyproject.toml
@@ -3,7 +3,7 @@ name = "main"
 version = "0.1.1"
 description = "Lambda Dagger module"
 authors = ["Mjb141"]
-packages = [{ include = "main" }]
+packages = [{ include = "main", from = "src" }]

 [tool.poetry.dependencies]
 python = "^3.11"
diff --git a/lambda/dagger/src/main/main.py b/lambda/dagger/src/main/main.py
index 2cbc905..d2b1bba 100644
--- a/lambda/dagger/src/main/main.py
+++ b/lambda/dagger/src/main/main.py
@@ -2,7 +2,7 @@ import dagger
 from dagger import dag, function, object_type, Doc
 from typing import Annotated

-from constants import *
+from .constants import *


 @object_type
charred peak
#

That's done it, thanks.

real drum
#

The error is confusing because it there's an error during import, the error message is "did you create a src/main.py file?"

charred peak
#

Indeed

real drum
#

The underlying error should surface more easily.

#

I've added it to the backlog and will fix it soon 🙂

charred peak