Skip to main content

Graph creation and management

Project description

Galaxy graph

Edit and manage graph.

Getting started

Requirements

  • Python >= 3.14

Installation

To install this package in the current python environment, use: python -m pip install galaxy_graph

Usage

from galaxy_graph import Graph, Node, Connection

graph = Graph()
house = Node("house")
graph.add(house)
house.connect(Connection(data="has room"), Node("bedroom"))
house.connect(Connection(data="has room"), Node("kitchen"))
house.connect(Connection(data="has room"), Node("bathroom"))

bedroom = graph.get_by_id("bedroom")
bedroom.connect(Connection(data="has area"), Node(data=9))
kitchen = graph.get_by_id("kitchen")
kitchen.connect(Connection(data="has area"), Node(data=7))
bathroom = graph.get_by_id("bathroom")
bathroom.connect(Connection(data="has area"), Node(data=6))

house.connect(
    Connection(data="has adress"),
    Node(data="1 Grande Rue, 0000, Saint Roustan"),
)

rooms = {
    node
    for node in house._state.online.get_neighbors_by_connection_data(
        filter_=lambda data: data == "has room",
    )
}
total_area = sum({
    sum({
        area.data
        for area in room._state.online.get_neighbors_by_connection_data(
            filter_=lambda data: data == "has area"
        )
    })
    for room in rooms
})
number = len(rooms)

print(f"this house has {number} rooms with a total area of {total_area} m^2")

Documentation

A complete documentation is available in the wiki.

Development

Requirements

This project use mise to manage development tools.

[!TIP] If mise is installed, and mise.toml is trusted with mise trust, all tools can be installed automatically with `mise install``

This project use the following tools:

  • just: command runner
  • hatch: project manager and package builder
  • uv: package installer
  • ruff: python linter and formatter
  • ty: python type checker
  • jujutsu: version control

[!NOTE] Tools used in the project consume and produce interoperable format to avoid vendor lock-in. This is the toolchain of the current maintener.

Usage

just can be used to speed up development for an identical toolchain.

Before making a commit, just fix will run all tests, format the code, lint and type check. If you don’t want to modify the code, just check will run all tests, lint and type check without any attempt to fix any issue.

Before a version change, just release will push all local commits to repository and publish the new package version.

All available commands can be listed with just -l.

License

This project is licensed under the GNU GPL v3+. See license file for more information.

Acknowledgement

Thanks to all the people that worked on the tools used, like python, neovim and mise.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galaxy_graph-0.1.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

galaxy_graph-0.1.1-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file galaxy_graph-0.1.1.tar.gz.

File metadata

  • Download URL: galaxy_graph-0.1.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.14.5 HTTPX/0.28.1

File hashes

Hashes for galaxy_graph-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5aa34745e2aafdbdce00ba975787d109029421d846fcb1c7dc00f75279b5b47c
MD5 9439323c366d914e449376285e5dc8c7
BLAKE2b-256 3dfef8c3e22204bc3d3ff16cc7d1d57185b881a42851058ddabdcae7069b57d4

See more details on using hashes here.

File details

Details for the file galaxy_graph-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: galaxy_graph-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.3 cpython/3.14.5 HTTPX/0.28.1

File hashes

Hashes for galaxy_graph-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0278373e4b4771b0bcc4142e7adb53fd3fe03a686378339ebb7fec6b7f1f33a0
MD5 231db7d36b19e59a5707c31a771402cb
BLAKE2b-256 97f71d6c5c80fb358080bbb571895270f8aebc86588384aee195c41b96c34628

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page