Skip to content

Commit cbfd543

Browse files
authored
Add docs, refactoring, and simplification (#14)
* Add `FQN` for Entites, Attributes, Groups, and Links * Init documentation * Init a Tutorial * Update dependencies * Remove SqlAlchemy dependency * Simplify interfaces: `migation` and `task` * Refactor tests
1 parent d5f5196 commit cbfd543

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3579
-2616
lines changed

.github/workflows/docs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
workflow_call:
3+
4+
jobs:
5+
docs:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v3
9+
- run: pipx install poetry
10+
- uses: actions/setup-python@v4
11+
with:
12+
python-version: "3.10"
13+
cache: "poetry"
14+
- run: poetry install
15+
16+
- run: poetry run pydoc-markdown
17+
18+
- run: poetry run mkdocs gh-deploy --force
19+
working-directory: docs/build

.github/workflows/lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
- uses: actions/checkout@v3
99
- uses: psf/black@stable
1010
with:
11-
version: "23.1.0"
11+
version: "23.3.0"
1212

1313
isort:
1414
runs-on: ubuntu-latest

.github/workflows/release.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
name: "Release"
22

33
on:
4-
push:
5-
tags: [ "*.*.*" ]
4+
release:
5+
types: [ published ]
66

77
concurrency:
8-
group: ${{ github.workflow }}-${{ github.ref }}
8+
group: ${{ github.workflow }}
99
cancel-in-progress: true
1010

11+
permissions:
12+
contents: write
13+
1114
jobs:
1215
lint:
1316
uses: ./.github/workflows/lint.yaml
@@ -33,3 +36,7 @@ jobs:
3336
- run: poetry build
3437
- run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
3538
- run: poetry publish
39+
40+
docs:
41+
needs: [ pypi ]
42+
uses: ./.github/workflows/docs.yaml

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ htmlcov/
1111
.env
1212

1313
state.json
14+
coinmarket.json
15+
16+
docs/build

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/psf/black
3-
rev: 23.1.0
3+
rev: 23.3.0
44
hooks:
55
- id: black
66
language_version: python3.10

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ test:
66

77
lines:
88
@poetry run pygount --format=summary --suffix=py hnhm/
9+
10+
lines-all:
11+
@poetry run pygount --format=summary --suffix=py hnhm/ tests/

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
# <img src="assets/logo.png" height="40px">
1+
# <img src="docs/assets/logo.png" height="40px">
22
[![codecov](https://codecov.io/gh/marchinho11/hnhm/branch/main/graph/badge.svg?token=PFB1111T2D)](https://codecov.io/gh/marchinho11/hnhm)
33
[![Release](https://github.com/marchinho11/hnhm/actions/workflows/release.yaml/badge.svg?branch=main&event=push)](https://github.com/marchinho11/hnhm/actions/workflows/release.yaml)
44
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
5+
[![Downloads](https://static.pepy.tech/personalized-badge/hnhm?period=week&units=international_system&left_color=black&right_color=brightgreen&left_text=PyPi%20/%20week)](https://pepy.tech/project/hnhm)
6+
[![Downloads](https://static.pepy.tech/personalized-badge/hnhm?period=total&units=international_system&left_color=black&right_color=brightgreen&left_text=PyPi%20/%20total)](https://pepy.tech/project/hnhm)
7+
![Visitors](https://api.visitorbadge.io/api/combined?path=marchinho11%2Fhnhm&label=Visitors&labelColor=%23000000&countColor=%2347c21a&style=flat&labelStyle=none)
58

69
**hNhM**(highly Normalized hybrid Model) – data modeling methodology based on Anchor modeling and Data Vault. Implementation of this package is based on report **"How we implemented our data storage model — highly Normalized hybrid Model"** by Evgeny Ermakov and Nikolai Grebenshchikov.
710
[1) Yandex Report, habr.com](https://habr.com/ru/company/yandex/blog/557140/). [2) SmartData Conference, youtube.com](https://youtu.be/2fPqDvHsd0w)
8-
11+
* [Documentation](#documentation)
912
* [Basic hNhM concepts](#basic-hnhm-concepts)
1013
* [Quick Start](#quick-start)
11-
* [DWH example](#dwh-example)
12-
* [Guide](#guide)
14+
15+
### Documentation
16+
https://marchinho11.github.io/hnhm
1317

1418
### Basic hNhM concepts
1519
**Logical level**
@@ -34,9 +38,10 @@ Install `hnhm` library
3438
pip install hnhm
3539
```
3640

37-
Create a directory with the name `dwh` and put the `__init__.py` file there with the following contents:
41+
Create a directory with the name `dwh` and put the `__hnhm__.py` file there with the following contents:
42+
3843
```python
39-
# dwh/__init__.py
44+
# dwh/__hnhm__.py
4045
from hnhm import (
4146
Layout,
4247
LayoutType,
@@ -46,8 +51,8 @@ from hnhm import (
4651
HnHm,
4752
HnhmEntity,
4853
HnhmRegistry,
49-
FileStorage,
50-
PostgresSqlalchemySql
54+
FileState,
55+
PostgresPsycopgSql
5156
)
5257

5358

@@ -63,12 +68,13 @@ class User(HnhmEntity):
6368

6469
__keys__ = [user_id]
6570

66-
67-
__registry__ = HnhmRegistry(
71+
sql=PostgresPsycopgSql(database="hnhm", user="postgres")
72+
73+
registry = HnhmRegistry(
6874
entities=[User()],
6975
hnhm=HnHm(
70-
storage=FileStorage("state.json"),
71-
sql=PostgresSqlalchemySql(database="hnhm", user="postgres"),
76+
state=FileState("state.json"),
77+
sql=sql,
7278
),
7379
)
7480
```
@@ -79,7 +85,7 @@ $ hnhm apply dwh
7985

8086
Plan:
8187

82-
+ entity 'user'
88+
+ entity 'HNHM.user'
8389
+ view 'user'
8490
+ hub 'user'
8591
+ attribute 'age'
@@ -107,8 +113,3 @@ view: entity__user
107113
│ + _loaded_at │
108114
└───────────────────┘
109115
```
110-
111-
## DWH example
112-
Full DWH example including Entities, Links and Flows can be found in the [`dwh/`](dwh/) directory.
113-
114-
## Guide

docs/assets/color_scheme.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[data-md-color-scheme="slate"] {
2+
--md-primary-fg-color: #2e303e; /* Panel */
3+
--md-default-bg-color: #2e303e; /* BG */
4+
--md-typeset-a-color: #8e91aa;
5+
--md-accent-fg-color: #658eda
6+
}

docs/assets/favicon.png

868 Bytes
Loading
File renamed without changes.

0 commit comments

Comments
 (0)