Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 68 additions & 69 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,35 @@ name: dac actions
on:
push:
branches:
- '*'
- "*"
tags:
- '*'
- "*"

jobs:

check-style:
runs-on: ubuntu-latest
steps:
- name: Checkout 🔖
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Setup cache 💾
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit
- name: Prepare pre-commit 🙆‍♂️👗
run: |
python -m venv venv || . venv/bin/activate
pip install -U pip wheel setuptools pre-commit
pre-commit install
- name: Run pre-commit 👗🚀
run: |
pre-commit run --all-files
- name: Checkout 🔖
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Setup cache 💾
uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit
- name: Prepare pre-commit 🙆‍♂️👗
run: |
python -m venv venv || . venv/bin/activate
pip install -U pip wheel setuptools pre-commit
pre-commit install
- name: Run pre-commit 👗🚀
run: |
pre-commit run --all-files

test:
runs-on: "${{ matrix.os }}"
Expand All @@ -41,60 +40,60 @@ jobs:
os: ["ubuntu-latest"]
version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout 🔖
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.version }}"
- name: Prepare tests 🙆‍♂️🔬
run: |
python -m venv venv || . venv/bin/activate
pip install -U pip wheel setuptools
pip install -r requirements-test.txt
- name: Run tests 🔬🚀
run: |
pytest test --run-slow
- name: Checkout 🔖
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.version }}"
- name: Prepare tests 🙆‍♂️🔬
run: |
python -m venv venv || . venv/bin/activate
pip install -U pip wheel setuptools
pip install -r requirements-test.txt
- name: Run tests 🔬🚀
run: |
pytest test --run-slow

docs:
needs: [test, check-style]
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🔖
uses: actions/checkout@v3
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: mkdocs.yml
REQUIREMENTS: requirements-docs.txt
- name: Checkout 🔖
uses: actions/checkout@v3
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CONFIG_FILE: mkdocs.yml
REQUIREMENTS: requirements-docs.txt

pypi-release:
needs: [test, check-style]
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout 🔖
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Prepare release 🙆‍♂️📦test
run: |
python -m venv venv || . venv/bin/activate
pip install -U pip wheel setuptools build twine
- name: Build 🛠️📦
run: |
python -m build
- name: Release 📦🚀
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
python -m twine upload dist/*
- name: Checkout 🔖
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Setup python 🐍
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Prepare release 🙆‍♂️📦test
run: |
python -m venv venv || . venv/bin/activate
pip install -U pip wheel setuptools build twine
- name: Build 🛠️📦
run: |
python -m build
- name: Release 📦🚀
env:
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
python -m twine upload dist/*
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Anything MAY change at any time. The public API SHOULD NOT be considered stable.").
While in this phase, we will denote breaking changes with a minor increase.

## 0.4.3

### Fixed

* Bump all dependencies to the latest version and introduce necessary adaptation in the source code (affecting only `dac info`):
- `build~=0.9` -> `build==1.2.2`
- `toml~=0.10` -> `toml==0.10.2`
- `typer[all]~=0.7` -> `typer[all]==0.15.2`
- `wheel~=0.38` -> `wheel==0.45.1`
* Prevent installation with python > `3.11`

## 0.4.2

### Fixed
Expand Down
27 changes: 16 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ name = "dac"
dynamic = ["version"]
description = "Tool to distribute data as code"
readme = "README.md"
requires-python = ">=3.9"
requires-python = ">=3.9,<3.12"
license = { text = "MIT" }
authors = [
{ name = "Francesco Calcavecchia", email = "francesco.calcavecchia@gmail.com" },
{ name = "Francesco Calcavecchia", email = "francesco.calcavecchia@gmail.com" },
]
maintainers = [
{ name = "Francesco Calcavecchia", email = "francesco.calcavecchia@gmail.com" },
{ name = "Francesco Calcavecchia", email = "francesco.calcavecchia@gmail.com" },
]
classifiers = [
"Programming Language :: Python :: 3",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Topic :: Software Development :: Build Tools",
"License :: OSI Approved :: MIT License",
"Topic :: Scientific/Engineering",
"Operating System :: OS Independent",
]

dependencies = ["build~=0.9", "toml~=0.10", "typer[all]~=0.7", "wheel~=0.38"]
dependencies = [
"build==1.2.2",
"toml==0.10.2",
"typer[all]==0.15.2",
"wheel==0.45.1",
]

# [project.optional-dependencies]
#
Expand Down
6 changes: 3 additions & 3 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-e .
pandas~=1.5
pandera~=0.13
pandas~=2.2
pandera~=0.23.1
pyarrow
pytest~=7.2
pytest~=8.3
10 changes: 7 additions & 3 deletions src/dac/_cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import platform
import re
import sys
from importlib.metadata import requires, version
from importlib.metadata import PackageNotFoundError, requires, version
from pathlib import Path
from typing import Optional

Expand Down Expand Up @@ -105,8 +106,11 @@ def info():
requirements = requires(dac.__name__)
assert requirements is not None
for r in requirements:
lib_name = r.split(" ")[0]
table.add_row(lib_name, version(lib_name.split("[")[0]))
lib_name = re.match(r"^[a-zA-Z0-9]*", r).group(0)
try:
table.add_row(lib_name, version(lib_name.split("[")[0]))
except PackageNotFoundError as e:
table.add_row(lib_name, e.msg)
table.add_row("python", sys.version)
table.add_row("platform", platform.platform())
console.print(table)
Expand Down
13 changes: 7 additions & 6 deletions test/cli_utilities.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
from tempfile import TemporaryDirectory
from typing import Optional

from click.testing import Result
from typer.testing import CliRunner

from dac._cli import app
from dac._input.config import PackConfig
from test.data import (
generate_random_project_name,
get_path_to_self_contained_load_as_pandas,
get_path_to_self_contained_schema,
get_test_project_version,
)
from typing import Optional

from click.testing import Result
from dac._cli import app
from dac._input.config import PackConfig
from typer.testing import CliRunner

runner = CliRunner()

Expand Down
4 changes: 3 additions & 1 deletion test/data/load/parquet_as_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@


def load() -> pd.DataFrame:
return pd.read_parquet(Path(__file__).parent / "sample.parquet")
df = pd.read_parquet(Path(__file__).parent / "sample.parquet")
df["datetime1"] = df["datetime1"].astype("datetime64[ns]")
return df
4 changes: 2 additions & 2 deletions test/data/requirements/parquet_as_pandas.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pandas~=1.0
pandas~=2.0
pyarrow
pandera~=0.13.4
pandera~=0.23.1
2 changes: 1 addition & 1 deletion test/data/schema/incompatible_with_sample_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pandera.typing import Series


class Schema(pa.SchemaModel):
class Schema(pa.DataFrameModel):
int1: Series[int] = pa.Field(nullable=False)
float1: Series[int] = pa.Field()
string1: Series[float] = pa.Field()
Expand Down
2 changes: 1 addition & 1 deletion test/data/schema/invalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pandera.typing import Series


class SchemaWithWrongName(pa.SchemaModel):
class SchemaWithWrongName(pa.DataFrameModel):
int1: Series[int] = pa.Field(nullable=False)
float1: Series[float] = pa.Field()
string1: Series[str] = pa.Field()
Expand Down
2 changes: 1 addition & 1 deletion test/data/schema/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pandera.typing import Series


class Schema(pa.SchemaModel):
class Schema(pa.DataFrameModel):
int1: Series[int] = pa.Field(nullable=False)
float1: Series[float] = pa.Field()
string1: Series[str] = pa.Field()
Expand Down
2 changes: 1 addition & 1 deletion test/data/schema/self_contained.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from pandera.typing import Series


class Schema(pa.SchemaModel):
class Schema(pa.DataFrameModel):
A: Series[int] = pa.Field(nullable=False)
B: Series[float] = pa.Field(nullable=False)
2 changes: 1 addition & 1 deletion test/data/schema/wrong_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
from pandera.typing import Series


class Schema(pa.SchemaModel):
class Schema(pa.DataFrameModel):
A: Series[int] = pa.Field(nullable=False)
B: Series[float] = pa.Field(nullable=False)
15 changes: 8 additions & 7 deletions test/integration_test/pack_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
from importlib.metadata import version
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Generator, Optional

import pandas as pd
import pandera as pa
import pytest

from dac import PackConfig, PyProjectConfig
from test.cli_utilities import invoke_dac_pack_from_config
from test.data import (
generate_random_project_name,
Expand All @@ -18,12 +25,6 @@
get_test_project_version,
)
from test.data.load import self_contained_as_pandas
from typing import Generator, Optional

import pandas as pd
import pandera as pa
import pytest
from dac import PackConfig, PyProjectConfig


@pytest.mark.slow
Expand Down Expand Up @@ -54,7 +55,7 @@ def test_if_installed_then_can_access_schema():
files_in_wheel_dir = list(Path(config.wheel_dir).iterdir())
with _pip_installed_wheel(path=files_in_wheel_dir[0]):
pkg = import_module(config.pyproject.project_name)
assert issubclass(pkg.Schema, pa.SchemaModel)
assert issubclass(pkg.Schema, pa.DataFrameModel)


@pytest.mark.slow
Expand Down
2 changes: 1 addition & 1 deletion test/unit_test/_cli/info_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib.metadata import version
from test.cli_utilities import invoke_dac_info

import dac
from test.cli_utilities import invoke_dac_info


def test_if_invoke_dac_info_from_shell_then_do_not_raise_error():
Expand Down
Loading