Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adopt maturin #616

Merged
merged 4 commits into from
Jan 9, 2025
Merged

feat: adopt maturin #616

merged 4 commits into from
Jan 9, 2025

Conversation

kemingy
Copy link
Member

@kemingy kemingy commented Jan 8, 2025

benefits

  • better build & release toolchain, both for devs & users
  • packaging has nothing to do with the Python version
  • more platform support

defects

  • we already use the name mosec for both rust/py packages, this will add a mosec bin to the scripts, so people may accidentally execute mosec xxx and get an error (since it's not meant to be called directly by the users)
  • no more scm version from git, we will use the one in Cargo.toml

Signed-off-by: Keming <[email protected]>
@kemingy kemingy requested a review from Copilot January 8, 2025 04:23
@github-actions github-actions bot added the enhancement New feature or request label Jan 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 5 out of 8 changed files in this pull request and generated no comments.

Files not reviewed (3)
  • MANIFEST.in: Language not supported
  • Makefile: Language not supported
  • requirements/dev.txt: Language not supported
Comments suppressed due to low confidence (1)

mosec/runtime.py:273

  • Ensure that the 'mosec' binary is correctly located in the PATH to avoid runtime errors. Previously, the path was explicitly set using importlib_files.
self.process = subprocess.Popen([str("mosec"), config_path])
@github-actions github-actions bot added enhancement New feature or request and removed enhancement New feature or request labels Jan 8, 2025
@kemingy kemingy requested a review from lkevinzc January 8, 2025 05:34
@kemingy
Copy link
Member Author

kemingy commented Jan 9, 2025

I have verified that this works for:

  • miniconda
  • uv
  • Ubuntu system python & pip (with --break-system-packages, yes it's not recommended but who knows)
  • python official docker image
  • envd

@kemingy
Copy link
Member Author

kemingy commented Jan 9, 2025

There are many ways to install Python packages, but if they're managed by modern tools, I think they should work.

One common issue from envd is that the user installs with system-level pip but doesn't have the write permission, so the bin is placed to their /home/$USER/.local/bin, this may not be in their PATH. I don't remember how to reproduce now.

@kemingy kemingy requested a review from Copilot January 9, 2025 03:40

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 6 out of 14 changed files in this pull request and generated no comments.

Files not reviewed (8)
  • MANIFEST.in: Language not supported
  • Makefile: Language not supported
  • requirements/dev.txt: Language not supported
  • setup.py: Evaluated as low risk
  • tests/test_service.py: Evaluated as low risk
  • mosec/init.py: Evaluated as low risk
  • Cargo.toml: Evaluated as low risk
  • .github/workflows/nightly.yml: Evaluated as low risk
Comments suppressed due to low confidence (1)

mosec/runtime.py:273

  • Using a hardcoded string for the executable path might cause issues if the executable is not in the system's PATH. Consider using a resolved path instead.
self.process = subprocess.Popen([str("mosec"), config_path])
@lkevinzc
Copy link
Member

lkevinzc commented Jan 9, 2025

Ubuntu system python & pip (with --break-system-packages, yes it's not recommended but who knows)

I have a minor concern with this. Here the python / pip refers to /usr/bin/python?

@kemingy
Copy link
Member Author

kemingy commented Jan 9, 2025

I have a minor concern with this. Here the python / pip refers to /usr/bin/python?

Not exactly. It's installed by apt install python3 python3-pip. So it's /usr/bin/python3. It's still recognized as system python. The system will warn that users need to create venv to install packages.

@lkevinzc
Copy link
Member

lkevinzc commented Jan 9, 2025

Not exactly. It's installed by apt install python3 python3-pip. So it's /usr/bin/python3. It's still recognized as system python. The system will warn that users need to create venv to install packages.

I see, thanks for clarification. Since almost all commonly used installation methods work well, let's merge this nice update to make the build simpler!

@lkevinzc lkevinzc added this pull request to the merge queue Jan 9, 2025
Merged via the queue into mosecorg:main with commit 5968646 Jan 9, 2025
17 checks passed
@kemingy kemingy deleted the maturin branch January 9, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: try to build with ABI3
2 participants