Package import from DATs

I need to use a python package (in this case toml) without installing it it, e.g. it needs to exist completely within TD/DATs.

I know I can import single modules via “import datName” , but how would import a complete package with init.py and multiple modules into DATs.

Usually I approach this by looking through all the modules, and figuring out what the entry point is. Might be a particular wrapper function, might be a class object that needs to be created from one of the modules, etc.

I’m not too familiar with the init.py stuff either, but judging from what’s inside it, seems to be initializing a bunch of class objects, and defining a few things. Might be a good place to start.

Maybe start by importing all that as a text DAT, then try to run it (will fail). The first thing that will fail is the import statements, so then make text DAT’s for those modules, paste in their code, run again, and so on and so forth.

I’ve had very mixed luck with accomplishing this, with smaller libraries like this where it’s very self contained and relies on just a few python files it can work.

For larger things that reference dll’s, or precompiled c code, or other python libraries that may or may not exist in your system, think it gets exponentially more complicated.

1 Like

yeah, i was hoping for an automatic way. Fortunately in this simple case it was pretty easy to convert manually. thank you