#unable to split main.py into multiple files

1 messages · Page 1 of 1 (latest)

jagged garnet
#

Hello,

I'm currently having an issue splitting my functions in main.py into different files (e.g., test.py, linting.py, etc.). I've been stuck for a few days going through the documentation, implementations of other modules, etc.

I've been following the official PythonSdkDev module as inspiration here https://github.com/dagger/dagger/blob/ba70be4ef8c2517bf9b683ca49e565cfaa771cae/sdk/python/dev/src/main/main.py

When importing TestSuite defined in test.py into main.py, i get the following error

│ /src/sha256:92f22699c7f5f11898cc121273cea85707c70ae7b6442e10c1ea0a4f3d4fb738 │                       
│ /dagger/sdk/src/dagger/mod/_converter.py:108 in to_typedef                   │                                              
│ ❱ 108 │   if issubclass(cls := typ.hint, enum.Enum):                         │                       
│   109 │   │   return td.with_enum(cls.__name__, description=get_doc(cls))    │                       
│   110 │                                                                      │                       
│   111 │   if issubclass(cls := typ.hint, Scalar):                            │                       
╰──────────────────────────────────────────────────────────────────────────────╯                       
TypeError: issubclass() arg 1 must be a class                                                          
! failed to initialize module: failed to call module "jobpost_crawler" to get functions: process "/runtime" did not complete successfully: exit code: 1
Error: failed to serve module: input: module.withSource.initialize failed to initialize module: failed to call module "jobpost_crawler" to get functions: process "/runtime" did not complete successfully: exit code: 1

I'm using dagger version 0.15.3
My dagger module has been initialized next to my application code with the command (if that matters)

dagger init --sdk=python --source=./dagger

Ping @hallow seal as he is the author 😄

Thanks a lot in advance
JP

GitHub

An engine to run your pipelines in containers. Contribute to dagger/dagger development by creating an account on GitHub.

jagged garnet
#

I found my issue in this line

def test_versions(self) -> list[TestSuite]:

I was using List from typing (capital L)

def test_versions(self) -> List[TestSuite]:

I was using them interchangeably, but maybe there are implications to doing so

next oriole
#

@jagged garnet just checking if you were able to fully resolve your issue here 🙏

jagged garnet
#

Yes I did if you tried to ping me