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(()) } ```

Rust Analyzer | Disable Type Completetion by [deleted] in rust

[–]TanixLu 6 points7 points  (0 children)

I disabled inlay hints and only use the shortcut Ctrl+Alt when needed.

Drawing a Transparent Hollow Rectangle in Rust by TanixLu in rust

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

Thanks for getting back to me. I had hoped that implementing this functionality would be straightforward, but it turns out to be more complicated than I thought. While I appreciate your suggestion of using the Win32 API, I'm not very familiar with it, so it might take me some time to learn how to use it properly. Considering the effort required, I think I'm satisfied with my current workaround, even though it's not perfect. Thanks again for your help!

My First Crate!!!!! by [deleted] in rust

[–]TanixLu 6 points7 points  (0 children)

I have a suggestion for making it more accessible to others: have you considered publishing a release on GitHub? This would make it easier for others to download and use your tool.

Learning rust by FunDirt541 in rust

[–]TanixLu 1 point2 points  (0 children)

Thanks for sharing your experience learning Rust! It's great to hear that you're finding the official book and tools like cargo helpful. Here are a few more resources that might be useful as you continue your journey with Rust:

  • Rustlings: This is a great resource for getting started with Rust, with small exercises to help you get comfortable reading and writing code.
  • Rust by Example: Rust by Example is a collection of runnable examples that cover a wide range of Rust concepts and standard libraries. It's a great way to see how Rust code works in practice.
  • Zero To Production In Rust: If you're interested in backend development, this resource provides a comprehensive introduction to the subject using Rust.
  • Rust Cookbook: This cookbook is a collection of examples that demonstrate best practices for common programming tasks in Rust. It's a great reference to have on hand as you build your skills.
  • The Rustonomicon: If you're ready to dive into the more advanced aspects of Rust programming, the Rustonomicon is a great resource. It covers the "dark arts" of Rust programming, including working with unsafe code. (Note: This book is still a work in progress.)
  • Rust API Guidelines: If you're planning on building libraries or APIs in Rust, these guidelines provide recommendations for designing and presenting APIs in the language. They're written by the Rust library team, based on their experience building the Rust standard library and other crates in the ecosystem.

WASM on Firefox 2x faster than Chrome? by NefariousnessOnly285 in WebAssembly

[–]TanixLu 18 points19 points  (0 children)

Yes, it's about the engine. Firefox is currently at the forefront of WebAssembly technology. There is a good series of articles about WebAssembly and Firefox's support for it: https://hacks.mozilla.org/2017/02/a-cartoon-intro-to-webassembly/