Skip to content

Commit

Permalink
Initial structure of repo
Browse files Browse the repository at this point in the history
  • Loading branch information
simw committed Oct 31, 2023
1 parent a79a871 commit 7d5908f
Show file tree
Hide file tree
Showing 8 changed files with 786 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Lint and Test

on: [push, pull_request]

permissions:
contents: read

jobs:

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Bootstrap poetry
run: curl -sSL https://install.python-poetry.org | python - -y

- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Lint
run: make lint


test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Bootstrap poetry
run: curl -sSL https://install.python-poetry.org | python - -y

- name: Configure poetry
run: poetry config virtualenvs.in-project true

- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Run tests
run: make test
58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
.DEFAULT_TARGET: help
sources = src tests


.PHONY: prepare
prepare:
poetry install


.PHONY: lintable
lintable: prepare
poetry run black $(sources)
poetry run ruff --fix $(sources)


.PHONY: lint
lint: prepare
poetry run black --check --diff $(sources)
poetry run ruff check $(sources)
poetry run mypy $(sources)



.PHONY: test
test: prepare
poetry run coverage run -m pytest
poetry run coverage report


.PHONY: clean
clean:
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]'`
rm -f `find . -type f -name '*~'`
rm -f `find . -type f -name '.*~'`
rm -rf .cache
rm -rf .pytest_cache
rm -rf .ruff_cache
rm -rf htmlcov
rm -rf *.egg-info
rm -f .coverage
rm -f .coverage.*
rm -rf build
rm -rf dist
rm -rf coverage.xml


.PHONY: package
package: prepare
poetry build


.PHONY: help
help:
@grep -E \
'^.PHONY: .*?## .*$$' $(MAKEFILE_LIST) | \
sort | \
awk 'BEGIN {FS = ".PHONY: |## "}; {printf "\033[36m%-19s\033[0m %s\n", $$2, $$3}'
570 changes: 570 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions poetry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[virtualenvs]
in-project = true
87 changes: 87 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"


[tool.poetry]
name = "pydantic_to_pyarrow"
version = "0.0.1"
description = ""
authors = ["simw"]
readme = "README.md"
packages = [{include = "pydantic_to_pyarrow", from = "src"}]

[tool.poetry.dependencies]
python = "^3.8"
pydantic = "^2.4.2"
pyarrow = "^13.0.0"
typing-extensions = "^4.8.0"


[tool.poetry.group.lint.dependencies]
black = "^23.9.1"
ruff = "^0.1.3"
mypy = "^1.6.0"


[tool.poetry.group.test.dependencies]
pytest = "^7.4.2"
coverage = "^7.3.2"


[tool.mypy]
strict = true


[tool.black]
color = true
line-length = 88
target-version = ["py38"]


[tool.ruff]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"C", # flake8-comprehensions
"B", # flake8-bugbear
"UP", # pyupgrade
]
ignore = []
line-length = 88
indent-width = 4
target-version = "py38"

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"

[tool.ruff.isort]
known-first-party = ["pydantic_to_pyarrow"]


[tool.pytest.ini_options]
testpaths = "tests"
xfail_strict = true
filterwarnings = [
"error"
]


[tool.coverage.run]
source = ["src/pydantic-to-pyarrow"]
branch = true

[tool.coverage.report]
precision = 2
exclude_lines = [
'pragma: no cover',
'raise NotImplementedError',
'if TYPE_CHECKING:',
'@overload',
]
fail_under = 100
5 changes: 5 additions & 0 deletions src/pydantic_to_pyarrow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
__version__ = "0.0.1"

__all__ = [
"__version__",
]
Empty file added tests/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import pydantic_to_pyarrow


def test_version() -> None:
assert pydantic_to_pyarrow.__version__ is not None

0 comments on commit 7d5908f

Please sign in to comment.