Skip to content

Commit

Permalink
A lot of improvements (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsMoll authored Sep 11, 2024
1 parent 4ddf1fc commit a892780
Show file tree
Hide file tree
Showing 88 changed files with 4,052 additions and 3,259 deletions.
26 changes: 4 additions & 22 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,13 @@ repos:
files: 'cloud\/.*\.py'

# Static type and code checkers below

- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.6.0'
hooks:
- id: flake8
additional_dependencies:
- flake8-comprehensions
- flake8-print
- flake8-mutable
- flake8-pytest-style
- flake8-printf-formatting
- 'flake8-simplify==0.19.2'
- 'flake8-type-checking==2.1.3'
args: [ '--enable-extensions=G' ]
- id: ruff
args: [ --fix ]

- repo: https://github.com/python-poetry/poetry
rev: 1.5.0
hooks:
- id: poetry-check


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
hooks:
- id: mypy
files: 'aladdin/.*|tests/.*'
additional_dependencies:
- types-freezegun
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ RUN poetry config virtualenvs.create false
RUN pip install pip --upgrade

COPY ./pyproject.toml /opt/app/pyproject.toml
# COPY ./poetry.lock /opt/app/poetry.lock
COPY ./poetry.lock /opt/app/poetry.lock

RUN mkdir /opt/app/aligned
RUN poetry install --no-dev --no-root --extras "redis psql server aws"

COPY ./aligned /opt/app/aligned

# COPY /. opt/app/aligned

ENTRYPOINT ["python", "-m", "aligned.cli"]
# RUN pip install -U 'opt/app/aligned[redis,aws,psql,server,text]'
3 changes: 2 additions & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ RUN poetry config virtualenvs.create false
RUN pip install pip --upgrade

COPY ./pyproject.toml /opt/app/pyproject.toml
COPY ./poetry.lock /opt/app/poetry.lock

RUN mkdir /opt/app/aligned
RUN poetry install --no-root --all-extras
RUN poetry install --no-root --extras "redis pandera kafka ollama mlflow lancedb"

COPY ./aligned /opt/app/aligned
COPY ./conftest.py /opt/app/conftest.py
Expand Down
3 changes: 1 addition & 2 deletions aligned/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from aligned.data_source.stream_data_source import HttpStreamSource
from aligned.data_source.batch_data_source import CustomMethodDataSource
from aligned.feature_store import ContractStore, FeatureStore
from aligned.feature_view import feature_view, combined_feature_view, check_schema
from aligned.feature_view import feature_view, check_schema
from aligned.schemas.text_vectoriser import EmbeddingModel
from aligned.sources.kafka import KafkaConfig
from aligned.sources.local import FileSource, Directory, ParquetConfig, CsvConfig
Expand Down Expand Up @@ -77,7 +77,6 @@
'Json',
'EmbeddingModel',
'feature_view',
'combined_feature_view',
'model_contract',
# Aggregation
'CustomAggregation',
Expand Down
4 changes: 3 additions & 1 deletion aligned/active_learning/job.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from __future__ import annotations

import logging
from dataclasses import dataclass

import pandas as pd
import polars as pl

from aligned.lazy_imports import pandas as pd
from aligned.active_learning.selection import ActiveLearningMetric, ActiveLearningSelection
from aligned.active_learning.write_policy import ActiveLearningWritePolicy
from aligned.retrival_job import RetrivalJob
Expand Down
2 changes: 1 addition & 1 deletion aligned/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def as_markdown(self) -> str:
def feature_exist(feature: FeatureReference, store: ContractStore) -> bool:

loc = feature.location
if loc.location == 'model':
if loc.location_type == 'model':
model = store.model(loc.name).model
all_features = model.predictions_view.full_schema
else:
Expand Down
7 changes: 6 additions & 1 deletion aligned/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ async def compile(repo_path: str, reference_file: str, env_file: str, ignore_fil

repo_def = await RepoReader.definition_from_path(dir, excludes)

await file.write(repo_def.to_json(omit_none=True).encode('utf-8'))
data = repo_def.to_json(omit_none=True)
if isinstance(data, str):
data_bytes = data.encode('utf-8')
else:
data_bytes = data
await file.write(data_bytes)
else:
click.echo(f'No repo file found at {dir}')

Expand Down
Loading

0 comments on commit a892780

Please sign in to comment.