Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions .github/workflows/pip4linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: ["3.8",
"3.9",
python-version: ["3.9",
"3.10",
"3.11",
"3.12",
"3.13",]
"3.13",
"3.14"]

runs-on: ${{ matrix.platform }}

Expand All @@ -37,9 +37,20 @@ jobs:
- name: Update requirements
run: |
python -m pip install --upgrade pip
pip install pybind11 setuptools wheel twine
pip install pybind11 setuptools wheel twine auditwheel

- name: Build and install for linux
run: |
cd python
python setup.py bdist_wheel --plat-name manylinux2014_x86_64
auditwheel repair dist/*.whl --wheel-dir auditwheel_dist

- name: Upload to pypi when release
if: github.event_name == 'release' && github.event.action == 'published'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PYCGRAPH_TOKEN }}
run: |
cd python
twine check dist/*
twine upload --verbose --skip-existing dist/*
3 changes: 2 additions & 1 deletion .github/workflows/pip4mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
"3.10",
"3.11",
"3.12",
"3.13",]
"3.13",
"3.14"]

runs-on: ${{ matrix.platform }}

Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pip4win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ jobs:
"3.10",
"3.11",
"3.12",
"3.13"]
"3.13",
"3.14"]

runs-on: ${{ matrix.platform }}

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ message("* * * * * * * * * * * * * * * * * * * * * * * * * * * * *")

cmake_minimum_required(VERSION 3.5.0)

project(CGraph VERSION 3.2.0)
project(CGraph VERSION 3.2.1)

if(NOT DEFINED CMAKE_CXX_STANDARD)
# CGraph默认使用C++11版本,推荐使用C++17版本。暂不支持C++11以下版本
Expand Down
18 changes: 9 additions & 9 deletions COMPILE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@
---

### Python 版本
* MacOS 和 Windows 用户可以通过命令安装(推荐)
* 通过`pip`命令安装(推荐)
```shell
$ pip3 install PyCGraph # 直接通过 pip3 安装
$ python3 -c "import PyCGraph" # 验证 PyCGraph 成功安装
$ pip3 install pycgraph # 直接通过 pip3 安装
$ python3 -c "import pycgraph" # 验证 pycgraph 成功安装
```

* 通过源码安装(Linux/MacOS/Windows),使用前需要提前安装`python3` `pybind11`和`setuptools`
Expand All @@ -92,21 +92,21 @@
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph/python # 进入对应文件夹
$ python3 setup.py bdist_wheel # 生成 *.whl 安装包
$ pip3 install dist/PyCGraph-xxx.whl # 安装 *.whl 安装包,xxx 信息与版本和系统有关
$ python3 tutorial/T00-HelloCGraph.py # 运行T00-HelloCGraph.py,并且在终端输出 Hello, PyCGraph.
$ pip3 install dist/pycgraph-xxx.whl # 安装 *.whl 安装包,xxx 信息与版本和系统有关
$ python3 tutorial/T00-HelloCGraph.py # 运行T00-HelloCGraph.py,并且在终端输出 Hello, pycgraph.
```
* 本地直接安装
```shell
$ git clone https://github.com/ChunelFeng/CGraph.git
$ cd CGraph/python # 进入对应文件夹
$ python3 setup.py install # 安装 PyCGraph
$ python3 tutorial/T00-HelloCGraph.py # 运行T00-HelloCGraph.py,并且在终端输出 Hello, PyCGraph.
$ python3 setup.py install # 安装 pycgraph
$ python3 tutorial/T00-HelloCGraph.py # 运行T00-HelloCGraph.py,并且在终端输出 Hello, pycgraph.
```

* 通过uv安装(Linux/MacOS/Windows)
```shell
$ uv init cgraph_env # 通过uv 创建一个名为 cgraph_env 的环境
$ cd cgraph_env
$ uv add "pycgraph @ git+https://github.com/ChunelFeng/CGraph.git@main#subdirectory=python" --marker "sys_platform == 'linux'" # 添加PyCGraph依赖
$ python3 -c "import PyCGraph" # 验证 PyCGraph 成功安装
$ uv add "pycgraph @ git+https://github.com/ChunelFeng/CGraph.git@main#subdirectory=python" --marker "sys_platform == 'linux'" # 添加 pycgraph 依赖
$ python3 -c "import pycgraph" # 验证 pycgraph 成功安装
```
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href="https://github.com/ChunelFeng/CGraph"><img src="https://badgen.net/badge/os/MacOS,Linux,Windows/cyan?list=1" alt="os"></a>
<a href="https://github.com/ChunelFeng/CGraph/stargazers"><img src="https://badgen.net/github/stars/ChunelFeng/CGraph?color=cyan" alt="stars"></a>
<a href="https://github.com/ChunelFeng/CGraph/network/members"><img src="https://badgen.net/github/forks/ChunelFeng/CGraph?color=cyan" alt="forks"></a>
<a href="https://badge.fury.io/py/PyCGraph"><img src="https://badge.fury.io/py/PyCGraph.svg" alt="pypi"></a>
<a href="https://badge.fury.io/py/pycgraph"><img src="https://badge.fury.io/py/pycgraph.svg" alt="pypi"></a>
<a href="https://pepy.tech/projects/pycgraph"><img src="https://static.pepy.tech/personalized-badge/pycgraph?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=pypi+downloads" alt="PyPI Downloads"></a>
<a href="https://www.codefactor.io/repository/github/chunelfeng/cgraph/overview/main"><img src="https://www.codefactor.io/repository/github/chunelfeng/cgraph/badge/main" alt="CodeFactor" /></a>
</p>
Expand All @@ -30,7 +30,7 @@
![CGraph Skeleton](https://github.com/ChunelFeng/CGraph/blob/main/doc/image/CGraph%20Skeleton.jpg)
<br>

本工程使用纯C++11标准库编写,无任何第三方依赖,兼容`MacOS`、`Linux`、`Windows`和`Android`系统。支持本地编译和二次开发,并且提供`Python`版本:`PyCGraph`。编译和安装方法,请参考 [CGraph 编译说明](https://github.com/ChunelFeng/CGraph/blob/main/COMPILE.md ) <br>
本工程使用纯C++11标准库编写,无任何第三方依赖,兼容`MacOS`、`Linux`、`Windows`和`Android`系统。支持本地编译和二次开发,并且提供`Python`版本:`pycgraph`。编译和安装方法,请参考 [CGraph 编译说明](https://github.com/ChunelFeng/CGraph/blob/main/COMPILE.md ) <br>

详细功能介绍和用法,请参考 [一面之猿网](http://www.chunel.cn/) 中的文章内容。相关视频在B站持续更新中,欢迎观看和交流:<br>
* [【B站视频】CGraph 入门篇](https://www.bilibili.com/video/BV1mk4y1v7XJ) <br>
Expand Down Expand Up @@ -101,7 +101,7 @@ int main() {
import time
from datetime import datetime

from PyCGraph import GNode, GPipeline, CStatus
from pycgraph import GNode, GPipeline, CStatus


class MyNode1(GNode):
Expand Down Expand Up @@ -411,8 +411,9 @@ if __name__ == '__main__':
* 优化 `message` 功能
* 优化 `aspect` 功能

[2025.11.02 - v3.2.0 - Chunel]
[2025.11.08 - v3.2.1 - Chunel]
* 提供 本地保存和加载 功能
* 修改 `PyCGraph` 为 `pycgraph`,支持 `pip3 install pycgraph` 安装

</details>

Expand Down
2 changes: 1 addition & 1 deletion README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href="https://github.com/ChunelFeng/CGraph"><img src="https://badgen.net/badge/os/MacOS,Linux,Windows/cyan?list=1" alt="os"></a>
<a href="https://github.com/ChunelFeng/CGraph/stargazers"><img src="https://badgen.net/github/stars/ChunelFeng/CGraph?color=cyan" alt="stars"></a>
<a href="https://github.com/ChunelFeng/CGraph/network/members"><img src="https://badgen.net/github/forks/ChunelFeng/CGraph?color=cyan" alt="forks"></a>
<a href="https://badge.fury.io/py/PyCGraph"><img src="https://badge.fury.io/py/PyCGraph.svg" alt="pypi"></a>
<a href="https://badge.fury.io/py/pycgraph"><img src="https://badge.fury.io/py/pycgraph.svg" alt="pypi"></a>
<a href="https://pepy.tech/projects/pycgraph"><img src="https://static.pepy.tech/personalized-badge/pycgraph?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=pypi+downloads" alt="PyPI Downloads"></a>
<a href="https://www.codefactor.io/repository/github/chunelfeng/cgraph/overview/main"><img src="https://www.codefactor.io/repository/github/chunelfeng/cgraph/badge/main" alt="CodeFactor" /></a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion python/PyCGraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using namespace CGraph;
namespace py = pybind11;

PYBIND11_MODULE(PyCGraph, cg) {
PYBIND11_MODULE(pycgraph, cg) {
cg.doc() = "CGraph with python api, github: https://github.com/ChunelFeng/CGraph";

py::class_<UThreadPoolConfig>(cg, "UThreadPoolConfig")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ for file in *.py; do
echo " "
done

echo -e "\033[34m congratulations, automatic run PyCGraph tutorials finish... \033[0m"
echo -e "\033[34m congratulations, automatic run pycgraph tutorials finish... \033[0m"
2 changes: 1 addition & 1 deletion python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools", "wheel", "pybind11"]
build-backend = "setuptools.build_meta"

[project]
name = "PyCGraph"
name = "pycgraph"
dynamic = ["version", "description", "authors", "license", "readme", "requires-python", "keywords", "classifiers"]

dependencies = [
Expand Down
4 changes: 2 additions & 2 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from setuptools import setup, Extension
import pybind11

__PYCGRAPH_NAME__ = "PyCGraph"
__PYCGRAPH_VERSION__ = "3.2.0"
__PYCGRAPH_NAME__ = "pycgraph"
__PYCGRAPH_VERSION__ = "3.2.1"
__PYCGRAPH_AUTHOR__ = "Chunel"
__PYCGRAPH_AUTHOR_EMAIL__ = "chunel@foxmail.com"
__PYCGRAPH_DESCRIPTION__ = "CGraph with python api wrapper by pybind11"
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGAspect/MyConnApsect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GAspect, CStatus
from pycgraph import GAspect, CStatus

class MyConnAspect(GAspect):
def __init__(self, ip: str, port: int):
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGAspect/MyTimerAspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import time

from PyCGraph import GAspect, CStatus
from pycgraph import GAspect, CStatus

class MyTimerAspect(GAspect):
_start_time = None
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGCondition/MyCondition.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GCondition
from pycgraph import GCondition

class MyCondition(GCondition):
def choose(self):
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGCondition/MyParamCondition.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""


from PyCGraph import GCondition, GElementRelation
from pycgraph import GCondition, GElementRelation

from MyParams.MyParam import MyParam

Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGDaemon/MyMonitorDaemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GDaemon
from pycgraph import GDaemon

from MyParams.MyParam import MyParam

Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGEvent/MyPrintEvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import time

from PyCGraph import GEvent
from pycgraph import GEvent

class MyPrintEvent(GEvent):
_times: int = 0
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGMutable/MyMutable.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from typing import List

from PyCGraph import GMutable, CStatus, GElement
from pycgraph import GMutable, CStatus, GElement

from MyParams.MyParam import MyParam

Expand Down
4 changes: 2 additions & 2 deletions python/tutorial/MyGNode/HelloCGraphNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
@Desc:
"""

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

class HelloCGraphNode(GNode):
def run(self):
print("Hello, PyCGraph.")
print("Hello, pycgraph.")
return CStatus()
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyEventNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from datetime import datetime

from PyCGraph import GNode, CStatus, GEventType
from pycgraph import GNode, CStatus, GEventType

class MyEventNode(GNode):
def run(self):
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyHoldNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

from MyParams.MyParam import MyParam

Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyMatchNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import time
from datetime import datetime

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

from MyParams.MyParam import MyParam

Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyNode1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import datetime
import time

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

class MyNode1(GNode):
def run(self):
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyNode2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from datetime import datetime
import time

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

class MyNode2(GNode):
def init(self):
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyReadParamNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

from MyParams.MyParam import MyParam

Expand Down
3 changes: 2 additions & 1 deletion python/tutorial/MyGNode/MyStageNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
import time
from datetime import datetime

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus


class MyStageNode(GNode):
def __init__(self, before: int, after: int):
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyGNode/MyTemplateNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus


class MyTemplateNode(GNode):
Expand Down
3 changes: 1 addition & 2 deletions python/tutorial/MyGNode/MyWriteParamNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
@Desc:
"""


from PyCGraph import GNode, CStatus
from pycgraph import GNode, CStatus

from MyParams.MyParam import MyParam

Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/MyParams/MyParam.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GParam, CStatus
from pycgraph import GParam, CStatus

class MyParam(GParam):
value = 0
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/T00-HelloCGraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GPipeline
from pycgraph import GPipeline

from MyGNode.HelloCGraphNode import HelloCGraphNode

Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/T01-Simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GPipeline, CStatus
from pycgraph import GPipeline, CStatus

from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/T02-Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GPipeline, GCluster
from pycgraph import GPipeline, GCluster

from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
Expand Down
2 changes: 1 addition & 1 deletion python/tutorial/T03-Region.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@Desc:
"""

from PyCGraph import GPipeline, GRegion
from pycgraph import GPipeline, GRegion

from MyGNode.MyNode1 import MyNode1
from MyGNode.MyNode2 import MyNode2
Expand Down
Loading
Loading