Skip to content

chore(python): support uv dependency management in cgraph#544

Merged
ChunelFeng merged 7 commits intoChunelFeng:mainfrom
weijinglin:uv/dev
Sep 12, 2025
Merged

chore(python): support uv dependency management in cgraph#544
ChunelFeng merged 7 commits intoChunelFeng:mainfrom
weijinglin:uv/dev

Conversation

@weijinglin
Copy link
Copy Markdown
Contributor

How to integrate CGraph with uv

Add the following command inn your pyproject.toml file (configuration file in uv ecosystem) under [tool.uv.sources] section

pycgraph = { git = "https://github.com/ChunelFeng/CGraph.git", subdirectory = "python", rev = "branch_support_uv", marker = "sys_platform == 'linux'"  }

With this configuration, uv will download the source from GitHub on linuxOS, and fall back to PyPI on all other platforms.
After declaring the target source of pycgraph, you need declare the pycgraph as a dependency of your project.

@ChunelFeng
Copy link
Copy Markdown
Owner

can u show the result in your branch? Or give a example how to install PyCGraph in linux with this?

@weijinglin
Copy link
Copy Markdown
Contributor Author

weijinglin commented Sep 10, 2025

Of course, I have tested on my machine (ubuntu 24). Test on mac & windows is necessary. I will introduce the example in the following section.

uv init example-graph # init a new virtual environment

cd example-graph

uv add "pycgraph @ git+https://github.com/ChunelFeng/CGraph.git@main#subdirectory=python" --marker "sys_platform == 'linux'" # use this commond to add pycgraph as a dependency, and we can replace the repo url and branch configuration if this pr is merged

uv sync

then, we edit the main.py generated by uv

from PyCGraph import GPipeline, GNode, CStatus

class HelloCGraphNode(GNode):
    def run(self):
        print("Hello, PyCGraph.")
        return CStatus()

def tutorial_hello_cgraph():
    pipeline = GPipeline()
    pipeline.registerGElement(HelloCGraphNode())
    pipeline.process()


if __name__ == '__main__':
    tutorial_hello_cgraph()

At last, we run the main.py scripts to test basic functionality

expected output: Hello, PyCGraph.

@ChunelFeng
Copy link
Copy Markdown
Owner

thank you

@ChunelFeng ChunelFeng merged commit 04fc967 into ChunelFeng:main Sep 12, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants