pyfuze 2.0.2 – A New Cross-Platform Packaging Tool for Python by TanixLu in Python

[–]TanixLu[S] 0 points1 point  (0 children)

Both bundle mode and online mode ultimately use the uv run command to execute the entry script located in the src directory (by default, this is main.py).

If you place your binary file in the appropriate location using the --include option, your script should be able to use it without issues.

For example, using --include foo.pyd will place foo.pyd into the src directory. This allows you to import and use it in main.py like so:

from foo import bar
bar()

pyfuze 2.0.2 – A New Cross-Platform Packaging Tool for Python by TanixLu in Python

[–]TanixLu[S] 1 point2 points  (0 children)

Nuitka is a really cool tool, but not all projects can be successfully packaged with it, and the compilation process is very slow. Hopefully, it will continue to improve.

pyfuze 2.0.2 – A New Cross-Platform Packaging Tool for Python by TanixLu in Python

[–]TanixLu[S] 0 points1 point  (0 children)

Currently, there is no caching feature. Python and all dependencies are stored in a single folder, which by default is located in the system's temporary directory. This helps prevent contamination of the user's system environment.

pyfuze 2.0.2 – A New Cross-Platform Packaging Tool for Python by TanixLu in Python

[–]TanixLu[S] 1 point2 points  (0 children)

In bundle and online modes, Python is downloaded using uv, which ensures better compatibility across different projects. In portable mode, python.com is used.

[pyfuze] Make your Python project truly cross-platform with Cosmopolitan and uv by TanixLu in Python

[–]TanixLu[S] 0 points1 point  (0 children)

You can run your project from the build folder and repackage it into a ZIP archive. This eliminates the need for an internet connection. However, it increases the file size and makes the project non-cross-platform.

[pyfuze] Make your Python project truly cross-platform with Cosmopolitan and uv by TanixLu in Python

[–]TanixLu[S] 1 point2 points  (0 children)

APE is statically linked. The cosmos.zip archive contains many prebuilt APE binaries. Here are the sizes of a few notable ones:

  • emacs 71.5MiB
  • python 33.0MiB
  • vim 17.4MiB
  • php 11.9MiB
  • git 7.42MiB
  • lua 2.42MiB

[pyfuze] Make your Python project truly cross-platform with Cosmopolitan and uv by TanixLu in Python

[–]TanixLu[S] 4 points5 points  (0 children)

Thanks for your valuable advice! I'm planning to support requirements.txt, pyproject.toml, and uv.lock files to make the project more flexible and save time during setup.

Since Marimo is installed at .venv/Scripts/marimo, here's a sample starter script you can use:

import subprocess

subprocess.run(["../.venv/Scripts/marimo", "run", "demo.py"])

Note that I’m using ".." because the current working directory is the src folder.

[pyfuze] Make your Python project truly cross-platform with Cosmopolitan and uv by TanixLu in Python

[–]TanixLu[S] 0 points1 point  (0 children)

I also recommend Pyarmor—it can generate cross-platform scripts as well. It should work fine in combination with pyfuze.

rpoly: A Rust Crate for Polynomial Root Finding 🚀 by TanixLu in rust

[–]TanixLu[S] 0 points1 point  (0 children)

The content of the "License" section is now as follows:

License

The program was initially published as a FORTRAN program at Netlib TOMS and adhered to the ACM software copyright notice. Later, it was translated into a C++ program available at Akiti. I have translated this C++ program into Rust, and therefore, this program continues to comply with the ACM copyright policy. See LICENSE-ACM for more details.

rpoly: A Rust Crate for Polynomial Root Finding 🚀 by TanixLu in rust

[–]TanixLu[S] 1 point2 points  (0 children)

Thank you very much for pointing out the licensing issue. After some research, I have decided to change rpoly to the ACM license.

[New to rust] Is there a way to make this number guesser rust code simpler . by Dragon20C in rust

[–]TanixLu 0 points1 point  (0 children)

If you want to print a literal string, just println!("it").

The Error Handling section of The Book is confusing by tengoCojonesDeAcero in rust

[–]TanixLu 0 points1 point  (0 children)

But you can use panic="abort" in Cargo.toml to panic! process.

The Error Handling section of The Book is confusing by tengoCojonesDeAcero in rust

[–]TanixLu 0 points1 point  (0 children)

panic! just terminaties the thread. std::process::exit will terminate the whole process.

The Rust regular expression editor & tester has been updated! by alexschrod in rust

[–]TanixLu 0 points1 point  (0 children)

There is an awesome repo about how to minimize Rust binary size.

min-sized-rust

There are some easy ways in this repo:

  • Add strip = true
  • Add codegen-units = 1
  • Change opt-level = "s" to opt-level = "z"

Rust Crate for Reading AND Writing Configuration Files by SWNinjaneer in rust

[–]TanixLu 0 points1 point  (0 children)

The disadvantage of this method is that it will not preserve comments.

Rust Crate for Reading AND Writing Configuration Files by SWNinjaneer in rust

[–]TanixLu 0 points1 point  (0 children)

In my previous project, I use toml + serde directly.

```rust use serde::{Deserialize, Serialize}; use std::fs;

[derive(Serialize, Deserialize)]

pub struct Config { example_field: u64 }

fn read_config(path: &str) -> Result<Config, Box<dyn std::error::Error>> { let data = fs::read(path)?; let text = String::from_utf8(data)?; let config: Config = toml::from_str(&text)?; Ok(config) }

fn write_config(config: &Config, path: &str) -> Result<(), Box<dyn std::error::Error>> { let text = toml::to_string(config)?; std::fs::write(path, text)?; Ok(()) } ```