Skip to content

Commit 11726ed

Browse files
authored
Modernize Python Client packaging (#104)
Accompanying apache/airflow#36763 where we fix and modernize the way how Python client gets generated, this on is result of applying the modernisation: * converting project configuration to pyproject.toml and removing all setup.* and requirements files * converting to modern packaging backend (hatchling) to build wheel and sdist packages (with reproducibility) * using hatch test environment definition and coverage to run tests * we deleted release instructions and dev tools (the ones in Airflow will be used to generate and sign the package) * similarly .pre-comit-config.yml is not needed as the client gets generated in the Apache Airflow project. All those are going to be maintained in Apache Airflow project as part of apache/airflow#36763 as a single source of truth - when new Python client gets released the project files will be overwritten from those prepare from Airflow project, this is just initial PR to seed the new
1 parent bc7f81e commit 11726ed

20 files changed

+6319
-1024
lines changed

.github/workflows/ci.yml

+18-24
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,30 @@ on:
77
branches: ['main']
88

99
jobs:
10-
lint:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@main
15-
- uses: actions/setup-python@v2
16-
with:
17-
python-version: '3.x'
18-
- name: Run precommit hooks
19-
run: |
20-
pip install pre-commit
21-
pre-commit run --all-files
2210
build:
2311
runs-on: ubuntu-latest
24-
strategy:
25-
matrix:
26-
python_version: ["3.7", "3.8", "3.9", "3.10"]
2712
steps:
2813
- name: Checkout
2914
uses: actions/checkout@main
30-
3115
- name: Set up Python
32-
uses: actions/setup-python@v2
16+
uses: actions/setup-python@v5
3317
with:
34-
python-version: ${{ matrix.python_version }}
35-
id: python
36-
37-
- name: Run pytest
18+
python-version: 3.8
19+
cache: 'pip'
20+
- name: Install hatch
3821
run: |
39-
pip install -r test-requirements.txt
40-
pytest test
22+
python -m pip install --upgrade pipx
23+
pipx install hatch
24+
- name: Run tests
25+
run: hatch run run-coverage
4126
env:
42-
PYTEST_ADDOPTS: "--color=yes"
27+
HATCH_ENV: "test"
28+
- name: Build packages
29+
run: hatch build -c -t sdist -t wheel
30+
- name: "Upload packages"
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: packages
34+
path: ./dist/apache_airflow_client-*
35+
retention-days: 7
36+
if-no-files-found: error

.gitignore

+9-67
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,9 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
5-
6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
env/
12-
build/
13-
develop-eggs/
14-
dist/
15-
downloads/
16-
eggs/
17-
.eggs/
18-
.idea/
19-
lib/
20-
lib64/
21-
parts/
22-
sdist/
23-
var/
24-
*.egg-info/
25-
.installed.cfg
26-
*.egg
27-
28-
# PyInstaller
29-
# Usually these files are written by a python script from a template
30-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
31-
*.manifest
32-
*.spec
33-
34-
# Installer logs
35-
pip-log.txt
36-
pip-delete-this-directory.txt
37-
38-
# Unit test / coverage reports
39-
htmlcov/
40-
.tox/
41-
.coverage
42-
.coverage.*
43-
.cache
44-
nosetests.xml
45-
coverage.xml
46-
*,cover
47-
.hypothesis/
48-
venv/
49-
.venv/
50-
.python-version
51-
.pytest_cache
52-
53-
# Translations
54-
*.mo
55-
*.pot
56-
57-
# Django stuff:
58-
*.log
59-
60-
# Sphinx documentation
61-
docs/_build/
62-
63-
# PyBuilder
64-
target/
65-
66-
#Ipython Notebook
67-
.ipynb_checkpoints
1+
/airflow_client
2+
/docs
3+
/dist
4+
/test
5+
/tmp
6+
/v1.yaml
7+
/.coverage
8+
/apache_airflow_client.egg-info/
9+
/.idea

.openapi-generator-ignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.travis.yml
2+
git_push.sh
3+
.gitlab-ci.yml
4+
requirements.txt
5+
setup.cfg
6+
setup.py
7+
test-requirements.txt
8+
tox.ini

.pre-commit-config.yaml

-84
This file was deleted.

0 commit comments

Comments
 (0)