Skip to content

setup uv python package and environment management #64

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

Open
5 tasks
VigneshVSV opened this issue Apr 4, 2025 · 8 comments · May be fixed by #70
Open
5 tasks

setup uv python package and environment management #64

VigneshVSV opened this issue Apr 4, 2025 · 8 comments · May be fixed by #70
Assignees
Labels
beginner beginner level good first issues, usually issues that can worked on without skimming the whole repo good first issue Good for newcomers

Comments

@VigneshVSV
Copy link
Collaborator

VigneshVSV commented Apr 4, 2025

uv seems to deliver on its promises of speed and efficiency and looks like the npm alternative for python.

Especially for unittests to be run locally, it can be useful to provide a environment that can be setup fast.

Rough steps:

  • add all dependencies to uv which will also move setup.py to pyproject.toml (make sure all info is copied from setup.py)
  • generate uv.lock file, ensure that venv is setup in the same folder as project (but is git-ignored)
  • ensure tests run by uv run <something>
  • if examples are supported, that is even better (at least for the simulations)
  • publish with uv
@VigneshVSV VigneshVSV added enhancement help wanted Extra attention/extra information is needed good first issue Good for newcomers beginner beginner level good first issues, usually issues that can worked on without skimming the whole repo and removed beginner beginner level good first issues, usually issues that can worked on without skimming the whole repo labels Apr 4, 2025
@EstebanGZam
Copy link

Hi @VigneshVSV,

I'm interested in working on this issue. Although I haven't used uv before, I've been doing some research and would like to contribute.

To ensure I do this correctly:

  1. Is there any internal guidance on how to handle dependencies in the project?
  2. Do you prefer the pyproject.toml to use setuptools or another backend?
  3. Should I include any specific tests to validate the new workflow with uv?

My plan would be:

  1. Study the current setup.py configuration.
  2. Migrate the metadata to pyproject.toml following PEP standards.
  3. Document each change to facilitate review.

Do you think this approach is appropriate? I'd appreciate any initial guidance.

Regards,
Esteban

@VigneshVSV
Copy link
Collaborator Author

VigneshVSV commented Apr 7, 2025

Hi @EstebanGZam ,

Thanks for taking the time. I have also worked with uv only once!

Also, if you are coming here from google summer of code, I would like to emphasise that this project is not a part of eclipse foundation.

To answer your questions:

  1. No currently there is no internal guidance to handle project dependencies. The idea is to simply provide a working set of dependencies so that its not difficult to get started or if anything is not working, they could just use these dependencies to setup a local venv. May be a few lines in the README stating "How to use the uv environment for your own project" would be great!

I assume this might also involve copying some uv files/pyproject.toml to their own project? If yes, one could document that as well in README. Locally within the github repo, these uv workflow run tests, build & publish the package. For other projects that depend on this project, the files can also be copied or even better is to provide a command that could be run to setup an environment for other projects (a global one or semi-global one similar to anaconda).

  1. setuptools is sufficient. I am also not aware of the benefits/disadvantages of others. Did you have anything in mind?

  2. Instead of testing uv with separate tests, a command like uv run tests for the unit tests in tests folder would be great! (preferably with a starting point where nothing is installed) We also know then, that the tests can be run from uv and also uv is working. The more ideal integration would be to update the CI pipelines with uv. You could have a look at it .github folder. Whereever python's build and publish processes are used, uv can be replaced there. There is a job with this we can test this: this one
    Just update the minor version to 0.2.11 and we can try this job.

I would be happy to cover points 1,2,3 & 5 for this (stated in issue description, not this comment). If you would like to do point 4, you could initialize the examples git submodule and try it. If its difficult, we can branch into a issue when more clarity comes.

Thanks a lot again!

@VigneshVSV
Copy link
Collaborator Author

If you like Javascript/React, you can also look at some issues here in a related project - https://github.com/hololinked-dev/thing-control-panel/issues

@VigneshVSV
Copy link
Collaborator Author

VigneshVSV commented Apr 7, 2025

Also, you could set the author as hololinked contributors/Vignesh Vaidyanathan .

To run the tests, without uv, to see if they are passing (which it will):

cd tests
python -m unittest

Just FYI, I also pulled the examples to latest commits for your convenience in the main branch.

cd examples\server-examples\simulations

and try setting up the dependencies to work for them if possible.

Of course trying this is optional for now. Moreover, it would be nice if the dependencies for the examples are only a further addition to the main dependencies of the package. For example, numpy is used in many dependencies in examples, but its not a main dependency for the package. Therefore it would be nice if its an optional dependency and the user is given some options which dependencies to install.

I dont exactly know how to do all this. So just feel free to explore and stop when its getting too much!

@EstebanGZam
Copy link

Hi @VigneshVSV,

Thank you for your patience. To ensure I contribute effectively, I'd like to clarify which specific part of issue #64 I should work on, as there's information across multiple messages and I want to avoid duplication.

My current understanding:

  1. You'll handle:

    • Migrating setup.pypyproject.toml (point 1)
    • Generating uv.lock and setting up .venv (point 2)
    • Implementing uv run tests (point 3)
    • Publishing with UV (point 5)
  2. My potential role:

    • Point 4 (examples/simulations), but I'm unsure if this is the priority or if you'd prefer me to assist elsewhere.

Key question:

  • Should I focus exclusively on point 4, or is there another area where you need help?

Best regards,
Esteban

@VigneshVSV
Copy link
Collaborator Author

VigneshVSV commented Apr 7, 2025

Hi @EstebanGZam,

Sorry when I said "I would be happy to cover...", I didnt try to mean that I will work on the issue.

I meant that, for this issue, if you work on points 1, 2, 3 and 5, that would be sufficient, and would be already great for the project!
So this issue is yours.

@EstebanGZam
Copy link

Ah, perfect. Sorry for the misunderstanding. I'll get to work on the issue right away.

@VigneshVSV
Copy link
Collaborator Author

Starting this week, I am doing developer meetings to kick start a community of contributors. Feel free to hop in those meetings to ask me any questions directly or carry out any discussion related to issues.

You can find info on the hololinked-dev organisation (top left).

Of course, there is no active participation now but I will be doing some heavy marketing in a 2-3 months once my develop branch is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginner beginner level good first issues, usually issues that can worked on without skimming the whole repo good first issue Good for newcomers
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

2 participants