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

Python wheel #3

Open
elocke opened this issue Dec 23, 2019 · 10 comments
Open

Python wheel #3

elocke opened this issue Dec 23, 2019 · 10 comments

Comments

@elocke
Copy link

elocke commented Dec 23, 2019

Hello,

Are you planning on creating a python wheel to utilize this binary? I have a use and was looking at the steps of creating one when I saw that you are making python packages for many of your rust implementations.

Thanks!

@urschrei
Copy link
Owner

I don't think so, because https://shapely.readthedocs.io/en/latest/manual.html#polylabel exists already. The only reason to use the Rust version is performance, since the Shapely Polylabel is a pure Python implementation.

@elocke
Copy link
Author

elocke commented Dec 23, 2019

Wow, prompt reply! Thanks!

The only reason to use the Rust version is performance, since the Shapely Polylabel is a pure Python implementation.

This would be why I'm currently searching for a low-level implementation.

@urschrei
Copy link
Owner

Ah, gotcha. One thing you could do (before I build a wheel, which will be post-Christmas), is use the existing Python implementation at https://github.com/urschrei/polylabel-rs/blob/master/ffi.py.

  1. Clone the repo
  2. Install Rust using rustup.rs
  3. cd into the repo
  4. Create a virtualenv inside, activate it, and install Shapely.
  5. Run cargo build --release
  6. Still in the repo, write a Python script that processes your Polygons – just have a from ffi import label_position line, and call label_position(polygon, tolerance) on each one.

It's not the most robust solution, especially if you need to run on a server, but for locally processing your geometries it should do just fine. Let me know if you need a wheel, but it'll most likely be the weekend before I get to it.

@elocke
Copy link
Author

elocke commented Dec 23, 2019

Oh nice, I'll give it a shot at this problem I'm currently experiencing. Shouldn't be too hard to add to my Dockerfile. I would absolutely appreciate a wheel at some point in the future. Thanks again for the fast (and detailed) response!

@urschrei
Copy link
Owner

No prob – doing it in Docker might be annoying, so ping me if you need a wheel.

@elocke
Copy link
Author

elocke commented Dec 23, 2019

Yeah, I can't have this in my production containers (security) so at some point it will be required, perhaps after the holiday. This is my first time working with Rust, and it's making want to dig in more.

@elocke
Copy link
Author

elocke commented Jan 5, 2020

I've run some tests using the ffi module directly and it is a great improvement over the Shapely methods. A wheel would definitely be the next step. Any idea of when you could do that? Thanks!

@elocke
Copy link
Author

elocke commented Mar 31, 2020

Just an update: I ended up hacking up a solution to bake a wheel locally for my container. I used your simplification python package as an example. I'll shoot ya an email to see where you want to go from here. Thanks!

@ahirner
Copy link

ahirner commented Jan 9, 2022

@elocke You might find https://github.com/MoonVision/polylabel-pyo3 helpful. It supports exterior only for now.

@urschrei
Copy link
Owner

urschrei commented Jan 9, 2022

@ahirner This is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants