-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* `flit init` * Init * Update * Update * Update * Update * Update * Format
- Loading branch information
Showing
70 changed files
with
32,406 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
* @yu-iskw |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Publish (pypi) | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish | ||
- name: Install Flit | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: bash dev/setup.sh | ||
- name: Publish | ||
env: | ||
# SEE https://packaging.python.org/en/latest/specifications/pypirc/?highlight=token#using-a-pypi-token | ||
FLIT_USERNAME: __token__ | ||
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: bash dev/publish.sh "pypi" | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Test publish (testpypi) | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.9" | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-publish | ||
- name: Install Flit | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: bash dev/setup.sh | ||
- name: Test publish | ||
env: | ||
# SEE https://packaging.python.org/en/latest/specifications/pypirc/?highlight=token#using-a-pypi-token | ||
FLIT_USERNAME: __token__ | ||
FLIT_PASSWORD: ${{ secrets.TESTPYPI_API_TOKEN }} | ||
run: bash dev/publish.sh "testpypi" | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Test python | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- 'pyproject.toml' | ||
- 'dbt_artifacts_parser/**/*.py' | ||
- 'tests/**/*.py' | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.7", "3.8", "3.9", "3.10"] | ||
fail-fast: false | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ runner.os }}-python-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}-test | ||
- name: Install Flit | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
run: bash dev/setup.sh | ||
- name: Lint | ||
if: ${{ matrix.python-version != '3.6' }} | ||
run: bash dev/lint_python.sh | ||
- name: Test | ||
run: bash dev/test_python.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[distutils] | ||
index-servers = | ||
pypi | ||
testpypi | ||
|
||
[pypi] | ||
repository=https://upload.pypi.org/legacy/ | ||
|
||
[testpypi] | ||
repository=https://test.pypi.org/legacy/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[style] | ||
based_on_style = google |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
exclude .git | ||
exclude .gitignore | ||
exclude tests | ||
exclude .style.yapf | ||
exclude Makefile | ||
exclude pylintrc | ||
exclude __pycache__ | ||
exclude dbt_artifacts_parser/resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Set up an environment | ||
.PHONEY: setup | ||
setup: | ||
bash ./dev/setup.sh | ||
|
||
# Check all the coding style. | ||
.PHONY: lint | ||
lint: lint-shell lint-python | ||
|
||
# Check the coding style for the shell scripts. | ||
.PHONY: lint-shell | ||
lint-shell: | ||
shellcheck ./dev/*.sh | ||
|
||
# Check the coding style for the python files. | ||
.PHONY: lint-python | ||
lint-python: | ||
bash ./dev/lint_python.sh | ||
|
||
# Format source codes | ||
format: format-python | ||
|
||
# Format python codes | ||
format-python: | ||
bash ./dev/format_python.sh | ||
|
||
# Run the unit tests. | ||
.PHONEY: test | ||
test: | ||
bash ./dev/test_python.sh | ||
|
||
# Build the package | ||
build: clean format test | ||
flit build | ||
|
||
clean: | ||
bash ./dev/clean.sh | ||
|
||
# Publish to pypi | ||
publish: | ||
bash ./dev/publish.sh "pypi" | ||
|
||
# Publish to testpypi | ||
test-publish: | ||
bash ./dev/publish.sh "testpypi" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,155 @@ | ||
[](https://github.com/yu-iskw/dbt-artifacts-parser/actions/workflows/test.yml) | ||
<a href="https://pypi.org/project/dbt-artifacts-parser" target="_blank"> | ||
<img src="https://img.shields.io/pypi/v/dbt-artifacts-parser?color=%2334D058&label=pypi%20package" alt="Package version"> | ||
</a> | ||
<a href="https://pypi.org/project/dbt-artifacts-parser" target="_blank"> | ||
<img src="https://img.shields.io/pypi/pyversions/dbt-artifacts-parser.svg?color=%2334D058" alt="Supported Python versions"> | ||
</a> | ||
|
||
|
||
# dbt-artifacts-parser | ||
A dbt artifacts parser in python | ||
This is a dbt artifacts parse in python. | ||
It enables us to deal with `catalog.json`, `manifest.json`, `run-results.json` and `sources.json` as python objects. | ||
|
||
## Installation | ||
|
||
```bash | ||
pip install -U dbt-artifacts-parser | ||
``` | ||
|
||
## Example | ||
|
||
### Parse catalog.json | ||
```python | ||
import yaml | ||
|
||
# parse any version of catalog.json | ||
from dbt_artifacts_parser.parser import parse_catalog | ||
|
||
with open("path/to/catalog.json", "r") as fp: | ||
catalog_dict = yaml.safe_load(fp) | ||
catalog_obj = parse_catalog(catalog=catalog_dict) | ||
|
||
# parse catalog.json v1 | ||
from dbt_artifacts_parser.parser import parse_catalog_v1 | ||
|
||
with open("path/to/catalog.json", "r") as fp: | ||
catalog_dict = yaml.safe_load(fp) | ||
catalog_obj = parse_catalog_v1(catalog=catalog_dict) | ||
``` | ||
|
||
### Parse manifest.json | ||
|
||
```python | ||
import yaml | ||
|
||
# parse any version of manifest.json | ||
from dbt_artifacts_parser.parser import parse_manifest | ||
|
||
with open("path/to/manifest.json", "r") as fp: | ||
manifest_dict = yaml.safe_load(fp) | ||
manifest_obj = parse_manifest(manifest=manifest_dict) | ||
|
||
# parse manifest.json v1 | ||
from dbt_artifacts_parser.parser import parse_manifest_v1 | ||
|
||
with open("path/to/manifest.json", "r") as fp: | ||
manifest_dict = yaml.safe_load(fp) | ||
manifest_obj = parse_manifest_v1(manifest=manifest_dict) | ||
|
||
# parse manifest.json v2 | ||
from dbt_artifacts_parser.parser import parse_manifest_v2 | ||
|
||
with open("path/to/manifest.json", "r") as fp: | ||
manifest_dict = yaml.safe_load(fp) | ||
manifest_obj = parse_manifest_v2(manifest=manifest_dict) | ||
|
||
# parse manifest.json v3 | ||
from dbt_artifacts_parser.parser import parse_manifest_v3 | ||
|
||
with open("path/to/manifest.json", "r") as fp: | ||
manifest_dict = yaml.safe_load(fp) | ||
manifest_obj = parse_manifest_v3(manifest=manifest_dict) | ||
|
||
# parse manifest.json v4 | ||
from dbt_artifacts_parser.parser import parse_manifest_v4 | ||
|
||
with open("path/to/manifest.json", "r") as fp: | ||
manifest_dict = yaml.safe_load(fp) | ||
manifest_obj = parse_manifest_v4(manifest=manifest_dict) | ||
``` | ||
|
||
### Parse run-results.json | ||
|
||
```python | ||
import yaml | ||
|
||
# parse any version of run-results.json | ||
from dbt_artifacts_parser.parser import parse_run_results | ||
|
||
with open("path/to/run-resultsjson", "r") as fp: | ||
run_results_dict = yaml.safe_load(fp) | ||
run_results_obj = parse_run_results(run_results=run_results_dict) | ||
|
||
# parse run-results.json v1 | ||
from dbt_artifacts_parser.parser import parse_run_results_v1 | ||
|
||
with open("path/to/run-results.json", "r") as fp: | ||
run_results_dict = yaml.safe_load(fp) | ||
run_results_obj = parse_run_results_v1(run_results=run_results_dict) | ||
|
||
# parse run-results.json v2 | ||
from dbt_artifacts_parser.parser import parse_run_results_v2 | ||
|
||
with open("path/to/run-results.json", "r") as fp: | ||
run_results_dict = yaml.safe_load(fp) | ||
run_results_obj = parse_run_results_v2(run_results=run_results_dict) | ||
|
||
# parse run-results.json v3 | ||
from dbt_artifacts_parser.parser import parse_run_results_v3 | ||
|
||
with open("path/to/run-results.json", "r") as fp: | ||
run_results_dict = yaml.safe_load(fp) | ||
run_results_obj = parse_run_results_v3(run_results=run_results_dict) | ||
|
||
# parse run-results.json v4 | ||
from dbt_artifacts_parser.parser import parse_run_results_v4 | ||
|
||
with open("path/to/run-results.json", "r") as fp: | ||
run_results_dict = yaml.safe_load(fp) | ||
run_results_obj = parse_run_results_v4(run_results=run_results_dict) | ||
``` | ||
|
||
### Parse sources.json | ||
|
||
```python | ||
import yaml | ||
|
||
# parse any version of sources.json | ||
from dbt_artifacts_parser.parser import parse_sources | ||
|
||
with open("path/to/sources.json", "r") as fp: | ||
sources_dict = yaml.safe_load(fp) | ||
sources_obj = parse_sources(sources=sources_dict) | ||
|
||
# parse sources.json v1 | ||
from dbt_artifacts_parser.parser import parse_sources_v1 | ||
|
||
with open("path/to/sources.json", "r") as fp: | ||
sources_dict = yaml.safe_load(fp) | ||
sources_obj = parse_sources_v1(sources=sources_dict) | ||
|
||
# parse sources.json v2 | ||
from dbt_artifacts_parser.parser import parse_sources_v2 | ||
|
||
with open("path/to/sources.json", "r") as fp: | ||
sources_dict = yaml.safe_load(fp) | ||
sources_obj = parse_sources_v2(sources=sources_dict) | ||
|
||
# parse sources.json v3 | ||
from dbt_artifacts_parser.parser import parse_sources_v3 | ||
|
||
with open("path/to/sources.json", "r") as fp: | ||
sources_dict = yaml.safe_load(fp) | ||
sources_obj = parse_sources_v3(sources=sources_dict) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); you may not use this file except in compliance with | ||
# the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
""" | ||
A dbt artifacts parser in python | ||
""" | ||
__version__ = "0.1.0-rc1" |
Oops, something went wrong.