Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add full typing support #3

Merged
merged 27 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
1f3d114
build: add typing_extensions
eginhard Oct 18, 2024
f901d57
docs: fix typos, improve docstrings
eginhard Oct 18, 2024
4e3ee4a
chore: improve types
eginhard Oct 18, 2024
fa31c70
refactor: add/improve type aliases
eginhard Oct 19, 2024
6524511
chore: use Self return type hint
eginhard Oct 19, 2024
2ce69f5
test: correctly handle exceptions in tests
eginhard Oct 19, 2024
fd01bf9
fix: correctly serialize when dumping to json
eginhard Oct 19, 2024
37299fb
feat: add _drop_none_type() to better handle optional fields
eginhard Oct 19, 2024
5fee09f
fix: use get_args and get_origin, update helpers
eginhard Oct 19, 2024
c98d2de
chore: do not re-export dataclass
eginhard Oct 19, 2024
bcb0f05
test: add more serialization test cases
eginhard Oct 19, 2024
0894100
fix: do not assign to self
eginhard Oct 19, 2024
0136527
refactor: simplify recursive getters and setters
eginhard Oct 19, 2024
99de702
refactor: simplify code and add type hints
eginhard Oct 19, 2024
2349aff
fix: correctly serialize Serializable type
eginhard Oct 19, 2024
52b00ac
fix!: make Coqpit.update() consistent with superclass
eginhard Oct 19, 2024
578747b
fix: deserialize needs to be called as instance method
eginhard Oct 19, 2024
db183f2
fix: correctly initialize from argparse
eginhard Oct 19, 2024
b0090c2
build: switch from setuptools to hatchling
eginhard Oct 19, 2024
2c6929e
feat: declare typing support, run mypy in pre-commit
eginhard Oct 19, 2024
650926c
fix: adapt type hints to Python 3.9
eginhard Oct 19, 2024
9891289
fix: replace asserts with exceptions
eginhard Oct 19, 2024
0563504
refactor: enable (almost) all lint rules
eginhard Oct 19, 2024
44128ec
test: improve coverage
eginhard Oct 19, 2024
61066c9
chore: update pypi package name
eginhard Oct 19, 2024
39adee3
chore: bump version to 0.1.0
eginhard Oct 19, 2024
8fbbc9d
ci: update uv version, switch to pep 735 standard
eginhard Oct 25, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.21"
version: "0.4.27"
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Set up Python ${{ matrix.python-version }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
version: "0.4.21"
version: "0.4.27"
enable-cache: true
cache-dependency-glob: "**/pyproject.toml"
- name: Set up Python
Expand All @@ -43,7 +43,7 @@ jobs:
needs: [build]
environment:
name: release
url: https://pypi.org/p/coqui-tts-coqpit
url: https://pypi.org/p/coqpit-config
permissions:
id-token: write
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
uv.lock

WadaSNR/
.idea/
*.pyc
Expand Down
7 changes: 7 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ repos:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.12.0
hooks:
- id: mypy
args: [--strict]
additional_dependencies:
- "pytest"
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

[![CI](https://github.com/idiap/coqui-ai-coqpit/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/idiap/coqui-ai-coqpit/actions/workflows/main.yml)

Simple, light-weight and no dependency config handling through python data classes with to/from JSON serialization/deserialization.
Simple, light-weight and no dependency config handling through python data
classes with to/from JSON serialization/deserialization.

Currently it is being used by [🐸TTS](https://github.com/idiap/coqui-ai-TTS).
Fork of the [original, unmaintained repository](https://github.com/coqui-ai/coqpit). New PyPI package: [coqpit-config](https://pypi.org/project/coqpit-config)

Currently it is being used by [coqui-tts](https://github.com/idiap/coqui-ai-TTS).

## ❔ Why I need this
What I need from a ML configuration library...
Expand Down
3 changes: 1 addition & 2 deletions coqpit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import importlib.metadata
from dataclasses import dataclass

from coqpit.coqpit import MISSING, Coqpit, check_argument

__all__ = ["dataclass", "MISSING", "Coqpit", "check_argument"]
__all__ = ["MISSING", "Coqpit", "check_argument"]

__version__ = importlib.metadata.version("coqpit")
Loading