Saravanan666/pypi-org huggingface dataset:
Package: pygrape
# pygrape[![Build Status](https://travis-ci.org/Leviathan1995/pygrape.svg?branch=master)](https://travis-ci.org/Leviathan1995/pygrape)[![PyPI version](https://badge.fury.io/py/pygrape.svg)](https://badge.fury.io/py/pygrape)pygrape is a python library for updating terminal output in realtime### Usage```pythonpip3 instlal pygrape```### Example```pythonfrom pygrape import pygrapedef main():writer = pygrape(0.05)print("Downloading pygrape.whl (2 MB)")bar = "█"for i in range(101):time.sleep(0.05)if i % 2 == 0:bar += "█"writer.writer(" " + str(i) + "% |" + bar + "|")writer.flush()writer.stop()```#### Result![gif](https://github.com/Leviathan1995/pygrape/blob/master/doc/HD.gif)### LicenseMIT
Package: pygraph-cli
# pygraphpygraph is an extremely simple CLI tool for using graphviz. It takes a file to write to andadjacency list to construct the graph from. The intended use case is for generatingsmall graphs to embed in things like homework problems. The API is documented via the `--help`option## Examples```bashpygraph -d tree ab ac bd bepygraph -u -e neato circle ab bc cd de eapygraph -d -n "Sample Tree" labeled-tree root-left:1 root-right:1 left-child:4 right-child:3 root-root:0```![tree](examples/tree.png)![circle](examples/circle.png)![labeled-tree](examples/labeled-tree.png)## Usage```bash$ pygraph --helpUsage: pygraph [OPTIONS] FILE EDGES...Options:-e, --engine [dot|neato|twopi|circo|fdp|sfdp|patchword|osage]Choose layout engine to use-u, --undirected / -d, --directedSpecify undirected or directed edges--format TEXT                   Image format-n, --name TEXT                 Name of graph in image--dot                           Preserve the source dot file--no-vertex-labels              Don't label vertex labels--help                          Show this message and exit.```### Installation```bashpip install pygraph-cli```### Syntax* First argument is file to save to without extension* Pairs of single characters after are interpreted as creating an edge between the them (eg: `ab ac cd`)* Nodes can have any name when separated by `-` (eg: `root-child`)* To label the edge, append `:` and any text (eg: `root-child:label`)* Name the image by passing `-n` option* To keep the original dot source, pass `--dot`
Package: pygraphdb
graphdb介绍python 连接 graphdb 数据库的包功能一、数据管理
    1. 通过执行SPARQL语句就可查询和更新Graph数据库
    2. 下载数据并保存
    3. 上传数据
    4. 删除所有的节点数据

二、数据库管理
    1. 获取现有的repository列表
    2. 删除现有的repository
    3. 创建一个repository
    4. 重启现有的repository
    5. 获取现有的repository size安装教程pip install pygraphdb快速上手1. 导入包

import pygraphdb

2. 数据库 config

host = '0.0.0.0'
port = '7200'
db_name = 'db_name'
user = 'admin'
password = 'password'

3. sparql 语句(例)

sparql = "PREFIX disease_type_iri:<http://schema.omaha.org.cn/property/> " \
     "select distinct ?x ?y where { ?x disease_type_iri:Alternatename ?y .}"
     
4. 连接数据库

db = pygraphdb.connect(host=host, port=port, user=user, password=password, db=db_name)

5. 获取 cursor

cur = db.cursor()

6. 执行sparql语句，得到结果

result = cur.execute(sparql)

7. 打印结果

print(result)

8. 关闭 cursor

cur.close()

9. 关闭数据库

db.close()使用with连接1.第一种方式

with pygraph.connect(host, port, user, password, db) as db2:
    #获取 cursor
    cur2 = db2.cursor()
    #执行sparql语句，得到结果
    result2 = cur2.execute(sparql)
    cur2.close()
    print(result2)

2.第二种方式

db3 = pygraph.connect(host, port, db, user, password, db)
with db3.cursor() as cur3:
    result3 = cur3.execute(sparql)
    print(result3)
db3.close()数据管理import pygraphdb

host = '0.0.0.0'
port = '7200'
db_name = 'db_name'
user = 'admin'
password = 'password'

db = pygraphdb.connect(host, port, user, password, db_name)

cur = db.cursor()

"""
执行查询语句
"""
r = cur.execute('select * where {?s ?p ?o .} limit 100 ')
print(r)


"""
上传数据
"""
r2 = cur.upload_data('./example.owl')
print(r2)


"""
下载数据
"""
r3 = cur.download_data('./download_result.owl')
print(r3)


"""
删除全部节点数据
"""
r4 = cur.delete_all_data()
print(r4)

cur.close()

db.close()数据库管理import pygraphdb

host = '0.0.0.0'
port = '7200'
user = 'admin'
password = 'password'

db = pygraphdb.connect(host, port, user, password)

manager = db.manage_repository()

"""
创建一个repository
"""
db_name = 'example'
r = manager.create_repository_graphdb_free(db_name)
print(r)

"""
删除一个repository
"""
r2 = manager.delete_repository(db_name)
print(r2)


"""
查询所有的repository列表
"""
r3 = manager.get_repository_list()
print(r3)


"""
重启repository
"""
r4 = manager.restart_repository(db_name)
print(r4)


"""
获取数据库大小
"""
r5 = manager.get_repository_size(db_name)
print(r5)

manager.close()

db.close()参与贡献刘洪波参考资料grapddb 使用教程：https://graphdb.ontotext.com/documentation/free/index.html
Package: pygraphedit
Interactive Graph Editor for JupyterAn interactive graph editor function designed for Jupyter notebooks.edit(graph: nx.Graph)function allows usersto manipulate a graph by creating vertices, edges, and adding labels directly within a Jupyter environment.Parametersgraph(networkx.Graph): The graph object to be edited.
It should be an instance of the NetworkX Graph class or a subclass.Functions of buttons (from left to right)Select whether you want to edit graph structure.Select whether you want to edit labels.Toggle nodes clickable option.Toggle edges clickable option.Close editing window.Mouse FunctionsClick and drag vertices to move them around the canvas.To create an edge, click on one vertex and then click on another vertex.An edge will be created between the two selected vertices.To create a vertex, click on empty space of a canvas.To delete an object, double-click on it.DependenciesJupyter notebook web environment.NetworkX library for graph manipulation.NotesThis function relies on Jupyter ipywidgets, so it should work only in web versions of Jupyter.Examplesimportnetworkxasnxfrompygrapheditimportedit# Create a sample graphG=nx.Graph()G.add_nodes_from([1,2,3])G.add_edges_from([(1,2),(2,3)])# Call the interactive graph editoredit(G)
Package: pygraphenelib
Python 3 library for Graphene 2.0!Stable[![docs master](https://readthedocs.org/projects/python-graphenelib/badge/?version=latest)](http://python-graphenelib.readthedocs.io/en/latest/)
[![Travis master](https://travis-ci.org/xeroc/python-graphenelib.png?branch=master)](https://travis-ci.org/xeroc/python-graphenelib)
[![codecov](https://codecov.io/gh/xeroc/python-graphenelib/branch/master/graph/badge.svg)](https://codecov.io/gh/xeroc/python-graphenelib)[![PyPI](https://img.shields.io/pypi/dm/graphenelib.svg?maxAge=2592000)]()
[![PyPI](https://img.shields.io/pypi/dw/graphenelib.svg?maxAge=2592000)]()
[![PyPI](https://img.shields.io/pypi/dd/graphenelib.svg?maxAge=2592000)]()Develop[![docs develop](https://readthedocs.org/projects/python-graphenelib/badge/?version=develop)](http://python-graphenelib.readthedocs.io/en/develop/)
[![Travis develop](https://travis-ci.org/xeroc/python-graphenelib.png?branch=develop)](https://travis-ci.org/xeroc/python-graphenelib)
[![codecov develop](https://codecov.io/gh/xeroc/python-graphenelib/branch/develop/graph/badge.svg)](https://codecov.io/gh/xeroc/python-graphenelib)InstallationInstall withpip:$ sudo apt-get install libffi-dev libssl-dev python-dev
$ pip3 install graphenelibManual installation:$ git clonehttps://github.com/xeroc/python-graphenelib/$ cd python-graphenelib
$ python3 setup.py install –userDependenciesSome dependencies are not required for parts of the library to run
properly. However these modules require some additional libraries to be
present:graphenebase.bip38pycrypto==2.6.1scrypt==0.7.1(to speedup scrypt hashing)graphenebase.memopycrypto==2.6.1Upgrade$ pip install –user –upgrade graphenelibDocumentationThanks to readthedocs.io, the documentation can be viewed
[online](http://python-graphenelib.readthedocs.io/en/latest/)Documentation is written with the help of sphinx and can be compile to
html with:cd docs
make htmlLicenceMIT, seeLICENCE.txt
Package: pygraphgpt
PyGraphGPT: A package to empower development of Knowledge Graph based GenAI application.Template prompts for graph extractionInteractive GUI for visualizationPython compatibleInstallationInstall withpoetry:poetry add pygraphgptInstall withpip:pip install pygraphgptQuickstartAfter installingpygraphgpt, to start the front-end webapp in the local server, user can use:poetry run graphgptExperienced user or contributor can start the application from the cloned repository viaMakefile:make graphgptContributionThis tool is designed to share knowledge and facilitate the development of GenAI with Graph Knowledge.
As new ideas and requirements only come with usage, any suggestions or contributions
will be more than welcome.How toTo contribute, you are invited to:Create a newissuefor suggesting new feature fromissues'page.CreatePRto address the created issues.For eachPR, please:checkout from the branchdevelopname the branch as:feat/<feature_name_here>should merge only to thedevelopbranch (not master)please delete the merged feature branch to avoid messy branches.Sanity checkTo facilitate the development and assure the code quality, please activate the automatic sanity check tool: black, isort etc…
For this purpose:In the virtual environment, activate thepre-commit:pre-commit install.
Package: pygraphia
PyGraphia is in early development phase.PyGraphia aims to be a minimalist graph library to help you implement graph algorithms out of the box.It also comes with its own implementations of few popular graph algorithms.The current features are:Following graph data types:Graph,Vertex,Edge,Walk,PathFollowing algorithms: Breadth First Search, Depth First Search, Prim’s MST generationTheGraphdata type` comes with a lot of in-built properties likeis_connected,is_eulerianetc.Future goals:Expand algorithms coverageMore support for directed graphsThorough testing setupThorough documentationCI/CD setupCurrently development time constrainted due to my busy university schedule. Hopefully I will be able to invest more time next month.Contributors and testers are welcome.
Package: pygraphic
pygraphicClient-side GraphQL query generator based onpydantic.Why?Working with GraphQL in Python seems simple... If you're fine with dictionaries, lack of
autocompletion and unexpected errors.Some tools allow you to generate Python code from GraphQL schemas. One of them,turms,
even generates pydantic models from GQL documents. This approach can be problematic:
queries are written in GraphQL, not Python, so the codebase you're actually working with
is out of your control; and the main advantage of pydantic — data validation — is
missing!WorkflowPygraphic is the opposite ofturms:For each individual query, you define pydantic models that you want to request,
optionally with validators and other configuration;Pygraphic converts those definitions to raw GraphQL documents(basically strings);Using a GraphQL or an HTTP client, you make requests with those documents and get
back JSON responses;Pydantic converts those responses to instances of the defined models and validates
them;You use the validated data, while enjoying autocompletion and type safety!RoadmapPygraphic is in development stage. Some major features are missing or might work
incorrectly. The API may change at any time.SeeROADMAP.mdfor the list of implemented/missing features.ExamplesExamples are kept in the/examplesfolder.Queries that they're expected to produce are stored in the/golden_filesfolder.Most examples are based onGitHub's GraphQL API.
If you want to run them, you need togenerate a personal access tokenand assign it to
the environment variable calledGITHUB_TOKEN(with VSCode, the best way to do this is
to create a.envfilein the project's root directory).Here's the gist:main.pyimportosimportrequestsfrompygraphicimportGQLQuery,GQLType# Define data modelsclassLicense(GQLType):id:strname:strdescription:str# Define query modelclassGetAllLicenses(GQLQuery):licenses:list[License]# Generate the GraphQL query stringquery_str=GetAllLicenses.get_query_string()# Make the requestTOKEN=os.environ["GITHUB_TOKEN"]response=requests.post(url="https://api.github.com/graphql",json={"query":query_str,},headers={"Authorization":f"bearer{TOKEN}",},)# Parse the responseresponse_data=response.json().get('data')ifresponse_dataisNone:print('Query failed')result=GetAllLicenses.parse_obj(response_data)# Print the resultsforlicenseinresult.licenses:print(license.name)Generated query stringquery GetAllLicenses {
  licenses {
    id
    name
    description
  }
}ContributionThis project is developed onGitHub.If you have any general questions or need help — you're welcome in theDiscussionssection.If you encounter any bugs or missing features — file newIssues, but make sure to
check the existing ones first.If you want to solve an issue, go ahead and create aPull Request! It will be
reviewed and hopefully merged. Help is always appreciated.LicenseCopyright © 2022, Dmitry Semenov. Released under theMIT license.
Package: pygraphml
# pygraphml[![Build Status](https://travis-ci.org/hadim/pygraphml.svg?branch=master)](https://travis-ci.org/hadim/pygraphml)
[![PyPI version](https://img.shields.io/pypi/v/pygraphml.svg?maxAge=2591000)](https://pypi.org/project/pygraphml/)pygraphmlis a Python library designed to parse GraphML file. To
see specification about GraphML, seehttp://graphml.graphdrawing.org/A documentation is provided as a [Jupyter notebook](notebooks/documentation.ipynb).# RequirementsPython > 2.7 and > 3.6.matplotliband [networkx](http://networkx.lanl.gov/) for visualization (optional).# Installpip install pygraphmlOr you can use Anaconda andconda-forge:` conda config--addchannelsconda-forgeconda install pygraphml `# LicenseUnder BSD license. See [LICENSE](LICENSE).# AuthorsHadrien Mary <hadrien.mary@gmail.com>Nick Hamilton <n.hamilton@imb.uq.edu.au>
Package: py-graphql-client
py-graphql-clientDead-simple to use GraphQL client over websocket. Using theapollo-transport-wsprotocol.Installpipinstallpy-graphql-clientExamplesSetup subscriptions super easilyfromgraphql_clientimportGraphQLClientquery="""subscription {notifications {idtitlecontent}}"""withGraphQLClient('ws://localhost:8080/graphql')asclient:sub_id=client.subscribe(query,callback=callback)# do other stuff# ...# later stop the subscriptionclient.stop_subscribe(sub_id)defcallback(_id,data):print("got new data..")print(f"msg id:{_id}. data:{data}")Variables can be passedfromgraphql_clientimportGraphQLClientquery="""subscription ($limit: Int!) {notifications (order_by: {created: "desc"}, limit: $limit) {idtitlecontent}}"""withGraphQLClient('ws://localhost:8080/graphql')asclient:sub_id=client.subscribe(query,variables={'limit':10},callback=callback)# ...defcallback(_id,data):print("got new data..")print(f"msg id:{_id}. data:{data}")Headers can be passed toofromgraphql_clientimportGraphQLClientquery="""subscription ($limit: Int!) {notifications (order_by: {created: "desc"}, limit: $limit) {idtitlecontent}}"""withGraphQLClient('ws://localhost:8080/graphql')asclient:sub_id=client.subscribe(query,variables={'limit':10},headers={'Authorization':'Bearer xxxx'},callback=callback)...client.stop_subscribe(sub_id)defcallback(_id,data):print("got new data..")print(f"msg id:{_id}. data:{data}")Normal queries and mutations work toofromgraphql_clientimportGraphQLClientquery="""query ($limit: Int!) {notifications (order_by: {created: "desc"}, limit: $limit) {idtitlecontent}}"""withGraphQLClient('ws://localhost:8080/graphql')asclient:res=client.query(query,variables={'limit':10},headers={'Authorization':'Bearer xxxx'})print(res)Without the context manager APIfromgraphql_clientimportGraphQLClientquery="""query ($limit: Int!) {notifications (order_by: {created: "desc"}, limit: $limit) {idtitlecontent}}"""client=GraphQLClient('ws://localhost:8080/graphql')res=client.query(query,variables={'limit':10},headers={'Authorization':'Bearer xxxx'})print(res)client.close()TODOsupport http as wellshould use asyncio websocket library?
Package: py-graphql-mapper
py-graphql-mapperA python library to interact with GraphQL APIs with no need of hardcoded strings.IntroductionThis library acts as a mapper between python and GraphQL languages for GraphQL clients, allowing a code-first approach when calling a GraphQL API server.
It translates GraphQL entities into python objects and viceversa in order to avoid working with massive "copy&paste"s.This document contains a quick overview of the functionalities, for more details and options you can read here:Code GenerationCore MapperUse CasesThe package does not use any third-party libraries, it relies only on python 3 (3.10+) standard libraries.Usage in a nutshellInstallationAvailable in PyPI, the following command will install the library:pip install py-graphql-mapperGenerate python code from schemaTo generate the code execute the following command:pgmcodegen generate ./pathToOutputFolder -apiArgs ./<pathToArgsFile>/generatorArgs.jsonThis command requires a json file containing the parameters needed to get the GraphQL schemaA sample is available in the main folder'cli_args.json'.The following python files will be generated:enums.pyscalars.pygql_simple_types.pygql_types.pytype_refs.pyqueries.pymutations.pyThese links show code generated using the libraryGithub GraphQL API,Rapid GraphQL APIandGeoDBCities APIMore command options are availablehereExecution of a queryChoose the query class you want to use from the generated file queries.py (or a mutation from mutations.py):Instantiate it adding GraphQL arguments if needed:from.output.gdbc.queriesimportcurrenciesmy_currencies=currencies(last=7,before='MTE=')or add them using the fieldargsmy_currencies._args.last=7my_currencies._args.before='MTE='Then callexport_gql_sourceproperty to pass the payload to the HTTP request:(example usingrequestslibrary)importrequestsresponse=requests.request('POST',url='https://geodb-cities-graphql.p.rapidapi.com/',json={"query":my_currencies.export_gql_source},headers={"content-type":"application/json","X-RapidAPI-Key":'123402mmri02fni230iif32jr420',"X-RapidAPI-Host":"geodb-cities-graphql.p.rapidapi.com"})More details on how to set a queryhereRetrieval of a responseObtained the response from the GraphQL API the following code will map the received json payload into the python objectfrompygqlmap.networkimportGQLResponsegqlResponse=GQLResponse(response)gqlResponse.map_gqldata_to_obj(myCurrenciesQuery.type)print('Result object: '+str(gqlResponse.result_obj))The mapped response from the GraphQL server will be available withingqlResponseobject:_gqlResponse.result_obj_More detailshereA suite of use caseshere
Package: pygraphs
pygraphsA graph database based on Python纯Python实现的图数据库完备增删改查改善复杂查询的体验支持 CQL 语句使用文档初始化一个空的图数据库importpygraphsaspgG=pg.Graph()增增加节点# 从csv读取节点并加入图数据库G.add_vertexes_from_file(filename='Vertexes.csv')# 从list读取节点并加入图数据库vertexes_list=[['Tom',{'age':10}],['Kitty',{'sex':'female'}],['Jimmy',{'sex':'male','age':35}]]G.add_vertexes_from_list(vertexes_list=vertexes_list)print(G.vertexes)增加边# 从csv读取关系并加入图数据库G.add_edges_from_file(filename='Edges.csv')# 从 list 读取并加入图数据库edges_list=[['Tom',{'relation':'son'},'Jimmy'],['Kitty',{'relation':'wife'},'Jimmy'],]G.add_edges_from_list(edges_list=edges_list)print(G.edges)查# 按照主键来查询print(G.vertexes['Frank Darabont'])# 按特定过滤条件查询节点young_people=G.query(condition_vertex=lambdax:('born'inx)andx['born']>'1975')print(young_people)# 按特定过滤条件查询边relation_son=G.query(condition_edge=lambdax:'relation'inxandx['relation']=='son')print(relation_son)复杂查询foredgeinG.edges:if'type'inedge.valandedge.val['type']=='acted_in':src=edge.srcif'born'insrc.valandsrc.val['born']>'1975':print(src,';',edge)删清除所有节点和边G.clear()# 删边，G.del_edges 批量删，G.del_edge 单个删G.del_edges(edges_to_del=relation_son)# 删节点，G.del_vertexes 批量删，G.del_vertex 单个删G.del_vertex(vertex_to_del=G.vertexes['Tom'])改改节点属性，已有的属性被覆盖，没有的属性新建G.set_val(G.vertexes['Kitty'],{'sex':'male','height':'1.8m'})print(G.vertexes['Kitty'].val)改边的属性，已有的属性被覆盖，没有的属性新建edge_to_set=list(G.vertexes['Kitty'].dst)[0]self=G.set_val(edge_to_set,{'relation':'husband'})print(edge_to_set.val)持久化把图数据库存到本地pg.save_db(G,'db_file.db')从本地读图数据库G_new=pg.load_db('db_file.db')
Package: pygraph-tool
pygraph-toolpygraph-tool is a module to create and manipulate graphs. Nodes can be all objects who you want and edges are oriented and valued at 1 by default. If you wish one graph not oriented, edges must be declared in one direction and then in the other.Getting startedImport modulesGraph module:frompygraph_toolimportGraphExceptions module:frompygraph_toolimport(NodeException,EdgeException,GraphException)Others modules (optional):frompygraph_toolimportNode,EdgeCreate new graphThe new graph is empty (No node and no edge).graph:Graph=Graph()Create new nodes in graphCreate new nodes n1, n2 and n3, three nodes of graph.graph.add_node("I'm n1","n1")graph.add_node("I'm n2","n2")graph.add_node("I'm n3","n3")If node already exists(same id), theGraphExceptionis raise.try:graph.add_node("I'm n1 again","n1")exceptGraphExceptionaserror:pass# or do something...If an argument isNone, theNodeExceptionis raise.Create new unidirectional edge in graphCreate new edges e1 such as n1->n2 with weight = 1.5,
e2 such as n3->n2 with weight by default = 1 and
e3 such as n1->n3 with weight by default = 1graph.add_unidirectional_edge("n1","n2","e1",1.5)graph.add_unidirectional_edge("n3","n2","e2")graph.add_unidirectional_edge("n1","n3","e3")If edge already exists (same id), theGraphExceptionis raise.try:graph.add_unidirectional_edge("n2","n3","e1")exceptGraphExceptionaserror:pass# or do something...If an argument (exceptweightargument) isNone, theEdgeExceptionis raise.Create new bidirectional edge in graphcoming soon...Remove nodeIf node doesn't exist in graph,GraphExceptionis raise.try:graph.remove_node("n2")exceptGraphExceptionaserror:pass# or do something...Remove edgeIf edge doesn't exist in graph,GraphExceptionis raise.try:graph.remove_edge("e3")exceptGraphExceptionaserror:pass# or do something...Visualize the graph (very simple representation)Create function for display graphdefdisplayGraph(graph:Graph)->None:# display the graph's nodesfornodeingraph.nodes:print(f"{node.node_id}:{node.node_content}")# display the graph's edgesforedgeingraph.edges:message:str=(f"{edge.node_start.node_id}"f"---{edge.edge_id}={edge.weight}---> "f"{edge.node_end.node_id}")print(message)# Display graphdisplayGraph(graph)AuthorIf you have any questions or suggestions, please don't hesitate to contact me :belaich.david@outlook.fr.