Skip to main content

Representation of Arches graphs for client and server side manipulation

Project description

(Unofficial) Arches ORM [EXPERIMENTAL]

This provides simple (server-side) access to Arches resources from Python as Python objects. It makes no guarantees about efficiency or type-accuracy but such issues raised will be addressed as far as possible.

Installation

Basic installation can then happen as follows, without Arches backend support:

pip install .

To run tests, make sure you have libsqlite3-mod-spatialite, or your distribution's equivalent package for enabling Spatialite in Python. Instead of using a real Arches PostgreSQL database, we spin a fresh test database up in memory.

WARNING: The mock DB behaviour for Python testing is not identical to a real Arches database, but is adequately close for now, is fast and has no server dependency.

There are several sets of optional dependencies.

GraphQL

Turns Arches ORM into an API server for Arches.

pip install .[graphql]

Arches

Allows Arches ORM to directly manipulate the Arches database.

pip install .[arches]

Test

Runs tests across the various backends.

pip install .[tests]

Well-known Resource Models

To provide a partial boundary, this package expects a settings object called WELL_KNOWN_RESOURCE_MODELS to list, at least, the models that should be wrapped by this system.

It should be a list:

WELL_KNOWN_RESOURCE_MODELS = [
    {
        "model_name": "Person",
        "graphid": "4110f743-1a44-11e9-9a37-000d3ab1e500",
        "nodes": {}, # optional additional configuration
        "to_string": lambda wkrm: str(wkrm) # optional callback for stringifying
    }
]

You must not take this list as an exclusive boundary of data that can be accessed.

Hooks

This package also contains experimental functionality for hooking tile saves, so that client code can use the MyModel.post_save signal to get well-known resource model events. To avoid any unintended overhead, it does not load unless explicitly turned on with arches_orm.add_hooks().

Tests

Note that the tests require spatialite and so a Python that allows Sqlite3 extension loading:

PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.10.10

Documentation

Documentation is available on https://flaxandteal.github.io/arches-orm/.

Thanks

Particular thanks to the funders of this work, and to the Arches community for their work on which this builds. Particular thanks to Historic England's team for the underlying resource models used in the test-cases.

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

arches_orm-0.4.0.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

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

arches_orm-0.4.0-py3-none-any.whl (141.9 kB view details)

Uploaded Python 3

File details

Details for the file arches_orm-0.4.0.tar.gz.

File metadata

  • Download URL: arches_orm-0.4.0.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for arches_orm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c77d0e23bafb9e7ccbf803844c12c6dd120fafa87d060b49fe25727ffbdafb9a
MD5 f2ea564c44306ec8c972e8ed77d646a2
BLAKE2b-256 1c65d103a965000ff7f516612fac5f43b9047ee91df494c1b920c7d9d8b63989

See more details on using hashes here.

Provenance

The following attestation bundles were made for arches_orm-0.4.0.tar.gz:

Publisher: python-publish.yml on flaxandteal/arches-orm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file arches_orm-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: arches_orm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 141.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for arches_orm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e75b36736312edd6bc462fdf5f6d8f87548c4f282dea5a51730603eb403bc4fe
MD5 aa784591914cd42db138543f7a3caa83
BLAKE2b-256 0a9ecf42c795c9fafd5818546a9b09c2f066fe8430e6756fa666a1ad529ba8bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for arches_orm-0.4.0-py3-none-any.whl:

Publisher: python-publish.yml on flaxandteal/arches-orm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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