Metadata-Version: 2.4
Name: dgc-core
Version: 1.0.2
Summary: Shared Python utilities and domain types for DGC services
Author-email: velopace <velopace7@gmail.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/velopace739/dgc-core-python
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: functions-framework>=3.10.1
Requires-Dist: flask>=3.1.3
Requires-Dist: firebase-admin>=7.4.0
Requires-Dist: google-api-core>=2.30.3
Requires-Dist: google-auth>=2.49.2
Requires-Dist: google-auth-oauthlib>=1.3.1
Requires-Dist: google-cloud-pubsub>=2.37.0
Requires-Dist: google-cloud-tasks>=2.22.0
Requires-Dist: protobuf<7,>=4.25.8
Requires-Dist: pydantic>=2.13.3
Requires-Dist: pymongo>=4.17.0
Requires-Dist: requests>=2.32.0
Provides-Extra: dev
Requires-Dist: build>=1.3.0; extra == "dev"
Requires-Dist: pytest>=8.4.1; extra == "dev"
Requires-Dist: pytest-cov>=6.2.1; extra == "dev"
Requires-Dist: twine>=6.1.0; extra == "dev"

# dgc-core

Shared Python utilities and domain types for DGC services. The distribution is
named `dgc-core`; the Python package is `dgc_core`. Requires Python 3.10 or later.

This repository combines `opticedge-cloud-utils-python` (`opticedge_cloud_utils`
1.0.33) and `opticedge-types-python` (`opticedge_types` 1.0.53). Existing utility
behavior, public exports, enum values, and eligibility constants are preserved.

## Installation

Install from this checkout during development:

```sh
python -m pip install -e .
```

After version 1.0.0 is published to your package index, consumers can use
`dgc-core==1.0.0` in their requirements.

## Imports

```python
from dgc_core import ApprovalStatus, GradingType, LogLevel, MongoCache, log, require_env
from dgc_core.pub import publish_message
from dgc_core.enums.card import CardCategory
```

Utilities, enums, and constants are exported together from `dgc_core`. Utility
modules live directly in the package, alongside `enums/` and `constants/`.
Helpers cover authentication, configuration, HTTP fetching, logging, merging,
MongoDB cache, normalization, PriceCharting parsing, Pub/Sub, regex, and Cloud
Tasks. Domain definitions cover cards, users, submissions, and grading eligibility.

## Migrating existing consumers

Replace the `opticedge-cloud-utils` and `opticedge-types` requirements with the
single `dgc-core` requirement after publication, and update imports to `dgc_core`:

```sh
python -m pip install dgc-core==1.0.0
```

| Previous import | New import |
| --- | --- |
| `from opticedge_cloud_utils import log` | `from dgc_core import log` |
| `from opticedge_types import GradingType` | `from dgc_core import GradingType` |
| `from opticedge_cloud_utils.pub import publish_message` | `from dgc_core.pub import publish_message` |
| `from opticedge_types.enums.card import GradingType` | `from dgc_core.enums.card import GradingType` |
| `from opticedge_types.constants.card import ON_DEMAND_ELIGIBLE_GRADING_TYPES` | `from dgc_core.constants.card import ON_DEMAND_ELIGIBLE_GRADING_TYPES` |

Update mock and patch paths in consumer tests using the same mapping. The
distribution provides only the `dgc_core` package.

Service requirements are not changed by this repository merge. Services pinned
to older releases should run their own tests when adopting the combined release.

## Development and verification

```sh
make test
make check
```

Without Make, create a virtual environment and activate it, then run:

```sh
python -m pip install -r requirements-dev.txt
python -m pytest --cov=dgc_core --cov-report=term-missing
python -m build
python -m twine check dist/*
```

The tests mock external calls. `make build` clears old `build/` and `dist/` output
and produces a wheel and source distribution for the current version.

## Releasing

```sh
make bump-patch
make publish
```

`make bump-patch` increments `[project].version` in `pyproject.toml` (for example,
`1.0.0` to `1.0.1`) and preserves the rest of the file's formatting. It uses the
base Python interpreter and works before creating the virtual environment.

`make publish` builds fresh artifacts, checks them with Twine, and uploads them
to your configured package index (PyPI by default), using your existing Twine
credentials or configuration. Publishing uses the current version; it does not
bump the version automatically.
