Skip to main content

commonlib-reader

Connector package for Equinor Commonlib api.

Current features:

  • Reading any code table with the Code class
  • Reading library definitions and attribute definitions with the Library and AttributeDefinition classes
  • Getting facility data using the Facility class
  • IMS source lookup tables for facilities
  • Getting Tag category, Tag type, Tag format, and Tag format element data. See tag.py
  • Getting units of measure definitions.

Use

Try it out by running the demo.

Libraries and codes

A Library defines a code table and its attribute schema; a Code is one entry in that table. Use package-provided specialized readers when available, such as Facility, Discipline, Unit, TagType, TagCategory, and TagFormat; otherwise use the generic Code reader.

Libraries

Use Library to discover available code tables and inspect their definitions.

from commonlib_reader import Library

library_names = Library.get_names()
discipline_library = Library.get("Discipline")
attribute_definitions = discipline_library.attribute_definitions
is_scoped = discipline_library.is_scope_specific
scope_type = discipline_library.scope_type

Library.get_all() supports name and scope filters. Each AttributeDefinition provides its name, description, required status, identity participation, validation regular expression, and referenced library name.

Check is_scope_specific and scope_type before retrieving codes. For example, when scope_type is "Facility" and is_scope_specific is True, pass the facility installation code, such as "TROC", as scope.

Code tables

Use Code.get_codes() to retrieve entries from any CommonLib code table. Filter by installation scope or code name when needed.

from commonlib_reader import Code

disciplines = Code.get_codes("Discipline", scope="TROC")
administration = Code.get_codes("Discipline", scope="TROC", name="A")

Each entry provides name, description, identity, is_valid, attributes, and other CommonLib metadata. Use Code.get_names() or Code.get_name_and_desc() when only dropdown-friendly names or name/description data is required.

Installing

Install package from pypi using pip install commonlib_reader

Developing / testing

uv is preferred for developers. Clone and install with required packages for testing and coverage: uv sync

For testing with coverage run: uv run pytest --cov --cov-report=html

Metadata

Release files for commonlib-reader 1.3.0

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

Source distribution (sdist)

Source distribution for commonlib-reader 1.3.0
File Size Uploaded
commonlib_reader-1.3.0.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for commonlib-reader 1.3.0
File Interpreter ABI Platform
commonlib_reader-1.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 32.9 kB

Release files / commonlib_reader-1.3.0.tar.gz

Download URL commonlib_reader-1.3.0.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
11182aeb1f63e751138e9c2bf5a322f6730e11c4c5e726f5c1636400e31dfb7d
BLAKE2b-256 checksum
How to use checksums
0465c5b364faa56c36d8db507b17a1c9b8121e9a54f3bff1e97070a1af4d9508
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.13.7 Darwin/27.0.0

Release files / commonlib_reader-1.3.0-py3-none-any.whl

Download URL commonlib_reader-1.3.0-py3-none-any.whl
Size 19.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea537b2263335dede1f1ab3643dcee30d38244aca36e17d8523f527abe0e11d5
BLAKE2b-256 checksum
How to use checksums
858f21974e68ce10e2c77ef6936a6f020d97e2c9a782f3264bd4007ce0d93682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.3.3 CPython/3.13.7 Darwin/27.0.0

Release history Release notifications | RSS feed

1.4.0

2 release files

This release

1.3.0 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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