Metadata-Version: 2.4
Name: DIRACCommon
Version: 9.0.0a66
Summary: Stateless utilities extracted from DIRAC for use by DiracX and other projects
Project-URL: Homepage, https://github.com/DIRACGrid/DIRAC
Project-URL: Documentation, https://dirac.readthedocs.io/
Project-URL: Source Code, https://github.com/DIRACGrid/DIRAC
Author-email: DIRAC Collaboration <dirac-dev@cern.ch>
License: GPL-3.0-only
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Distributed Computing
Requires-Python: >=3.11
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: testing
Requires-Dist: pytest-cov>=4.0.0; extra == 'testing'
Requires-Dist: pytest>=7.0.0; extra == 'testing'
Description-Content-Type: text/markdown

# DIRACCommon

Stateless utilities extracted from DIRAC for use by DiracX and other projects without triggering DIRAC's global state initialization.

## Purpose

This package solves the circular dependency issue where DiracX needs DIRAC utilities but importing DIRAC triggers global state initialization. DIRACCommon contains only stateless utilities that can be safely imported without side effects.

## Contents

- `DIRACCommon.Utils.ReturnValues`: DIRAC's S_OK/S_ERROR return value system
- `DIRACCommon.Utils.DErrno`: DIRAC error codes and utilities

## Installation

```bash
pip install DIRACCommon
```

## Usage

```python
from DIRACCommon.Utils.ReturnValues import S_OK, S_ERROR

def my_function():
    if success:
        return S_OK("Operation successful")
    else:
        return S_ERROR("Operation failed")
```

## Development

This package is part of the DIRAC project and shares its version number. When DIRAC is released, DIRACCommon is also released with the same version.

```bash
pixi install
pixi run pytest
```

## Guidelines for Adding Code

Code added to DIRACCommon must:
- Be completely stateless
- Not import or use any of DIRAC's global objects (`gConfig`, `gLogger`, `gMonitor`, `Operations`)
- Not establish database connections
- Not have side effects on import
