Skip to main content

VortexPY

Flying Ion's observable, routable, data serialisation and transport code.

See README_PERMISSIONS.md for the two-level permission system (endpoint guards + access control context) introduced in v5.0.

Why PY at the end? To be consistent with VortexJS, which is the Browser side package. See https://gitlab.com/flyingion/vortexjs

Requirements:

  • Python 3.5
  • Twisted 16+
  • SQLAlchemy 1, 1.1

The "vortex" is designed to transport "Payloads" from a web browser (VortexJS) to a twisted web server (VortexPY). There is also a python client for python client to python server communication.

Vortex, The Observable Part

Vortex was designed to allow the Python server to send updates to the browser with out the browser having to create HTTP request polls.

This is achieved by the browser/client sending one or more payloads to the server as a HTTP POST, the server then uses this connection to send payloads back to the client.

This HTTP POST connection remains active, Until the client needs to send more Payloads to the server. To do this, the client simply starts a new HTTP POST request to the server, the server will then close the old request and begin sending Payloads down the respose path of the new request.

Python classes = Vortex

Transport

Transport occurs over a HTTP(S) layer.

Experimental classes are present to transport data to/from subprocess pipes, this worked, except the subprocess didn't die and the idea was abandoned (It was a Celery worker).

Because of this effort, it's much easier to add other transport mechanisms.

Python classes = VortexResource (Receive), VortexConnection (Send)

Payloads

A "Payload" is a class that stores some routing information, a result and a list of "Tuples".

The routing information is a dict / json object which looks like this {key:"anything.type.of.data.list"} (See Routable for more info)

The tuples attribute stores the data, typically this is a list of Tuple (see Tuples) objects, however, it can be any data structure that JSON can serialise, plus Date()/datetime.

The Payload class is responsible for serialising and compressing it's data down to a "Vortex Msg", ready for transport. Compression is done with zlib, this imrpovement sees data reduced to 10% of the original size.

There is custom code that handles converting the structure to JSON objects for json.dumps so support can be (carefully) added for other data types such as bytes.

Python classes = Payload

Tuples

Not to be confused with the built in Python tuple syntax (1, 2, 3), Tuples are registered classes with registered attributes.

Vortex Tuples are important in the design as classes that inherit the vortex Tuple class will reconstructed as the proper classes at the other end in python. They will have onlt the fields registerd as TupleFields populated when they are reconstructed.

This is especially useful when using the SQLAlchemy ORM, as the Tuple code recognises column definitions as TupleFields.

You can just assign session.query(MyTable).all() to payload.tuples, and the vortex will know how to serialise.

From here you can send it do the browser, where the browser may edit some attributes of the tuples, then send it back to the python server to update the database. (More on this in Handlers)

Python classes = Tuple, TupleField

Routable

When a vortex receives a payload, it is sent to the PayloadIO

The PayloadIO, then passes it on to each PayloadEndpoint that has registered with it.

Payload routing ends with PayloadEndpoints, These endpoints are constructed with another filter dict/json like object, and a callback.

When PayloadIO tells a PaylaodEndpoint that a new Payload has arrived, the PayloadEndpoint checks the Payload.filt against it's own filt.

If the PayloadEndpoints filt is a subset of the Payload.filt, the PayloadEndpoint then calls it's callable and passes it the Payload.

PayloadEndpoints register them selves with PayloadIO on construction. PayloadIO keeps a list of weak refs to the PayloadEndpoints.

Payloads contain a "filt" attribute, which is a json like dict/object.

Python classes = PayloadEndpoint, PayloadIO

Handlers

Handlers are the provided classes that handle data from the PayloadEndpoints.

  • ModelHandler : Simply specify the payload filter and implement the "buildModel" method.
  • OrmCrudHandler : This handler used to Create, Update, Retrieve and Delete SQLAlchemy data. It can handle an array of tuples, of different types, and has various hooks allowing the data to be customised before being stored or retreived.
  • AsyncModelHandler : Experimental handler that will likely be deleted.

#Change Log

0.3.0

Implemented PY side WebSockets

License

Copyright (c) 2016-2026 Flying Ion Pty Ltd. Released under the MIT License.

Release files for vortexpy 4.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vortexpy 4.2.1
File Size Uploaded
vortexpy-4.2.1.tar.gz 120.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vortexpy 4.2.1
File Interpreter ABI Platform
vortexpy-4.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 295.6 kB

Release files / vortexpy-4.2.1.tar.gz

Download URL vortexpy-4.2.1.tar.gz
Size 120.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3bfe6e61d3aa9a29758752f49d49d4ff35043f729c9131a45222568cd3a67b95
BLAKE2b-256 checksum
How to use checksums
71cbcf6a2150487304d43c6d678bfe26f2479864cae66772fe1e056add297cf5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / vortexpy-4.2.1-py3-none-any.whl

Download URL vortexpy-4.2.1-py3-none-any.whl
Size 175.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17d64bc2f94afcb38c84c0e6b2e406eb3ff24a54708bbcc02f8c6c2db71872a0
BLAKE2b-256 checksum
How to use checksums
f0ecc32959ed7ef5d0ea5530e334dbb6deda3840c0e0858fc430ebe6db73761a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

4.3.0

2 release files

This release

4.2.1 This release

2 release files

4.2.0

2 release files

4.1.7

2 release files

4.1.6

2 release files

4.1.5

2 release files

4.1.3

2 release files

4.1.2

2 release files

4.1.1

2 release files

4.0.29

2 release files

4.0.28

2 release files

4.0.27

2 release files

4.0.25

1 release file

4.0.24

1 release file

4.0.22

1 release file

4.0.21

1 release file

4.0.20

1 release file

4.0.19

1 release file

4.0.18

1 release file

4.0.16

1 release file

4.0.15

1 release file

4.0.14

1 release file

4.0.13

1 release file

4.0.11

1 release file

4.0.10

1 release file

4.0.8

1 release file

4.0.7

1 release file

4.0.6

1 release file

4.0.4

1 release file

4.0.3

1 release file

4.0.2

1 release file

4.0.0

1 release file

3.4.7

1 release file

3.4.6

1 release file

3.4.5

1 release file

3.4.4

1 release file

3.4.3

1 release file

3.4.2

1 release file

3.4.1

1 release file

3.4.0

1 release file

3.3.5

1 release file

3.3.3

1 release file

3.3.2

1 release file

3.3.1

1 release file

3.3.0

1 release file

3.2.7

1 release file

3.2.6

1 release file

3.2.5

1 release file

3.2.4

1 release file

3.2.3

1 release file

3.2.2

1 release file

3.2.1

1 release file

3.2.0

1 release file

3.1.0

1 release file

3.0.0

1 release file

2.6.0

1 release file

2.5.6

1 release file

2.5.5

1 release file

2.5.4

1 release file

2.5.3

1 release file

2.5.2

1 release file

2.5.1

1 release file

2.5.0

1 release file

2.4.3

1 release file

2.4.2

1 release file

2.4.1

1 release file

2.4.0

1 release file

2.1.3

1 release file

2.1.2

1 release file

2.1.0

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.3.2

1 release file

1.3.1

1 release file

1.3.0

1 release file

1.2.20

1 release file

1.2.19

1 release file

1.2.18

1 release file

1.2.17

1 release file

1.2.16

1 release file

1.2.15

1 release file

1.2.14

1 release file

1.2.13

1 release file

1.2.12

1 release file

1.2.11

1 release file

1.2.10

1 release file

1.2.9

1 release file

1.2.8

1 release file

1.2.7

1 release file

1.2.6

1 release file

1.2.5

1 release file

1.2.4

1 release file

1.2.3

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.0.13

1 release file

1.0.12

1 release file

1.0.11

1 release file

1.0.10

1 release file

1.0.9

1 release file

1.0.8

1 release file

1.0.7

1 release file

1.0.6

1 release file

1.0.5

1 release file

1.0.4

1 release file

1.0.3

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.11.0

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.6

1 release file

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.8

1 release file

0.7.7

1 release file

0.7.6

1 release file

0.7.5

1 release file

0.7.4

1 release file

0.7.3

1 release file

0.7.2

1 release file

0.7.1

1 release file

0.7.0

1 release file

0.6.5

1 release file

0.6.4

1 release file

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.8

1 release file

0.5.7

1 release file

0.5.6

1 release file

0.5.5

1 release file

0.5.4

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page