Skip to content

Commit 2f9ed63

Browse files
committed
chore: initial commit
0 parents  commit 2f9ed63

File tree

13 files changed

+2155
-0
lines changed

13 files changed

+2155
-0
lines changed

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
environment: release
11+
permissions:
12+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.11'
21+
22+
- name: Install build dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install build
26+
27+
- name: Build package
28+
run: python -m build
29+
30+
- name: Publish package distributions to PyPI
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
print-hash: true

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
create-release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Create Release
20+
uses: actions/create-release@v1
21+
env:
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
with:
24+
tag_name: ${{ github.ref }}
25+
release_name: Release ${{ github.ref }}
26+
body: |
27+
## Changes in this release
28+
29+
See the [changelog](CHANGELOG.md) for detailed information.
30+
31+
## Installation
32+
33+
```bash
34+
pip install lingo-dev-sdk
35+
```
36+
37+
## Documentation
38+
39+
For detailed usage instructions, see the [README](README.md).
40+
draft: false
41+
prerelease: false

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install -e ".[dev]"
28+
29+
- name: Lint with flake8
30+
run: |
31+
# stop the build if there are Python syntax errors or undefined names
32+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
34+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
35+
36+
- name: Check code formatting with black
37+
run: |
38+
black --check --diff .
39+
40+
- name: Type check with mypy
41+
run: |
42+
mypy src/lingodotdev
43+
44+
- name: Test with pytest
45+
run: |
46+
pytest --cov=src/lingodotdev --cov-report=xml
47+
48+
- name: Upload coverage to Codecov
49+
uses: codecov/codecov-action@v3
50+
with:
51+
file: ./coverage.xml
52+
flags: unittests
53+
name: codecov-umbrella
54+
fail_ci_if_error: true

.gitignore

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
158+
# project, it is recommended to use this template.
159+
# https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160+
# and can be added to the global gitignore or merged into this project gitignore.
161+
# For a PyCharm project, it is recommended to use this template.
162+
.idea/
163+
164+
# VS Code
165+
.vscode/
166+
167+
# macOS
168+
.DS_Store
169+
170+
# Windows
171+
Thumbs.db
172+
ehthumbs.db
173+
Desktop.ini

CHANGELOG.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Initial release of the Lingo.dev Python SDK
12+
- Support for text localization
13+
- Support for object localization
14+
- Support for chat sequence localization
15+
- Support for HTML document localization
16+
- Support for batch text localization to multiple locales
17+
- Language detection functionality
18+
- User authentication checking with `whoami()`
19+
- Progress tracking for long-running operations
20+
- Comprehensive test suite
21+
- Type hints and Pydantic validation
22+
- GitHub Actions for CI/CD and automated publishing
23+
- Fast mode for improved performance on larger batches
24+
- Reference translation support for consistency
25+
- Automatic payload chunking for large datasets
26+
- Error handling for various API scenarios
27+
28+
### Features
29+
- **Text Localization**: Translate individual text strings
30+
- **Object Localization**: Translate Python dictionaries with string values
31+
- **Chat Localization**: Translate chat conversations while preserving speaker names
32+
- **HTML Localization**: Translate HTML documents while preserving structure
33+
- **Batch Processing**: Translate text to multiple target languages in one call
34+
- **Language Detection**: Automatically detect the language of input text
35+
- **Progress Callbacks**: Track progress for long-running operations
36+
- **Fast Mode**: Enable faster processing for larger batches
37+
- **Reference Translations**: Provide reference translations for consistency
38+
- **Chunking**: Automatic handling of large payloads through intelligent chunking
39+
- **Type Safety**: Full type hints and runtime validation with Pydantic
40+
- **Comprehensive Testing**: Unit tests, integration tests, and mocked tests
41+
- **CI/CD**: Automated testing and publishing workflows
42+
43+
### Technical Details
44+
- **Python Support**: Python 3.8+
45+
- **Dependencies**: requests, pydantic, beautifulsoup4, nanoid
46+
- **API Compatibility**: Compatible with Lingo.dev API v1
47+
- **Error Handling**: Comprehensive error handling with appropriate exception types
48+
- **Documentation**: Extensive documentation with examples and API reference
49+
50+
## [0.1.0] - 2024-01-XX
51+
52+
### Added
53+
- Initial release

0 commit comments

Comments
 (0)