sparckles / Robyn

Robyn is a Super Fast Async Python Web Framework with a Rust runtime.
https://robyn.tech/
BSD 2-Clause "Simplified" License
4.46k stars 231 forks source link

Docs: Readme: To Develop Locally #1000

Closed dave42w closed 2 weeks ago

dave42w commented 4 weeks ago

Setting up Robyn locally to prepare for contributions. Testing the documentation in the README.md details below

Preliminary conclusions

I started with this toolchain on Debian 12:

I used this variation of the readme instructions:

[tool.poetry] section not found in /home/dave/Code/Robyn/pyproject.toml

Therefore I copied the entire pyproject.toml from gitub.

uv run poetry install --with dev --with test warning: No requires-python value found in the workspace. Defaulting to >=3.13. error: Failed to prepare distributions Caused by: Failed to download and build uvloop==0.19.0 Caused by: Build backend failed to build wheel through build_wheel (exit status: 1) ...

I figure this is due to Python 3.13.0 so

uv python pin 3.12.7

Also edited `.python-version` to contain `3.12.7`
Try again:

uv run poetry install --with dev --with test Using CPython 3.12.7 Removed virtual environment at: .venv Creating virtual environment at: .venv warning: No requires-python value found in the workspace. Defaulting to >=3.12. error: Failed to prepare distributions Caused by: Failed to build robyn @ file:///home/dave/Code/Robyn Caused by: Build backend failed to build editable through build_editable (exit status: 1)

[stdout] Running maturin pep517 build-wheel -i /home/dave/.cache/uv/builds-v0/.tmpEU1nmd/bin/python --compatibility off --editable

[stderr] 💥 maturin failed Caused by: Can't find Cargo.toml (in /home/dave/Code/Robyn) Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/home/dave/.cache/uv/builds-v0/.tmpEU1nmd/bin/python', '--compatibility', 'off', '--editable'] returned non-zero exit status 1

So I created a Caro.toml copied from github then

uv run poetry install --with dev --with test warning: No requires-python value found in the workspace. Defaulting to >=3.12. error: Failed to prepare distributions Caused by: Failed to build robyn @ file:///home/dave/Code/Robyn Caused by: Build backend failed to build editable through build_editable (exit status: 1)

[stdout] Running maturin pep517 build-wheel -i /home/dave/.cache/uv/builds-v0/.tmpLOg0kR/bin/python --compatibility off --editable

[stderr] 💥 maturin failed Caused by: Cargo metadata failed. Does your crate compile with cargo build? Caused by: cargo metadata exited with an error: error: failed to parse manifest at /home/dave/Code/Robyn/Cargo.toml

Caused by: can't find library robyn, rename file to src/lib.rs or specify lib.path Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/home/dave/.cache/uv/builds-v0/.tmpLOg0kR/bin/python', '--compatibility', 'off', '--editable'] returned non-zero exit status 1 dave@geeky:~/Code/Robyn$ cargo build error: failed to parse manifest at /home/dave/Code/Robyn/Cargo.toml

Caused by: can't find library robyn, rename file to src/lib.rs or specify lib.path

sansyrox commented 2 weeks ago

Hey @dave42w 👋

Thanks , will do now

dave42w commented 2 weeks ago

Hey @dave42w 👋

Thanks , will do now

Thanks!

The upgrade to poetry.lock has helped me.

uv is absolutely awesome.

Upgrades to more recent packages would help as well eg pytest

sansyrox commented 2 weeks ago

No worries. I'll probably not update to uv in this PR. (I love uv but will be a lot of work for a small PR(happy to accept PRs 😄 )) I will make another issue for it.

dave42w commented 2 weeks ago

No worries. I'll probably not update to uv in this PR. (I love uv but will be a lot of work for a small PR(happy to accept PRs 😄 )) I will make another issue for it.

Sorry, I agree. uv for everyone would be a big step. Just the steps to make it easier to use newer python with newer packages and remove blockages to uv would be great.

I'd also really appreciate adding a section to cover using a customer build of robyn in your own project. Once you build a Robyn with some changes (maybe testing someone else's PR) how do you move beyond Robyns own unit and integration tests to use that version of Robyn in your own project.

Thanks

sansyrox commented 2 weeks ago

I'd also really appreciate adding a section to cover using a customer build of robyn in your own project. Once you build a Robyn with some changes (maybe testing someone else's PR) how do you move beyond Robyns own unit and integration tests to use that version of Robyn in your own project.

@dave42w , I don't really get it. Can you explain a bit more?

dave42w commented 2 weeks ago

I'd also really appreciate adding a section to cover using a customer build of robyn in your own project. Once you build a Robyn with some changes (maybe testing someone else's PR) how do you move beyond Robyns own unit and integration tests to use that version of Robyn in your own project.

@dave42w , I don't really get it. Can you explain a bit more?

Sorry I was unclear.

I have a directory with a clone of github Robyn in it. I make changes and complete the steps to the point where it passes all the tests.

Now I want to use that personal, updated version of Robyn in my own project which is in a different directory/github repository.

What steps do I need to do to replace the released version of Robyn in my project (installed with uv add robyn) with the version that is in the target directories where I have just run the tests?

Does that make more sense?

Oh wow. Is it as simple as

uv add ../Robyn/target/wheels/robyn-0.63.0-cp312-cp312-linux_x86_64.whl 

I assumed that with the rust stuff it would be more complicated

sansyrox commented 2 weeks ago

No , lol. I thought this was well known. You can use a regular pip install as well

I will add it in the docs