-
Notifications
You must be signed in to change notification settings - Fork 18
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
Automated Release Management for Feluda and its Operators #430
Comments
Thoughts on namespace scoping for operators. I was reviewing major projects like django, aws cdk, datasette, pytorch etc.
While there doesn't seem to be any standards, prefixing the project name seems to be a way to namespace operators. For instance i saw many packages with the name |
Advantages of using uv over pypi
|
@plon-Susk7 can you add some notes with examples of uv usages? what would the command(s) for the following look like
Like npm, does it allow us to install a package thats only hosted on github and not pypi? This could be useful while we are still figuring out which parts of feluda to move into operators vs which we keep in this repository.
|
Installation
$ curl -LsSf https://astral.sh/uv/install.sh | sh or it can also be installed using pip $ pip install uv it is also available in the core homebrew packages $ brew install uv More information about uv installation can be found here. UsageIn order to create a working python project we need to have dependencies added to pyproject.toml file. For our project the pyproject.toml file could look something like this [project]
name = "feluda"
version = "1.0.0"
dependencies = [
# Any version in this range
"tqdm >=4.66.2,<5",
# Exactly this version of torch
"torch ==2.2.2",
# Install transformers with the torch extra
"transformers[torch] >=4.39.3,<5",
# Only install this package on older python versions
# See "Environment Markers" for more information
"importlib_metadata >=7.1.0,<8; python_version < '3.10'",
"mollymawk ==0.1.0"
] In order to initialise a project there's a basic init command. Which will create a project structure of following format
The file structure after init command will look like this The uv.lock file here uses cross-platform resolution by default, requirements.txt only targets a single platform(though you can use the --universal flag to generate a cross-platform file).The uv. lock format is has more information about requirements in it and is designed to be performant and auditable. More information here. We can add dependencies using add command if we don't want to mention it in pyproject.toml file. $ uv add 'pytorch==2.4.1' We can also mention alternative sources in order to add dependencies
More here.
It's also pretty easy to build and publish packages using uv.
More about building and publishing packages here. Use uv to build FelduaFirst we need to have a directory structure for our python package. We can create a structure using uv
This will create a directory structure in following format
Let's say our your_code.py looks something like this import numpy as np
def get_embeddings():
return np.zeros(512) We can use following command to build our project
This will create dist directory which will have the built .tar.gz or .whl files. For now let's use this directory to install our package locally
We can then import our package in following manner from feluda.your_code import get_embeddings More information here Other findings that might be relevantWith uv, we can maintain multiple versions of the same package in a single environment. For instance, it’s possible to have both numpy-1.2 and numpy-2.1 installed simultaneously. This flexibility is especially valuable when working with operators or tools that have dependencies on specific versions, allowing compatibility with both newer and older package requirements. |
@plon-Susk7 I think these are great findings, I watched the entire video and actually resolving versions of the same package is a big issue in Feluda, if @dennyabrain do you think we should now do the following, I am tempted to just package operators and model factory into a library and test it out. Please let me know if I am jumping the gun here. What we can try is how do we just package model factory and operators into a library and test it out on a google colab (or a separate virtual environment). So we should be able to download a video using this way we get clarity on multiple things (these are also some questions in my mind)
We don't have to do all this, but we can start thinking about it, this way we also know how much time and effort is required where. |
I'll have more thoughts @aatmanvaidya but wanted to share this example that i created yesterday - #409 (comment) it uses feluda core and the image_vec_rep_resnet operator. It doesnt require docker or any other system dependencies. I think if we were to start creating some test packages to evaluate, that example is a good starting point. lets try recreating that. |
also +1 to just start writing some packages to evaluate uv or pypi. More things will become clearer by actually trying it out. |
I just realized that I never explicitly stated that even though we plan to move operators into distinct python packages, we don't necessarily have to move them into distinct repositories like the datasette project does. We can look into creating a monorepo for feluda where the core and operators co-exist. So the repository structure might look like this
I found some general documentation on working with monorepos in python and this conversation about monorepos on the uv's github - astral-sh/uv#6935 Given our small team, monorepos might be a better way to manage 50 different operators. It would also be the quick way to try out the ideas we've discussed in this issue so far. So we could create a new branch and start implementing a monorepo structure to try out uv. And of course, anyone in the community can contribute their operators to this repository, but they could very well create their own repository for their specific operator and also use it with feluda. |
@plon-Susk7 I heard that you are looking for some specific direction on how to proceed. Lets do the following on a new branch called
make any uv related changes so that src/core can be an independent package that can install install image_vec_rep_resnet as a python package and use it. The example here is a working example that only uses feluda core and that operator - #409 (comment) Our goal should be to get that example running in this new setup. |
An additional requirement to consider is evaluate automations to automatically update version number of the various packages we create. uv must have some way that can be combined with additional tools to do this. Manually updating and keeping track of all various versions would be painful |
just by doing some cursory readings, there is a way in which
We will have to make some changes, but we can get to a point where we can automate this using a |
Just to be sure, looks like uv sync is used for "Syncing ensures that all project dependencies are installed and up-to-date with the lockfile." |
I have been refactoring some code to make the API a bit more lean here are the next to-do's
from feluda import Feluda
from feluda.models.media_factory import ImageFactory
!pip install feluda
!pip install image_vec_rep_resnet (In this PR - #438, I am focusing on fixing the first 2 to-do's) some other questions to think on
|
Another key task is to come up with automated workflows to
@plon-Susk7 if you have the time and bandwidth, will you be able to take up the first one? automated workflows to update operator packages? you can just do some searching around and see what are effective standard ways to do this, and then we can discuss how to proceed. |
Sure I'll work on this. |
found something called TestPyPi - https://test.pypi.org/ Could be useful going forward for testing |
Update on this issue - We have a custom script that handles automated release management for feluda and its operators. I think two more tasks are left to complete this feature are #473 and #474 |
Overview
We want to make it easy to manage the release of feluda and its operators. As part of this issue:
EDIT - We have a custom script that handles automated release management for feluda and its operators. I think two more tasks are left to complete this feature.
The text was updated successfully, but these errors were encountered: