Strdate / PythonConsole

Cities Skylines mod
25 stars 4 forks source link

Including the Python standard library by default #5

Open jqdq opened 2 years ago

jqdq commented 2 years ago

I've been thinking about using some external Python libraries with your mod (downloading them is possible using pip install --target) and I've noticed you are not including Python standard library with this Python build (random and other similar packages are not available). I've managed to go around this by adding a pure Python implementation of the standard library to the import folder. The implementation I used came from the PyPy project. Have you thought about including these in your mod? Doing this would greatly improve its power.

HuangFuSL commented 2 years ago

My idea is a lot more extreme - rewriting the client in pure Python. If we can use native Python as client, then life will be a lot simpler for us. Yes, you can even use your existing Python interpreter and installed PyPI packages! I'm currently working on it, but I'm not sure whether it would be a successful attempt.

Strdate commented 2 years ago

@PogromcaPapai I'm not a regular python user so I've never thought about that. I will check it out and add it if possible.

@HuangFuSL Good luck. I'm currently rewriting the client from scratch so that it includes some caching logic and other improvements. Though I must say that implementing the client purely in Python isn't a bad idea, but I can't do that as I'm primarily a C# programmer.

Strdate commented 2 years ago

@PogromcaPapai I included PyPy in the newest release. I tested it with the random module and it seems to be working. I would be happy if you could tell me if everything works correctly as I didn't know which files to copy from the PyPy project. I copied everything from the lib-python folder but I'm not sure that's enough.