Skip to content

Commit

Permalink
Migrated codebase to fmcore, added Ruff formatter, and GitHub workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
adivekar-utexas committed Jan 20, 2025
1 parent 3575c6d commit 481f7c6
Show file tree
Hide file tree
Showing 170 changed files with 5,875 additions and 47,505 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Linting

on: [push, pull_request]

jobs:
ruff-formatter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: astral-sh/ruff-action@v3
with:
version: '0.9.2'
args: format --check
src: './src'
47 changes: 47 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: release

on:
release:
types:
- published # Published through GitHub UI: https://github.com/amazon-science/synthesizrr/releases/new

jobs:
pypi:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main' }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Required for Git versioning

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install Hatch & Twine
run: |
python -m pip install --upgrade pip
python -m pip install uv
python -m uv pip install hatch twine
- name: Verify Version from Git Tag
run: hatch version

- name: Build Package
run: hatch build

- name: Publish to Test PyPI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: twine upload --repository testpypi dist/*

- name: Publish to PyPI
env:
TWINE_USERNAME: "__token__"
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: twine upload --repository pypi dist/*
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
pytest:
runs-on: ubuntu-latest

steps:
- name: Check out repo
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install test requirements
# Install package dependencies:
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade uv
python -m uv pip install --upgrade pytest
python -m uv pip install -e .
- name: Run tests
run: |
pytest tests/
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "synthesizrr"
dynamic = ["version"]
authors = [
{ name = "Abhishek Divekar", email = "[email protected]" }
]
description = "Synthesizing realistic and diverse text-datasets from augmented LLMs."
readme = "README.md"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
]
license-files = ["LICENSE"]
dependencies = [
"fmcore[all]",
]

[tool.hatch.version]
source = "vcs"

[tool.pytest.ini_options]
pythonpath = ["src"]

[tool.ruff]
line-length = 110
fix = true
force-exclude = true
extend-exclude = [
"__init__.py",
]

[tool.ruff.lint]
fixable = [
"I", # Add all rules under isort linter: https://docs.astral.sh/ruff/rules/#isort-i
"W", # Add all rules under whitespace: https://docs.astral.sh/ruff/rules/#warning-w
"E401", # multiple-imports-on-one-line: https://docs.astral.sh/ruff/rules/multiple-imports-on-one-line/
"E713", # not-in-test: https://docs.astral.sh/ruff/rules/not-in-test/
"E721", # type-comparison: https://docs.astral.sh/ruff/rules/type-comparison/
"E722", # bare-except: https://docs.astral.sh/ruff/rules/bare-except/
"F401", # unused-import: https://docs.astral.sh/ruff/rules/unused-import/
"F541", # f-string-missing-placeholders: https://docs.astral.sh/ruff/rules/f-string-missing-placeholders/
"F811", # redefined-while-unused: https://docs.astral.sh/ruff/rules/redefined-while-unused/
"F841", # unused-variable: https://docs.astral.sh/ruff/rules/unused-variable/
]
ignore = [
## Ignored because it makes the code too verbose:
"E731", # lambda-assignment: https://docs.astral.sh/ruff/rules/lambda-assignment/
"E741", # ambiguous-variable-name: https://docs.astral.sh/ruff/rules/ambiguous-variable-name/

## Ignored because of bad interaction with `from typing import *`
"F405", # undefined-local-with-import-star-usage: https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/
"F403", # undefined-local-with-import-star: https://docs.astral.sh/ruff/rules/undefined-local-with-import-star/
]
8 changes: 0 additions & 8 deletions src/synthesizrr/base/__init__.py

This file was deleted.

26 changes: 0 additions & 26 deletions src/synthesizrr/base/algorithm/__init__.py

This file was deleted.

Loading

0 comments on commit 481f7c6

Please sign in to comment.