deped-dcp-template 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deped_dcp_template-0.1.0/.github/workflows/ci.yml +35 -0
- deped_dcp_template-0.1.0/.gitignore +8 -0
- deped_dcp_template-0.1.0/.pre-commit-config.yaml +22 -0
- deped_dcp_template-0.1.0/PKG-INFO +45 -0
- deped_dcp_template-0.1.0/README.md +36 -0
- deped_dcp_template-0.1.0/docs/architecture.md +50 -0
- deped_dcp_template-0.1.0/docs/development.md +40 -0
- deped_dcp_template-0.1.0/docs/getting-started.md +57 -0
- deped_dcp_template-0.1.0/docs/index.md +51 -0
- deped_dcp_template-0.1.0/env.example +1 -0
- deped_dcp_template-0.1.0/justfile +10 -0
- deped_dcp_template-0.1.0/pyproject.toml +33 -0
- deped_dcp_template-0.1.0/src/deped_dcp_template/__init__.py +1 -0
- deped_dcp_template-0.1.0/src/deped_dcp_template/cleaners.py +596 -0
- deped_dcp_template-0.1.0/src/deped_dcp_template/constants.py +512 -0
- deped_dcp_template-0.1.0/src/deped_dcp_template/entities.py +63 -0
- deped_dcp_template-0.1.0/src/deped_dcp_template/io.py +70 -0
- deped_dcp_template-0.1.0/src/deped_dcp_template/personnel.py +56 -0
- deped_dcp_template-0.1.0/tests/test_cleaners.py +106 -0
- deped_dcp_template-0.1.0/tests/test_entities.py +43 -0
- deped_dcp_template-0.1.0/tests/test_io_and_constants.py +78 -0
- deped_dcp_template-0.1.0/uv.lock +308 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Example UV CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
uv-example:
|
|
11
|
+
name: Python (UV)
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- name: Checkout the repository
|
|
16
|
+
uses: actions/checkout@main
|
|
17
|
+
|
|
18
|
+
- name: Install the latest version of uv
|
|
19
|
+
uses: astral-sh/setup-uv@v7
|
|
20
|
+
with:
|
|
21
|
+
enable-cache: true
|
|
22
|
+
|
|
23
|
+
- name: Install the project with UV
|
|
24
|
+
run: uv sync --locked --all-extras --dev
|
|
25
|
+
|
|
26
|
+
- name: Install Dependencies
|
|
27
|
+
run: |
|
|
28
|
+
uv tool install pre-commit --with pre-commit-uv
|
|
29
|
+
pre-commit install-hooks
|
|
30
|
+
|
|
31
|
+
- name: Lint with pre-commit
|
|
32
|
+
run: pre-commit run --all-files
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: uv run pytest
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
default_language_version:
|
|
2
|
+
python: python3.14
|
|
3
|
+
|
|
4
|
+
repos:
|
|
5
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
6
|
+
rev: v6.0.0
|
|
7
|
+
hooks:
|
|
8
|
+
- id: check-added-large-files
|
|
9
|
+
- id: end-of-file-fixer
|
|
10
|
+
- id: trailing-whitespace
|
|
11
|
+
- id: name-tests-test
|
|
12
|
+
args: ["--django"]
|
|
13
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
14
|
+
# Ruff version.
|
|
15
|
+
rev: v0.15.8
|
|
16
|
+
hooks:
|
|
17
|
+
# Run the linter.
|
|
18
|
+
- id: ruff-check
|
|
19
|
+
args: [ --fix ]
|
|
20
|
+
# Run the formatter.
|
|
21
|
+
- id: ruff-format
|
|
22
|
+
types_or: [ python, pyi, jupyter ]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deped-dcp-template
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Shared runtime helpers for DepEd DCP data-cleaning packages.
|
|
5
|
+
Requires-Python: >=3.14
|
|
6
|
+
Requires-Dist: email-validator>=2.3.0
|
|
7
|
+
Requires-Dist: rich>=14.3.3
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
|
|
10
|
+
# deped-dcp-template
|
|
11
|
+
|
|
12
|
+
`deped-dcp-template` is a shared runtime library for the DepEd DCP package set.
|
|
13
|
+
|
|
14
|
+
It owns reusable Python helpers that were previously duplicated across
|
|
15
|
+
`deped-personnel`, `deped-equipment`, and `deped-connectivity`, including:
|
|
16
|
+
|
|
17
|
+
- text, identifier, date, phone, email, and position normalization
|
|
18
|
+
- CSV row iteration and progress helpers
|
|
19
|
+
- common governance entity helpers
|
|
20
|
+
- shared personnel-loader utility functions
|
|
21
|
+
- canonical constant tables and lookup-extension hooks
|
|
22
|
+
|
|
23
|
+
This package does not own SQL schemas, workbook extraction, or SQLite artifact
|
|
24
|
+
contracts. Those remain package-local in `deped-asset`.
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
Published dependency:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv add deped-dcp-template
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Local development against a sibling checkout:
|
|
35
|
+
|
|
36
|
+
```toml
|
|
37
|
+
[tool.uv.sources]
|
|
38
|
+
deped-dcp-template = { path = "../deped-dcp-template" }
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Tests
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv run pytest -q
|
|
45
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# deped-dcp-template
|
|
2
|
+
|
|
3
|
+
`deped-dcp-template` is a shared runtime library for the DepEd DCP package set.
|
|
4
|
+
|
|
5
|
+
It owns reusable Python helpers that were previously duplicated across
|
|
6
|
+
`deped-personnel`, `deped-equipment`, and `deped-connectivity`, including:
|
|
7
|
+
|
|
8
|
+
- text, identifier, date, phone, email, and position normalization
|
|
9
|
+
- CSV row iteration and progress helpers
|
|
10
|
+
- common governance entity helpers
|
|
11
|
+
- shared personnel-loader utility functions
|
|
12
|
+
- canonical constant tables and lookup-extension hooks
|
|
13
|
+
|
|
14
|
+
This package does not own SQL schemas, workbook extraction, or SQLite artifact
|
|
15
|
+
contracts. Those remain package-local in `deped-asset`.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
Published dependency:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
uv add deped-dcp-template
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Local development against a sibling checkout:
|
|
26
|
+
|
|
27
|
+
```toml
|
|
28
|
+
[tool.uv.sources]
|
|
29
|
+
deped-dcp-template = { path = "../deped-dcp-template" }
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Tests
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
uv run pytest -q
|
|
36
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
This repository centralizes runtime code that is shared across multiple DepEd
|
|
6
|
+
DCP data-cleaning packages.
|
|
7
|
+
|
|
8
|
+
The goal is to keep shared behavior consistent while leaving domain-specific
|
|
9
|
+
artifact rules in the owning package.
|
|
10
|
+
|
|
11
|
+
## Ownership Boundary
|
|
12
|
+
|
|
13
|
+
`deped-dcp-template` owns:
|
|
14
|
+
|
|
15
|
+
- reusable pure helpers
|
|
16
|
+
- reusable constant tables
|
|
17
|
+
- reusable CSV/progress helpers
|
|
18
|
+
- reusable entity key and naming helpers
|
|
19
|
+
- small shared loader utilities
|
|
20
|
+
|
|
21
|
+
Consumer packages own:
|
|
22
|
+
|
|
23
|
+
- SQL schema definitions
|
|
24
|
+
- views and indexes
|
|
25
|
+
- CLI entrypoints
|
|
26
|
+
- domain-specific build pipelines
|
|
27
|
+
- domain-specific normalization policy beyond the shared baseline
|
|
28
|
+
|
|
29
|
+
## Public API
|
|
30
|
+
|
|
31
|
+
Stable import surface:
|
|
32
|
+
|
|
33
|
+
- `deped_dcp_template.constants`
|
|
34
|
+
- `deped_dcp_template.cleaners`
|
|
35
|
+
- `deped_dcp_template.io`
|
|
36
|
+
- `deped_dcp_template.entities`
|
|
37
|
+
- `deped_dcp_template.personnel`
|
|
38
|
+
|
|
39
|
+
Consumers should prefer importing from these module boundaries rather than
|
|
40
|
+
reaching into private implementation details.
|
|
41
|
+
|
|
42
|
+
## Design Rules
|
|
43
|
+
|
|
44
|
+
- Shared helpers must stay domain-agnostic unless a behavior is already reused
|
|
45
|
+
by multiple consumers.
|
|
46
|
+
- Consumer packages must not import runtime code from each other.
|
|
47
|
+
- Cross-domain data exchange should still happen through artifacts, not through
|
|
48
|
+
direct Python access to another package's database-building code.
|
|
49
|
+
- If a helper change would alter domain semantics, the owning consumer package
|
|
50
|
+
should keep that overlay locally.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
## Adding Shared Code
|
|
4
|
+
|
|
5
|
+
Add code here only when all of the following are true:
|
|
6
|
+
|
|
7
|
+
- the behavior is reused by more than one consumer package
|
|
8
|
+
- the shared API can be expressed without pulling in domain-specific schema or
|
|
9
|
+
CLI concerns
|
|
10
|
+
- the behavior has unit tests in this repository
|
|
11
|
+
|
|
12
|
+
## Keeping Package Boundaries Clear
|
|
13
|
+
|
|
14
|
+
Good candidates for this repo:
|
|
15
|
+
|
|
16
|
+
- parsing helpers
|
|
17
|
+
- normalization helpers
|
|
18
|
+
- constant registries
|
|
19
|
+
- reusable row-loading utilities
|
|
20
|
+
|
|
21
|
+
Poor candidates for this repo:
|
|
22
|
+
|
|
23
|
+
- SQL DDL
|
|
24
|
+
- end-to-end build commands
|
|
25
|
+
- workbook-specific extraction flows
|
|
26
|
+
- package-specific audit outputs
|
|
27
|
+
|
|
28
|
+
## Change Workflow
|
|
29
|
+
|
|
30
|
+
1. Update the shared module in `src/deped_dcp_template/`.
|
|
31
|
+
2. Add or update unit tests in `tests/`.
|
|
32
|
+
3. Run `uv run pytest -q`.
|
|
33
|
+
4. Verify downstream consumer packages still pass their own tests.
|
|
34
|
+
|
|
35
|
+
## Compatibility Guidance
|
|
36
|
+
|
|
37
|
+
- Keep public function names stable when possible.
|
|
38
|
+
- Prefer additive changes over breaking renames.
|
|
39
|
+
- If a consumer needs stricter behavior than the shared default, keep a local
|
|
40
|
+
wrapper or overlay in that consumer package.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
## Requirements
|
|
4
|
+
|
|
5
|
+
- Python 3.14+
|
|
6
|
+
- `uv`
|
|
7
|
+
|
|
8
|
+
## Install For Development
|
|
9
|
+
|
|
10
|
+
From this repository:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
uv sync
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Run the package tests:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
uv run pytest -q
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Use From a Consumer Repository
|
|
23
|
+
|
|
24
|
+
Published dependency:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
uv add deped-dcp-template
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Sibling checkout during local development:
|
|
31
|
+
|
|
32
|
+
```toml
|
|
33
|
+
[tool.uv.sources]
|
|
34
|
+
deped-dcp-template = { path = "../deped-dcp-template" }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then import from the shared package:
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from deped_dcp_template.cleaners import parse_date
|
|
41
|
+
from deped_dcp_template.io import iter_csv_rows
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Release Shape
|
|
45
|
+
|
|
46
|
+
- distribution name: `deped-dcp-template`
|
|
47
|
+
- import package: `deped_dcp_template`
|
|
48
|
+
- build backend: `hatchling`
|
|
49
|
+
|
|
50
|
+
## Current Test Scope
|
|
51
|
+
|
|
52
|
+
The test suite currently covers:
|
|
53
|
+
|
|
54
|
+
- parsing and normalization helpers
|
|
55
|
+
- entity naming and natural-key helpers
|
|
56
|
+
- low-cardinality alias registration
|
|
57
|
+
- shared loader utility functions
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# deped-dcp-template
|
|
2
|
+
|
|
3
|
+
`deped-dcp-template` is the shared runtime library used by the DepEd DCP
|
|
4
|
+
package set.
|
|
5
|
+
|
|
6
|
+
It exists to hold Python helpers that are reused by multiple domain packages so
|
|
7
|
+
that `deped-personnel`, `deped-equipment`, and `deped-connectivity` do not
|
|
8
|
+
carry divergent copies of the same normalization and loading code.
|
|
9
|
+
|
|
10
|
+
## What This Repo Owns
|
|
11
|
+
|
|
12
|
+
- shared text, identifier, date, phone, email, and position normalization
|
|
13
|
+
- shared CSV iteration and progress helpers
|
|
14
|
+
- shared governance entity helpers
|
|
15
|
+
- shared personnel-loader utility helpers
|
|
16
|
+
- shared canonical constant tables and extension hooks
|
|
17
|
+
|
|
18
|
+
## What This Repo Does Not Own
|
|
19
|
+
|
|
20
|
+
- SQLite schemas, indexes, and views
|
|
21
|
+
- workbook extraction logic
|
|
22
|
+
- domain-specific build orchestration
|
|
23
|
+
- artifact contracts such as `lookups.db`, `personnel.db`, `equipment.db`, and
|
|
24
|
+
`connectivity.db`
|
|
25
|
+
|
|
26
|
+
Those remain package-local in `deped-asset`.
|
|
27
|
+
|
|
28
|
+
## Repository Layout
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
src/deped_dcp_template/ Shared runtime package
|
|
32
|
+
tests/ Package-level unit tests
|
|
33
|
+
docs/ Repository documentation
|
|
34
|
+
.github/workflows/ Release workflow
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Main Modules
|
|
38
|
+
|
|
39
|
+
- `constants`: canonical constant tables and extension hooks
|
|
40
|
+
- `cleaners`: reusable normalization and parsing helpers
|
|
41
|
+
- `io`: CSV iteration and progress utilities
|
|
42
|
+
- `entities`: shared governance entity naming and key helpers
|
|
43
|
+
- `personnel`: shared loader helpers used by personnel-style import flows
|
|
44
|
+
|
|
45
|
+
## Consumer Model
|
|
46
|
+
|
|
47
|
+
Consumers should depend on the published `deped-dcp-template` package. During
|
|
48
|
+
local development, sibling checkouts can be wired through `tool.uv.sources`.
|
|
49
|
+
|
|
50
|
+
Read [Getting Started](getting-started.md) for setup and
|
|
51
|
+
[Architecture](architecture.md) for ownership boundaries.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PYPI_TOKEN=op://dev/pypi/credential
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "deped-dcp-template"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Shared runtime helpers for DepEd DCP data-cleaning packages."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.14"
|
|
7
|
+
dependencies = [
|
|
8
|
+
"email-validator>=2.3.0",
|
|
9
|
+
"rich>=14.3.3",
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
[build-system]
|
|
13
|
+
requires = ["hatchling"]
|
|
14
|
+
build-backend = "hatchling.build"
|
|
15
|
+
|
|
16
|
+
[dependency-groups]
|
|
17
|
+
dev = ["pytest>=9.0", "pytest-cov>=7.0","zensical>=0.0.31",]
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build.targets.wheel]
|
|
20
|
+
packages = ["src/deped_dcp_template"]
|
|
21
|
+
|
|
22
|
+
[tool.pytest.ini_options]
|
|
23
|
+
minversion = "9.0"
|
|
24
|
+
addopts = "-ra -q -vv --cov --doctest-modules"
|
|
25
|
+
testpaths = ["tests"]
|
|
26
|
+
|
|
27
|
+
[tool.ruff]
|
|
28
|
+
line-length = 88
|
|
29
|
+
|
|
30
|
+
[tool.ruff.lint]
|
|
31
|
+
ignore = ["F401", "F403", "E501"]
|
|
32
|
+
fixable = ["F", "E", "W", "I001"]
|
|
33
|
+
select = ["E", "F", "W", "I", "C"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Shared runtime helpers for DepEd DCP packages."""
|