diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6beb13e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,23 @@ +name: CI +on: [push] + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install dev requirements + run: pip install -r requirements_dev.txt + - name: Check black + run: black --check oc4ids_datastore_pipeline/ tests/ + - name: Check isort + run: isort --check-only oc4ids_datastore_pipeline/ tests/ + - name: Check flake8 + run: flake8 oc4ids_datastore_pipeline/ tests/ + - name: Check mypy + run: mypy oc4ids_datastore_pipeline/ tests/ + - name: Run tests + run: pytest diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..033df5f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.venv +__pycache__ diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..e4fba21 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.12 diff --git a/README.md b/README.md index cf82e6b..3fac6a2 100644 --- a/README.md +++ b/README.md @@ -1 +1,39 @@ -# oc4ids-datastore-pipeline \ No newline at end of file +# OC4IDS Datastore Pipeline + +A Python application to validate and store published OC4IDS datasets. + +## Local Development + +### Prerequisites + +- Python 3.12 + +### Install Python requirements + +``` +python -m venv .venv +source .venv/bin/activate +pip install -r requirements_dev.txt +``` + +### Run app + +``` +pip install -e . +oc4ids-datastore-pipeline +``` + +### Run linting and type checking + +``` +black oc4ids_datastore_pipeline/ tests/ +isort oc4ids_datastore_pipeline/ tests/ +flake8 oc4ids_datastore_pipeline/ tests/ +mypy oc4ids_datastore_pipeline/ tests/ +``` + +### Run tests + +``` +pytest +``` diff --git a/oc4ids_datastore_pipeline/__init__.py b/oc4ids_datastore_pipeline/__init__.py new file mode 100644 index 0000000..c3be62a --- /dev/null +++ b/oc4ids_datastore_pipeline/__init__.py @@ -0,0 +1,9 @@ +import logging +import time + +logging.basicConfig( + level=logging.INFO, + format="%(asctime)s:%(levelname)s:%(name)s:%(message)s", + datefmt="%Y-%m-%dT%H:%M:%S", +) +logging.Formatter.converter = time.gmtime diff --git a/oc4ids_datastore_pipeline/pipeline.py b/oc4ids_datastore_pipeline/pipeline.py new file mode 100644 index 0000000..56081a4 --- /dev/null +++ b/oc4ids_datastore_pipeline/pipeline.py @@ -0,0 +1,7 @@ +import logging + +logger = logging.getLogger(__name__) + + +def run() -> None: + logger.info("Hello World!") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..603c4ba --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,32 @@ +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "oc4ids-datastore-pipeline" +description = "OC4IDS Datastore Pipeline" +version = "0.1.0" +readme = "README.md" +dependencies = [] + +[project.optional-dependencies] +dev = [ + "black", + "isort", + "flake8", + "Flake8-pyproject", + "mypy", + "pytest", +] + +[project.scripts] +oc4ids-datastore-pipeline = "oc4ids_datastore_pipeline.pipeline:run" + +[tool.isort] +profile = "black" + +[tool.flake8] +max-line-length = 88 + +[tool.mypy] +strict = true diff --git a/requirements_dev.txt b/requirements_dev.txt new file mode 100644 index 0000000..b1ce205 --- /dev/null +++ b/requirements_dev.txt @@ -0,0 +1,46 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# pip-compile --extra=dev --output-file=requirements_dev.txt pyproject.toml +# +black==25.1.0 + # via oc4ids-datastore-pipeline (pyproject.toml) +click==8.1.8 + # via black +flake8==7.1.1 + # via + # flake8-pyproject + # oc4ids-datastore-pipeline (pyproject.toml) +flake8-pyproject==1.2.3 + # via oc4ids-datastore-pipeline (pyproject.toml) +iniconfig==2.0.0 + # via pytest +isort==6.0.0 + # via oc4ids-datastore-pipeline (pyproject.toml) +mccabe==0.7.0 + # via flake8 +mypy==1.14.1 + # via oc4ids-datastore-pipeline (pyproject.toml) +mypy-extensions==1.0.0 + # via + # black + # mypy +packaging==24.2 + # via + # black + # pytest +pathspec==0.12.1 + # via black +platformdirs==4.3.6 + # via black +pluggy==1.5.0 + # via pytest +pycodestyle==2.12.1 + # via flake8 +pyflakes==3.2.0 + # via flake8 +pytest==8.3.4 + # via oc4ids-datastore-pipeline (pyproject.toml) +typing-extensions==4.12.2 + # via mypy diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py new file mode 100644 index 0000000..af8ff9f --- /dev/null +++ b/tests/test_pipeline.py @@ -0,0 +1,2 @@ +def test_hello_world() -> None: + pass