-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
50 changed files
with
3,902 additions
and
426 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Expected Behavior | ||
|
||
|
||
## Actual Behavior | ||
|
||
|
||
## Steps to Reproduce the Problem | ||
|
||
1. | ||
1. | ||
1. | ||
|
||
## Specifications | ||
|
||
- Version: | ||
- Platform: | ||
- Subsystem: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Fixes # | ||
|
||
## Proposed Changes | ||
|
||
- | ||
- | ||
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Setup | ||
description: Setup for project workflows | ||
runs: | ||
using: composite | ||
steps: | ||
- run: pipx install invoke poetry | ||
shell: bash | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
cache: poetry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
concurrency: | ||
cancel-in-progress: true | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: poetry install --with dev,checks,formats | ||
- run: poetry run invoke checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
on: | ||
release: | ||
types: [published] | ||
env: | ||
DOCKER_IMAGE: ghcr.io/fmind/mlops-python-package:latest | ||
concurrency: | ||
cancel-in-progress: true | ||
group: on-release-published | ||
jobs: | ||
pages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: poetry install --with docs | ||
- run: poetry run invoke docs | ||
- uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: docs/ | ||
branch: gh-pages | ||
packages: | ||
permissions: | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/setup | ||
- run: poetry run invoke packages | ||
- uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- uses: docker/setup-buildx-action@v3 | ||
- uses: docker/build-push-action@v5 | ||
with: | ||
push: true | ||
context: . | ||
cache-to: type=gha | ||
cache-from: type=gha | ||
tags: ${{ env.DOCKER_IMAGE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# https://docs.docker.com/compose/compose-file/ | ||
services: | ||
mlflow: | ||
image: ghcr.io/mlflow/mlflow:v2.10.2 | ||
ports: | ||
- 5000:5000 | ||
environment: | ||
- MLFLOW_HOST=0.0.0.0 | ||
command: mlflow server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
[tool.poetry] | ||
name = "bikes" | ||
version = "0.1.0" | ||
version = "0.3.0" | ||
description = "Predict the number of bikes available." | ||
repository = "https://github.com/fmind/mlops-python-package" | ||
authors = ["Médéric HURIER <[email protected]>"] | ||
|
@@ -32,37 +32,40 @@ pyarrow = "^15.0.0" | |
pydantic = "^2.5.3" | ||
pydantic-settings = "^2.1.0" | ||
scikit-learn = "^1.4.0" | ||
mlflow-skinny = "^2.10.2" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
invoke = "^2.2.0" | ||
ipykernel = "^6.29.0" | ||
pre-commit = "^3.6.0" | ||
|
||
[tool.poetry.group.checkers.dependencies] | ||
[tool.poetry.group.docs.dependencies] | ||
pdoc = "^13.1.1" | ||
|
||
[tool.poetry.group.checks.dependencies] | ||
coverage = "^7.4.1" | ||
mypy = "^1.8.0" | ||
pylint = "^3.0.3" | ||
pytest = "^8.0.0" | ||
pytest-cov = "^4.1.0" | ||
pytest-xdist = "^3.5.0" | ||
pandera = { extras = ["mypy"], version = "^0.18.0" } | ||
|
||
[tool.poetry.group.notebooks.dependencies] | ||
nbformat = "^5.9.2" | ||
|
||
[tool.poetry.group.documenters.dependencies] | ||
pdoc = "^13.1.1" | ||
|
||
[tool.poetry.group.formatters.dependencies] | ||
[tool.poetry.group.formats.dependencies] | ||
black = "^24.1.1" | ||
isort = "^5.13.2" | ||
|
||
[tool.poetry.group.notebooks.dependencies] | ||
ipykernel = "^6.29.0" | ||
nbformat = "^5.9.2" | ||
|
||
# CONFIGURATIONS | ||
|
||
[tool.black] | ||
line-length = 120 | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
source = ["src"] | ||
|
||
[tool.isort] | ||
line_length = 120 | ||
|
@@ -74,7 +77,7 @@ ignore_missing_imports = true | |
plugins = ["pandera.mypy", "pydantic.mypy"] | ||
|
||
[tool.pylint.MASTER] | ||
disable = ['too-few-public-methods', 'too-many-arguments'] | ||
disable = ['too-few-public-methods', 'too-many-arguments', 'too-many-locals'] | ||
max-line-length = 120 | ||
extension-pkg-whitelist = "pydantic" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Predict the number of bikes available.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,72 @@ | ||
"""Parse and merge config files.""" | ||
"""Parse, merge, and convert YAML configs.""" | ||
|
||
# %% IMPORTS | ||
|
||
import typing as T | ||
|
||
from cloudpathlib import AnyPath | ||
from omegaconf import DictConfig, ListConfig, OmegaConf | ||
|
||
# %% TYPES | ||
|
||
Config = ListConfig | DictConfig | ||
|
||
# %% LOADERS | ||
# %% PARSERS | ||
|
||
|
||
def parse_file(path: str) -> Config: | ||
"""Parse a config file from a path. | ||
def parse_config(path: str) -> Config: | ||
"""Load a config file.""" | ||
Args: | ||
path (str): local or remote path. | ||
Returns: | ||
Config: representation of the config file. | ||
""" | ||
any_path = AnyPath(path) | ||
# pylint: disable=no-member | ||
text = any_path.read_text() # type: ignore | ||
config = OmegaConf.create(text) | ||
return config | ||
|
||
|
||
def parse_configs(paths: list[str]) -> Config: | ||
"""Load and merge config files.""" | ||
configs = map(parse_config, paths) | ||
config = OmegaConf.merge(*configs) | ||
return config | ||
def parse_string(string: str) -> Config: | ||
"""Parse the given config string. | ||
Args: | ||
string (str): configuration string. | ||
Returns: | ||
Config: representation of the config string. | ||
""" | ||
return OmegaConf.create(string) | ||
|
||
|
||
# %% MERGERS | ||
|
||
|
||
def merge_configs(configs: T.Sequence[Config]) -> Config: | ||
"""Merge a list of config objects into one. | ||
Args: | ||
configs (list[Config]): list of config objects. | ||
Returns: | ||
Config: representation of the merged config objects. | ||
""" | ||
return OmegaConf.merge(*configs) | ||
|
||
|
||
# %% CONVERTERS | ||
|
||
|
||
def to_object(config: Config) -> object: | ||
"""Convert a config to a python object.""" | ||
"""Convert a config object to a python object. | ||
Args: | ||
config (Config): representation of the config. | ||
Returns: | ||
object: conversion of the config to a python object. | ||
""" | ||
return OmegaConf.to_container(config, resolve=True) |
Oops, something went wrong.