Vogtinator / micropython

The Micro Python project
MIT License
28 stars 6 forks source link

Change Library folder to \documents\PyLib #13

Open STAATSY opened 2 years ago

STAATSY commented 2 years ago

Is it possible to change the target MicroPython library folder to "\documents\PyLib"? I find that the "ndless" (\documents\ndless) folder that it currently looks to becomes a bit crowded if you load a few ndless Apps and tools in there so it would be good to separate out the Python libraries and makes sense to align it with where the CXII OS looks for Python libraries as then if you have a CXII you can test libraries across MicroPython and native execution with the single file copy.

The above doesn't take away from the awesome work you have done so far - great project, very appreciative of your efforts to get this ported and open up the programming options on the TI-Nspire way before TI came to the party :)

Vogtinator commented 2 years ago

Is it possible to change the target MicroPython library folder to "\documents\PyLib"?

PRs welcome! Best option is probably to search both.

align it with where the CXII OS looks for Python libraries as then if you have a CXII you can test libraries across MicroPython and native execution with the single file copy.

Are they compatible (enough) in format?

STAATSY commented 2 years ago

Agreed just adding it as a new target may be better. so then it doesn't have any legacy impacts to people already using "\documents\ndless". I did originally try nest my libraries in "\documents\ndless\PyLib" and then use an init.py file to make MicroPython look in the subfolder so my ndless folder didn't get too crowded but I couldnt get it to work hence my request for "\documents\Pylib" target support, I guess if you are appending new targets then you could add "\documents\ndless\PyLib" in case people with CXII want to specifically separate their native python libraries and micropython libraries.

I have not tested so I am not sure if they are compatible (enough). I imagine the TI-OS native side will only see Python libraries in correct .tns format... so I guess it depends what bloat TI adds to a file to make it a real .tns file... if its not too much and its repeatable then the best way would be to modify micropython to ignore the .tns file bloat and only read the Python code... that all assumes its just file bloat and not an encryption / archive type format... In any case that is way out of the scope of my request, but seems like something someone may take an interest in at some point. So it just made sense forr me for all the Python libraries to sit in a common folder.