e-mission / e-mission-docs

Repository for docs and issues. If you need help, please file an issue here. Public conversations are better for open source projects than private email.
https://e-mission.readthedocs.io/en/latest
BSD 3-Clause "New" or "Revised" License
15 stars 34 forks source link

🤝 Putting shared code into an `e-mission-common` library #1058

Open JGreenlee opened 7 months ago

JGreenlee commented 7 months ago

We would like to be able to share code between e-mission-server, e-mission-phone, em-public-dashboard, and op-admin-dashboard.

I set up a repo for this purpose:

We'd rather not write and maintain all of this shared code in both JavaScript and Python. So I looked into methods we can use to translate Python into Javascript and then expose this library as both Python and Javascript packages.

I found a few options but 3 main ones.

I think Transcrypt is the closest to what we want. It is stable for Python 3.9. My only reservation is that if the project fizzles out, e-mission-common could be stuck on Python 3.9 and not able to upgrade. But that probably wouldn't be the end of the world - we could switch to a new translator at a later point in time because the Python source will still be valid Python regardless of what translator we are using.

So I set up e-mission-common with Transcrypt.

For the purpose of testing changes locally, I have included it in e-mission-phone as a local dependency on my filesystem:

image

When the first version of e-mission-common is done, we can change the local file reference to a git URL reference. Or we could actually publish it to the npm registry.

As for Python I am not entirely sure how the dependencies work in conda. But I'd imagine there should be a way to add a git URL as a dependency. If not we might need to publish it to PyPI.

JGreenlee commented 7 months ago

Code that should be moved to e-mission-common at some point: