Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: DeepLcom/deepl-python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.18.0
Choose a base ref
...
head repository: DeepLcom/deepl-python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jun 18, 2024

  1. Copy the full SHA
    bd2ba66 View commit details
  2. Copy the full SHA
    6019e28 View commit details
  3. Merge pull request #110 from DeepLcom/context-parameter-ga

    Remove alpha label from context parameter
    daniel-jones-dev authored Jun 18, 2024
    Copy the full SHA
    3dc0fe6 View commit details

Commits on Jul 12, 2024

  1. ci: Add github CI

    JanEbbing committed Jul 12, 2024
    Copy the full SHA
    7e872de View commit details

Commits on Jul 31, 2024

  1. Merge pull request #115 from DeepLcom/add-gh-ci

    ci: Add github CI
    daniel-jones-dev authored Jul 31, 2024
    Copy the full SHA
    109bae0 View commit details

Commits on Sep 17, 2024

  1. Copy the full SHA
    efd75f8 View commit details
  2. Copy the full SHA
    1f15e76 View commit details
  3. Copy the full SHA
    3127a09 View commit details
  4. Copy the full SHA
    dca0d80 View commit details
  5. Copy the full SHA
    7e1f8cd View commit details

Commits on Nov 15, 2024

  1. Copy the full SHA
    dde2384 View commit details
  2. fix[CLI]: always include model_type in API request for show-model-typ…

    …e-used option, to include model_type_used in response
    daniel-jones-dev authored and JanEbbing committed Nov 15, 2024
    Copy the full SHA
    e13b8dd View commit details
  3. docs: changelog

    daniel-jones-dev authored and JanEbbing committed Nov 15, 2024
    Copy the full SHA
    b23a5eb View commit details
  4. Copy the full SHA
    43120f1 View commit details

Commits on Jan 15, 2025

  1. Copy the full SHA
    4107220 View commit details
  2. Copy the full SHA
    c512702 View commit details
  3. Copy the full SHA
    1904841 View commit details
  4. tests: Add style test

    JanEbbing committed Jan 15, 2025
    Copy the full SHA
    505c8d2 View commit details
  5. Copy the full SHA
    842015c View commit details
  6. Copy the full SHA
    23f0cf1 View commit details
  7. Copy the full SHA
    ddaef45 View commit details

Commits on Mar 12, 2025

  1. Copy the full SHA
    9e7e5e7 View commit details
  2. chore: version 1.12.1

    leoncheng57 committed Mar 12, 2025
    Copy the full SHA
    981160c View commit details
Showing with 904 additions and 105 deletions.
  1. +227 −0 .github/workflows/run_ci.yml
  2. +47 −1 CHANGELOG.md
  3. +118 −50 README.md
  4. +4 −0 deepl/__init__.py
  5. +109 −27 deepl/__main__.py
  6. +84 −1 deepl/api_data.py
  7. +111 −0 deepl/deepl_client.py
  8. +61 −17 deepl/translator.py
  9. +1 −1 deepl/version.py
  10. +1 −1 pyproject.toml
  11. +28 −0 tests/conftest.py
  12. +8 −1 tests/test_cli.py
  13. +10 −6 tests/test_general.py
  14. +34 −0 tests/test_rephrase_text.py
  15. +42 −0 tests/test_translate_document.py
  16. +19 −0 tests/test_translate_text.py
227 changes: 227 additions & 0 deletions .github/workflows/run_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
name: Python

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '10 0 * * *'

env:
PIP_CACHE_DIR: "${{ github.workspace }}/.cache/pip"
XDG_CACHE_HOME: "${{ github.workspace }}/.cache"
POETRY_VIRTUALENVS_IN_PROJECT: "true"
REQUESTS_CA_BUNDLE: "/etc/ssl/certs/ca-certificates.crt"
SECRET_DETECTION_JSON_REPORT_FILE: "gitleaks.json"

jobs:
black:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install poetry==1.4.2
poetry install -vv -E keyring
- name: Run black check
run: |
source .venv/bin/activate
poetry run black --check .
flake8:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install poetry==1.4.2
poetry install -vv -E keyring
- name: Run flake8 check
run: |
source .venv/bin/activate
poetry run flake8 deepl tests
license_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run license check
run: |
./license_checker.sh '*.py' | tee license_check_output.txt
[ ! -s license_check_output.txt ]
mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install poetry==1.4.2
poetry install -vv -E keyring
- name: Run mypy check
run: |
source .venv/bin/activate
poetry run mypy --exclude 'examples/' .
secret_detection:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install and run secret detection
run: |
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.4/gitleaks_8.18.4_linux_x64.tar.gz
tar -xzf gitleaks_8.18.4_linux_x64.tar.gz
EXITCODE=0
./gitleaks detect -r ${SECRET_DETECTION_JSON_REPORT_FILE} --source . --log-opts="--all --full-history" || EXITCODE=$?
if [[ $EXITCODE -ne 0 ]]; then
exit $EXITCODE
fi
- name: Upload secret detection artifact
uses: actions/upload-artifact@v4
with:
name: secret-detection-results
path: gitleaks.json

package:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install dependencies
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install poetry==1.4.2
poetry install -vv -E keyring
- name: Build package
run: |
source .venv/bin/activate
poetry build --verbose --no-interaction
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: dist/

# Test and `pypi upload` stage are disabled/missing for now. Code needs to be tested

#######################################################
# test:
# runs-on: ${{ matrix.config.docker-image }}
# strategy:
# matrix:
# config:
# - docker-image: python:3.6
# use-mock-server: use mock server
# use-old-poetry-version: use old poetry version
# - docker-image: python:3.7
# use-mock-server: use mock server
# - docker-image: python:3.8
# use-mock-server: use mock server
# - docker-image: python:3.9
# use-mock-server: use mock server
# - docker-image: python:3.10
# use-mock-server: use mock server
# - docker-image: python:3.11
# use-mock-server: use mock server
# - docker-image: python:3.11
# - docker-image: python:3.6
# use-mock-server: use mock server
# use-old-poetry-version: use old poetry version
# extra-poetry-add-argument: requests@2.0
# - docker-image: python:3.9
# use-mock-server: use mock server
# extra-poetry-add-argument: requests@2.0
# # Set minimum possible requests and urllib3 versions to work with Python 3.11
# - docker-image: python:3.11
# use-mock-server: use mock server
# extra-poetry-add-argument: requests@2.20 urllib3@1.23
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Run tests
# run: |
# if [[ ! -z "${{ matrix.config.extra-poetry-add-argument }}" ]]; then
# echo "Running poetry add ${{ matrix.config.extra-poetry-add-argument }}"
# poetry add ${{ matrix.config.extra-poetry-add-argument }}
# fi
# if [[ ! -z "${{ matrix.config.use-mock-server }}" ]]; then
# echo "Using mock server"
# export DEEPL_SERVER_URL=http://deepl-mock:3000
# export DEEPL_MOCK_SERVER_PORT=3000
# export DEEPL_PROXY_URL=http://deepl-mock:3001
# export DEEPL_MOCK_PROXY_SERVER_PORT=3001
# fi
# poetry run coverage run -m pytest --junit-xml test_report.xml
# poetry run coverage report
# poetry run coverage xml
# - name: Upload test results
# uses: actions/upload-artifact@v2
# with:
# name: test-results
# path: test_report.xml

# mustache_example:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Install dependencies
# run: |
# python3 -m venv .venv
# source .venv/bin/activate
# pip install --upgrade pip
# pip install poetry==1.4.2
# poetry install -vv -E keyring
# - name: Run mustache example
# run: |
# cd examples/mustache
# pip install deepl
# python . --help
# python . --from en --to de "Hello {{user}}, your balance is {{{balance}}} dollars." > mustache_result.txt
# cat mustache_result.txt
# grep -q "{{user}}" mustache_result.txt
# grep -q "{{{balance}}}" mustache_result.txt

# basic_usage_example:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Install dependencies
# run: |
# python3 -m venv .venv
# source .venv/bin/activate
# pip install --upgrade pip
# pip install poetry==1.4.2
# poetry install -vv -E keyring
# - name: Run basic usage example
# run: |
# poetry build --verbose --no-interaction
# cd examples/basic_usage
# python3 -m venv .examplevenv
# source .examplevenv/bin/activate
# pip install ../../dist/deepl-*.tar.gz
# set -o pipefail
# python . 2>&1 | tee basic_usage_result.txt
# grep -q "Success" basic_usage_result.txt
# pip install mypy
# mypy .
48 changes: 47 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -4,6 +4,46 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
<!-- * add to here -->
### Changed
<!-- * add to here -->

## [1.21.1] - 2025-03-12
### Added
* (beta) optional parameter to specify timeout for document translation calls

## [1.21.0] - 2025-01-15
### Added
* Added support for the Write API in the client library, the implementation
can be found in the `DeepLClient` class. Please refer to the README for usage
instructions.
### Changed
* The main functionality of the library is now also exposed via the `DeepLClient`
class. Please change your code to use this over the `Translator` class whenever
convenient.


## [1.20.0] - 2024-11-15
### Added
* Added `model_type` option to `translate_text()` to use models with higher
translation quality (available for some language pairs), or better latency.
Options are `'quality_optimized'`, `'latency_optimized'`, and `'prefer_quality_optimized'`
* Added the `model_type_used` field to `translate_text()` response, that
indicates the translation model used when the `model_type` option is
specified.


## [1.19.1] - 2024-09-17
### Fixed
* Fixed typing issues, black-formatting and a test case failure.


## [1.19.0] - 2024-09-17
### Added
* Added `billed_characters` to response from `translate_text()`.


## [1.18.0] - 2024-04-26
### Added
@@ -293,7 +333,13 @@ Version increased to avoid conflicts with old packages on PyPI.
## [0.1.0] - 2021-07-26
Initial version.


<!-- Unreleased shoud never be deleted -->
[Unreleased]: https://github.com/DeepLcom/deepl-python/compare/v1.21.1...HEAD
[1.21.1]: https://github.com/DeepLcom/deepl-python/compare/v1.21.0...v1.21.1
[1.21.0]: https://github.com/DeepLcom/deepl-python/compare/v1.20.0...v1.21.0
[1.20.0]: https://github.com/DeepLcom/deepl-python/compare/v1.19.1...v1.20.0
[1.19.1]: https://github.com/DeepLcom/deepl-python/compare/v1.19.0...v1.19.1
[1.19.0]: https://github.com/DeepLcom/deepl-python/compare/v1.18.0...v1.19.0
[1.18.0]: https://github.com/DeepLcom/deepl-python/compare/v1.17.0...v1.18.0
[1.17.0]: https://github.com/DeepLcom/deepl-python/compare/v1.16.1...v1.17.0
[1.16.1]: https://github.com/DeepLcom/deepl-python/compare/v1.16.0...v1.16.1
Loading