commonlib-reader
Connector package for Equinor Commonlib api.
See the changelog for release history.
Current features:
- Reading any code table with the
Codeclass - Reading library definitions and attribute definitions with the
LibraryandAttributeDefinitionclasses - Reading projects with the
Projectclass - 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.
Projects
Use Project.get_all() to retrieve projects and optionally filter by name or
abbreviation.
from commonlib_reader import Project
projects = Project.get_all(name="M.IGLED.6I.X.0010")
matching_projects = Project.get_all(abbreviation="IGLED")
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.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| commonlib_reader-1.4.0.tar.gz | 15.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| commonlib_reader-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 36.3 kB
Release files / commonlib_reader-1.4.0.tar.gz
| Download URL | commonlib_reader-1.4.0.tar.gz |
|---|---|
| Size | 15.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaa697837e3993f88101dc965d6567ef1c0d5cba54c49137980800112351d307
|
|
BLAKE2b-256 checksum How to use checksums |
ab74db7e0123609030040d40861f4d39d6b40462f7b469f93c6eb4e9e08c0064
|
| 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.4.0-py3-none-any.whl
| Download URL | commonlib_reader-1.4.0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1e61846802f1a21601cba38eb549a18c50dfb87a4d69128fa2edd53a1cc8726
|
|
BLAKE2b-256 checksum How to use checksums |
608dfd943d72715f543cda881bb72cb1bc9c607170dda75262493979a97ca51c
|
| 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
|