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
Empty file removed .github/workflows/benchmark.yml
Empty file.
21 changes: 13 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
pre-commit install
- name: Run pre-commit
run: pre-commit run --all-files

Expand All @@ -27,18 +27,23 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: |
pytest tests/ --cov=fit --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
pytest tests/ --cov=fit --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
fail_ci_if_error: false
Empty file removed .github/workflows/docs.yml
Empty file.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: pytest tests/

build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
generate_release_notes: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ logs
venv
mnist_model.pkl
*.png
fit.egg-info
fit.egg-info
test
47 changes: 26 additions & 21 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: debug-statements
- id: check-merge-conflict

- repo: https://github.com/psf/black
rev: 23.3.0
- repo: https://github.com/psf/black
rev: 23.12.1
hooks:
- id: black
args: [--line-length=80]
- id: black
args: [--line-length=88]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: flake8
args: [--max-line-length=80]
additional_dependencies: [flake8-docstrings]
- id: isort
args: [--profile=black]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: isort
args: [--profile=black]
- id: flake8
args: [--max-line-length=88]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies: [types-PyYAML]
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM python:3.11-slim

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PYTHONPATH=/app

WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*

# Copy and install Python dependencies
COPY pyproject.toml ./
RUN pip install --no-cache-dir -e ".[dev,examples]"

# Copy source code
COPY . .

# Create non-root user
RUN useradd --create-home --shell /bin/bash fit
RUN chown -R fit:fit /app
USER fit

# Default command
CMD ["python", "-m", "pytest", "tests/"]
21 changes: 21 additions & 0 deletions configs/default.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# FIT Library Configuration
# Override any setting by creating your own config file or using environment variables

# Core settings
model:
dtype: "float32"
seed: 42

# Training defaults
training:
epochs: 100
batch_size: 32
learning_rate: 0.001
early_stopping:
patience: 10
min_delta: 1e-4

# Logging
logging:
level: "INFO"
log_dir: "./logs"
Empty file removed configs/models/mlp.yaml
Empty file.
Empty file removed configs/training/mnist.yaml
Empty file.
Empty file removed configs/training/xor.yaml
Empty file.
51 changes: 51 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.8'

services:
# Main development environment
fit:
build: .
volumes:
- .:/app
- fit_cache:/home/fit/.cache
environment:
- PYTHONPATH=/app
command: bash

# Run tests
test:
build: .
volumes:
- .:/app
command: python -m pytest tests/ -v

# Jupyter notebook server
jupyter:
build: .
volumes:
- .:/app
- fit_cache:/home/fit/.cache
ports:
- "8888:8888"
environment:
- JUPYTER_ENABLE_LAB=yes
command: >
jupyter lab
--ip=0.0.0.0
--port=8888
--no-browser
--allow-root
--ServerApp.token=''
--ServerApp.password=''
--ServerApp.allow_origin='*'

# Development with hot reload
dev:
build: .
volumes:
- .:/app
- fit_cache:/home/fit/.cache
environment:
- PYTHONPATH=/app
stdin_open: true
tty: true
command: bash
12 changes: 0 additions & 12 deletions docker/Dockerfile

This file was deleted.

16 changes: 0 additions & 16 deletions docker/docker-compose.yml

This file was deleted.

37 changes: 23 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,36 @@ license = {text = "MIT"}
authors = [{name = "Łukasz Bielaszewski", email = "lukaszbielaszewskibiz@gmail.com"}]
requires-python = ">=3.9"
dependencies = [
"numpy>=1.20.0",
"numpy>=1.21.0",
"pyyaml>=6.0",
]
classifiers = [
"Development Status :: Delta",
"Intended Audience :: Developers, New Users into Machine Learning",
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.optional-dependencies]
dev = [
"pytest>=6.0.0",
"pytest-cov>=2.12.0",
"flake8>=3.9.0",
"black>=21.5b2",
"pytest>=7.0.0",
"pytest-cov>=4.0.0",
"black>=23.0.0",
"isort>=5.12.0",
"flake8>=6.0.0",
"mypy>=1.0.0",
]
examples = [
"matplotlib>=3.4.0",
"matplotlib>=3.5.0",
"jupyter>=1.0.0",
"notebook>=6.4.0",
"scikit-learn>=0.24.0",
"pandas>=1.2.0",
"scikit-learn>=1.1.0",
"pandas>=1.4.0",
]

[project.urls]
Expand All @@ -46,12 +51,16 @@ Repository = "https://github.com/Klus3kk/fit"
include = ["fit*"]

[tool.black]
line-length = 70
line-length = 88

[tool.isort]
profile = "black"

[tool.mypy] # type checker
python_version = "3.8"
[tool.mypy]
python_version = "3.9"
warn_return_any = true
disallow_untyped_defs = true
disallow_untyped_defs = true

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = ["--cov=fit"]
Loading