Fix #1670: Python generated code is missing when using pip install git+https (#1799)

This commit is contained in:
Alberto Miorin 2021-12-21 06:37:36 +01:00 committed by GitHub
parent ec1e3a2d61
commit 09011d4259
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 114 additions and 0 deletions

43
.github/workflows/py-generate2.yml vendored Normal file
View File

@ -0,0 +1,43 @@
# Copyright 2021 Collate
# Licensed 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.
name: Validate Pydantic Models 2
on:
pull_request:
branches:
- main
paths:
- 'catalog-rest-service/src/main/resources/json/**'
jobs:
validate:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ingestion-generated
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Ubuntu related dependencies
run: |
sudo apt-get install -y libsasl2-dev unixodbc-dev python3-venv
- name: Install Python
run: |
python3 -m venv env
- name: Generate models
run: |
source env/bin/activate
make generate

View File

@ -0,0 +1,15 @@
generate:
mkdir -p src/metadata/generated
python3 -m pip install --upgrade pip setuptools
python3 -m pip install --upgrade -r requirements-dev.txt
datamodel-codegen --input ../catalog-rest-service/src/main/resources/json --input-file-type jsonschema --output src/metadata/generated
clean:
rm -rf src/metadata/generated
rm -rf build
rm -rf dist
publish: clean generate
python setup.py install sdist bdist_wheel
twine check dist/*
twine upload dist/*

View File

@ -0,0 +1,14 @@
---
This guide will help you setup the Ingestion framework and connectors
---
![Python version 3.8+](https://img.shields.io/badge/python-3.8%2B-blue)
OpenMetadata Ingesiton is a simple framework to build connectors and ingest metadata of various systems through OpenMetadata APIs. It could be used in an orchestration framework(e.g. Apache Airflow) to ingest metadata.
**Prerequisites**
- Python >= 3.8.x
### Docs
Please refer to the documentation here https://docs.open-metadata.org/connectors

View File

@ -0,0 +1,3 @@
datamodel-code-generator==0.11.14
twine
wheel

View File

@ -0,0 +1,39 @@
# Copyright 2021 Collate
# Licensed 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.
import os
from setuptools import setup, find_namespace_packages
def get_long_description():
root = os.path.dirname(__file__)
with open(os.path.join(root, "README.md")) as f:
description = f.read()
return description
setup(name="openmetadata-ingestion-generated",
version="0.5.0",
url="https://open-metadata.org/",
author="OpenMetadata Committers",
license="Apache License 2.0",
description="These are the generated Python classes from JSON Schema",
long_description=get_long_description(),
long_description_content_type="text/markdown",
python_requires=">=3.8",
package_dir={"": "src"},
zip_safe=False,
project_urls={
"Documentation": "https://docs.open-metadata.org/",
"Source": "https://github.com/open-metadata/OpenMetadata",
},
packages=find_namespace_packages(where="./src", exclude=["tests*"]),
)