Skip to content

Commit 48d0fd5

Browse files
authored
chore: refactor release process (#1170)
1 parent c0f86fb commit 48d0fd5

12 files changed

+2339
-58
lines changed

.github/workflows/publish-package.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow publishes the package to pypi.
2+
# For more details:
3+
# https://docs.github.com/en/actions/guides/building-and-testing-python#publishing-to-package-registries
4+
name: Publish to PyPi
5+
6+
on:
7+
release:
8+
types: [created]
9+
workflow_dispatch:
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
# fetch all tags so `versioneer` can properly determine current version
17+
with:
18+
fetch-depth: 0
19+
- name: Check if current commit is tagged
20+
# fails and cancels release if the current commit is not tagged
21+
run: |
22+
git describe --exact-match --tags
23+
- name: Set up Python
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: '3.11'
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
if [ -f requirements-ml.txt ]; then pip install -r requirements-ml.txt; fi
32+
if [ -f requirements-reports.txt ]; then pip install -r requirements-reports.txt; fi
33+
pip install setuptools wheel twine
34+
- name: Build
35+
env:
36+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
37+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
38+
TWINE_REPOSITORY: pypi
39+
run: |
40+
python setup.py sdist bdist_wheel
41+
- name: Test build
42+
# fails and cancels release if the built package fails to import
43+
run: |
44+
pip install dist/*.whl
45+
python -c 'import data_profiler; print(data_profiler.__version__)'
46+
- name: Publish
47+
env:
48+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
49+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
50+
TWINE_REPOSITORY: pypi
51+
run: |
52+
twine upload dist/*

.github/workflows/publish-python-package.yml

-38
This file was deleted.

.github/workflows/test-python-package.yml .github/workflows/test-package.yml

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ on:
77
pull_request:
88
branches:
99
- 'main'
10-
- 'feature/**'
11-
- 'dev'
1210

1311
jobs:
1412
build:

.pre-commit-config.yaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ repos:
55
rev: 22.3.0
66
hooks:
77
- id: black
8+
exclude: (versioneer.py|dataprofiler/_version.py)
89
types: [file, python]
910
language_version: python3
1011
# Isort: sort import statements
@@ -41,7 +42,7 @@ repos:
4142
rev: v0.982
4243
hooks:
4344
- id: mypy
44-
exclude: (^dataprofiler/tests/|^resources/|^examples|venv*/)
45+
exclude: (^dataprofiler/tests/|^resources/|^examples|venv*/|versioneer.py|dataprofiler/_version.py)
4546
language_version: python3
4647
additional_dependencies: # Keep up-to-date with the respective requirement files
4748
[
@@ -117,6 +118,7 @@ repos:
117118
hooks:
118119
- id: pyupgrade
119120
args: ["--py38-plus"]
121+
exclude: (versioneer.py|dataprofiler/_version.py)
120122
# Autoflake - cleanup unused variables and imports
121123
- repo: https://github.com/PyCQA/autoflake
122124
rev: v2.0.0

MANIFEST.in

+2
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ recursive-include resources *.pb
1818
recursive-include resources *.py
1919

2020
recursive-include dataprofiler/labelers/embeddings/ *.txt
21+
include versioneer.py
22+
include dataprofiler/_version.py

dataprofiler/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Package for dataprofiler."""
22
from . import settings
3+
from ._version import get_versions
34
from .data_readers.data import Data
45
from .dp_logging import get_logger, set_verbosity
56
from .labelers.data_labelers import (
@@ -18,7 +19,8 @@
1819
from .profilers.profiler_options import ProfilerOptions
1920
from .reports import graphs
2021
from .validators.base_validators import Validator
21-
from .version import __version__
22+
23+
__version__ = get_versions()["version"]
2224

2325

2426
def set_seed(seed=None):

0 commit comments

Comments
 (0)