You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin has a viable future for the Tauri community, I have been long awaiting a Python plugin like this. However, I feel as though there is still work to be done to make this plugin production-ready. I would like to start the conversation about standardizing the Python + PyO3 + Tauri development and production environments such that it can be easily distributed to end-users. PyO3 supports more Python libraries (CPython compilation) than RustPython, which is better for guaranteeing Tauri builds. Therefore, PyO3 is only discussed in this issue.
I have started looking into how to modify the test build github action provided by tauri actions to support pyo3 and this plugin. However, I figured this plugin community should create a standardized development process that aligns with Tauri's CI/CD pipeline for app distribution before I continue.
Feature Requests
Here are some things I think we need to develop and document better. I would be willing to contribute to these.
Local app development should use a python virtual environments by default.
Using a venv is good practice in the Python community. The venv should be in a standardized location in the developer's app repository. Currently, I have mine external to the Tauri application, which I believe is the best for developing and distributing because it avoids copying issues inside GA.
Inside main.py, I had to add the following:
importsysimportosifos.path.exists("../../venv/Lib/site-packages"):
sys.path.append("../../venv/Lib/site-packages")
else:
print("Path does not exist, please check your virtual environment setup.", os.getcwd())
GitHub Actions Workflow - Copying libpython, venv 3rd party packages, and other python requirements into the build distribution.
I have been reading through the pyo3 documentation, tauri documentation, and this plugin's documentation, but it has been a challenge to get the test build github action to work for all the OSs. The problem is that each OS uses venv and libpython differently (libpython3.10.dll vs. libpython3.10.dylib). Also, how would 3rd party python packages get properly distributed?
Source Code Protection
I recognize that source code hiding can still be cracked, but storing the Python files in plain text in distribution is something I would like to avoid. I think this should at least be an option for developers to add to their applications. Give the developer the decision to open-source or close-source their application. Thus, I had 3 different ideas in mind for source code hiding:
Obfuscate the .py files in GitHub Action using pyarmor OR another library.
Encrypt .py files to prevent plain text snooping, then decrypt with a symmetric key stored with keyring on application boot.
// py_lib_pyo3.rs// TODO Instead of passing in code:String as plain text, decrypt it first with keyringpubfnrun_python_internal(code:String,_filename:String) -> crate::Result<()>{
marker::Python::with_gil(|py| -> crate::Result<()>{let globals = GLOBALS.lock().unwrap().clone_ref(py).into_bound(py);let c_code = CString::new(code).expect("CString::new failed");Ok(py.run(&c_code,Some(&globals),None)?)})}
Overview
This plugin has a viable future for the Tauri community, I have been long awaiting a Python plugin like this. However, I feel as though there is still work to be done to make this plugin production-ready. I would like to start the conversation about standardizing the Python + PyO3 + Tauri development and production environments such that it can be easily distributed to end-users. PyO3 supports more Python libraries (CPython compilation) than RustPython, which is better for guaranteeing Tauri builds. Therefore, PyO3 is only discussed in this issue.
I have started looking into how to modify the test build github action provided by tauri actions to support pyo3 and this plugin. However, I figured this plugin community should create a standardized development process that aligns with Tauri's CI/CD pipeline for app distribution before I continue.
Feature Requests
Here are some things I think we need to develop and document better. I would be willing to contribute to these.
Local app development should use a python virtual environments by default.
Using a venv is good practice in the Python community. The venv should be in a standardized location in the developer's app repository. Currently, I have mine external to the Tauri application, which I believe is the best for developing and distributing because it avoids copying issues inside GA.
Inside main.py, I had to add the following:
GitHub Actions Workflow - Copying libpython, venv 3rd party packages, and other python requirements into the build distribution.
I have been reading through the pyo3 documentation, tauri documentation, and this plugin's documentation, but it has been a challenge to get the test build github action to work for all the OSs. The problem is that each OS uses venv and libpython differently (
libpython3.10.dllvs.libpython3.10.dylib). Also, how would 3rd party python packages get properly distributed?Source Code Protection
I recognize that source code hiding can still be cracked, but storing the Python files in plain text in distribution is something I would like to avoid. I think this should at least be an option for developers to add to their applications. Give the developer the decision to open-source or close-source their application. Thus, I had 3 different ideas in mind for source code hiding: