Git Product home page Git Product logo

nx_yaml's Introduction

nx_yaml

Fast Representation Graph for PyYAML using NetworkX.

Usage

Text <-> native

import yaml
from nx_yaml import NxSafeDumper, NxSafeLoader

data_in = yaml.load("yaml: great", Loader=NxSafeLoader)
data_out = yaml.dump(data_in, Dumper=NxSafeDumper)
print(data_out)

Text <-> graph

import networkx as nx
import matplotlib.pyplot as plt

data_out = yaml.compose("[nx, also great]", Loader=NxSafeLoader)
nx.draw_spectral(data_out, with_labels=True, node_size=5000)
plt.show()

Design

All users

This library offers four implementations that jointly bypass the pyyaml.nodes library. This is transparent when you use load and dump since the representation graph is an implementation detail. This library will be faster thanks to a better graph implementation.

Graph users

Users of graphs who use the compose and represent will now get NetworkX objects. NX is a fully fledged library compared to the barebones yaml.nodes module.

With nx_yaml NetworkX becomes your native representation graph using YAML. There is no need to convert between the yaml.nodes.Node and nx.DiGraph by hand.

See:

Implementation

RGraph

Four abstraction isolate and replace pyyaml.nodes representation graph implementation:

Milestone 1

  1. Copy and paste from PyYAML
  2. Replace uses of nodes with NetworkX
  3. Publish a drop-in pip replacement

Milestone 2

  1. Compare performance
  2. Compare alignment with spec
  3. Share findings

Development environment

This is work in progress. pypi is updated on demand.

The development environment is self-contained using the pipenv tool.

Testing

  • Just pytest
  • Store graphs in resources/tests

nx_yaml's People

Contributors

colltoaction avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nx_yaml's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.