Merge pull request #65 from nidhaloff/platform-agnostic-refactoring-&-cli-testing
Browse files- README.rst +2 -2
- deep_translator/__init__.py +17 -15
- deep_translator/{cli.py → __main__.py} +53 -60
- deep_translator/deepl.py +5 -5
- deep_translator/detection.py +1 -1
- deep_translator/exceptions.py +2 -2
- deep_translator/google_trans.py +3 -3
- deep_translator/linguee.py +8 -8
- deep_translator/microsoft.py +2 -2
- deep_translator/mymemory.py +7 -7
- deep_translator/papago.py +2 -2
- deep_translator/parent.py +1 -3
- deep_translator/pons.py +8 -8
- deep_translator/qcri.py +2 -4
- deep_translator/tests/test_cli.py +16 -0
- deep_translator/utils.py +1 -0
- deep_translator/yandex.py +2 -4
- pyproject.toml +3 -0
- setup.cfg +64 -10
- setup.py +11 -69
README.rst
CHANGED
@@ -647,7 +647,7 @@ Next Steps
|
|
647 |
|
648 |
Take a look in the examples folder for more :)
|
649 |
Contributions are always welcome.
|
650 |
-
Read the Contribution
|
651 |
|
652 |
==========
|
653 |
Credits
|
@@ -673,7 +673,7 @@ The Translator++ mobile app
|
|
673 |
:alt: Icon of the app
|
674 |
|
675 |
|
676 |
-
After developing the deep_translator, I
|
677 |
Sure, there is google translate, pons and linguee apps etc.. but isn't it cooler to make an app where all these
|
678 |
translators are integrated?
|
679 |
|
|
|
647 |
|
648 |
Take a look in the examples folder for more :)
|
649 |
Contributions are always welcome.
|
650 |
+
Read the Contribution guidelines `Here <https://deep-translator.readthedocs.io/en/latest/contributing.html/>`_
|
651 |
|
652 |
==========
|
653 |
Credits
|
|
|
673 |
:alt: Icon of the app
|
674 |
|
675 |
|
676 |
+
After developing the deep_translator, I realized how cool this would be if I can use it as an app on my mobile phone.
|
677 |
Sure, there is google translate, pons and linguee apps etc.. but isn't it cooler to make an app where all these
|
678 |
translators are integrated?
|
679 |
|
deep_translator/__init__.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
-
"""Top-level package for
|
2 |
|
|
|
3 |
from .google_trans import GoogleTranslator
|
4 |
from .pons import PonsTranslator
|
5 |
from .linguee import LingueeTranslator
|
@@ -10,18 +11,19 @@ from .deepl import DeepL
|
|
10 |
from .detection import single_detection, batch_detection
|
11 |
from .microsoft import MicrosoftTranslator
|
12 |
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
DeepL,
|
26 |
-
single_detection,
|
27 |
-
batch_detection]
|
|
|
1 |
+
"""Top-level package for Deep Translator"""
|
2 |
|
3 |
+
# TODO: Discussion: Do these need to be in __init__.py? Are they intended to be exportable?
|
4 |
from .google_trans import GoogleTranslator
|
5 |
from .pons import PonsTranslator
|
6 |
from .linguee import LingueeTranslator
|
|
|
11 |
from .detection import single_detection, batch_detection
|
12 |
from .microsoft import MicrosoftTranslator
|
13 |
|
14 |
+
# TODO: Discussion: These should be declared in setup.cfg, setting them here is redundant
|
15 |
+
# __author__ = """Nidhal Baccouri"""
|
16 |
+
# __email__ = '[email protected]'
|
17 |
+
# __version__ = '1.4.4'
|
18 |
|
19 |
+
# __all__ = [GoogleTranslator,
|
20 |
+
# PonsTranslator,
|
21 |
+
# LingueeTranslator,
|
22 |
+
# MyMemoryTranslator,
|
23 |
+
# YandexTranslator,
|
24 |
+
# MicrosoftTranslator,
|
25 |
+
# QCRI,
|
26 |
+
# DeepL,
|
27 |
+
# main,
|
28 |
+
# single_detection,
|
29 |
+
# batch_detection]
|
|
|
|
|
|
deep_translator/{cli.py → __main__.py}
RENAMED
@@ -13,6 +13,58 @@ from .papago import PapagoTranslator
|
|
13 |
|
14 |
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
def translate(translator, source, target, text, api_key):
|
18 |
"""
|
@@ -65,7 +117,6 @@ def translate(translator, source, target, text, api_key):
|
|
65 |
click.echo(f" | Translation from {source} to {target} |")
|
66 |
click.echo(f"Translated text: \n {res}")
|
67 |
|
68 |
-
|
69 |
def print_supported_languages(requested_translator, api_key):
|
70 |
"""
|
71 |
function used to print the languages supported by the translator service
|
@@ -102,63 +153,5 @@ def print_supported_languages(requested_translator, api_key):
|
|
102 |
for k, v in supported_languages.items():
|
103 |
click.echo(f"|- {k}: {v}")
|
104 |
|
105 |
-
|
106 |
-
@click.command(context_settings=CONTEXT_SETTINGS)
|
107 |
-
@click.option(
|
108 |
-
"--translator",
|
109 |
-
"-trans",
|
110 |
-
default="google",
|
111 |
-
type=str,
|
112 |
-
help="name of the translator you want to use",
|
113 |
-
show_default=True,
|
114 |
-
)
|
115 |
-
@click.option(
|
116 |
-
"--source",
|
117 |
-
"-src",
|
118 |
-
type=str,
|
119 |
-
help="source language to translate from"
|
120 |
-
)
|
121 |
-
@click.option(
|
122 |
-
"--target",
|
123 |
-
"-tg",
|
124 |
-
type=str,
|
125 |
-
help="target language to translate to"
|
126 |
-
)
|
127 |
-
@click.option(
|
128 |
-
"--text",
|
129 |
-
"-txt",
|
130 |
-
type=str,
|
131 |
-
help="text you want to translate"
|
132 |
-
)
|
133 |
-
@click.option(
|
134 |
-
"--api-key",
|
135 |
-
type=str,
|
136 |
-
help="required for DeepL, QCRI, Yandex, Microsoft and Papago translators"
|
137 |
-
)
|
138 |
-
@click.option(
|
139 |
-
"--languages",
|
140 |
-
"-lang",
|
141 |
-
is_flag=True,
|
142 |
-
help="list all the languages available with the translator."
|
143 |
-
" Run with deep_translator -trans <translator service> -lang",
|
144 |
-
)
|
145 |
-
def main(translator, source, target, text, api_key, languages):
|
146 |
-
"""
|
147 |
-
\f
|
148 |
-
function responsible for parsing terminal arguments and provide them for
|
149 |
-
further use in the translation process
|
150 |
-
"""
|
151 |
-
api_key_required = ["deepl", "qcri", "yandex", "microsoft", "papago"]
|
152 |
-
if translator in api_key_required and not api_key:
|
153 |
-
click.echo(
|
154 |
-
"This translator requires an api key provided through --api-key"
|
155 |
-
)
|
156 |
-
elif languages:
|
157 |
-
print_supported_languages(translator, api_key)
|
158 |
-
else:
|
159 |
-
translate(translator, source, target, text, api_key)
|
160 |
-
# sys.exit()
|
161 |
-
|
162 |
-
|
163 |
if __name__ == "__main__":
|
164 |
-
main()
|
|
|
13 |
|
14 |
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
|
15 |
|
16 |
+
@click.command(name='Deep Translator', context_settings=CONTEXT_SETTINGS, no_args_is_help=True)
|
17 |
+
@click.argument(
|
18 |
+
'translator',
|
19 |
+
required=True,
|
20 |
+
default='google',
|
21 |
+
type=str)
|
22 |
+
@click.option(
|
23 |
+
"--source",
|
24 |
+
"-src",
|
25 |
+
required=True,
|
26 |
+
type=str,
|
27 |
+
help="source language to translate from")
|
28 |
+
@click.option(
|
29 |
+
"--target",
|
30 |
+
"-tgt",
|
31 |
+
required=True,
|
32 |
+
type=str,
|
33 |
+
help="target language to translate to")
|
34 |
+
@click.option(
|
35 |
+
"--text",
|
36 |
+
"-txt",
|
37 |
+
type=str,
|
38 |
+
required = True,
|
39 |
+
prompt="Enter the text you want to translate",
|
40 |
+
help="text you want to translate")
|
41 |
+
@click.option(
|
42 |
+
"--api-key",
|
43 |
+
type=str,
|
44 |
+
help="required for DeepL, QCRI, Yandex, Microsoft and Papago translators")
|
45 |
+
@click.option(
|
46 |
+
"--languages",
|
47 |
+
"-lang",
|
48 |
+
is_flag=True,
|
49 |
+
help="list all the languages available with the translator."
|
50 |
+
" Run with deep_translator <translator service> -lang",)
|
51 |
+
def main(translator, source, target, text, api_key, languages):
|
52 |
+
"""
|
53 |
+
Use TRANSLATOR to translate source material into another language.
|
54 |
+
Available translators include: Google, MyMemory, QCRI, Linguee, Pons, Yandex, Microsoft (Bing), and Papago.\n
|
55 |
+
\f
|
56 |
+
function responsible for parsing terminal arguments and provide them for
|
57 |
+
further use in the translation process
|
58 |
+
"""
|
59 |
+
api_key_required = ["deepl", "qcri", "yandex", "microsoft", "papago"]
|
60 |
+
if translator in api_key_required and not api_key:
|
61 |
+
click.echo(
|
62 |
+
"This translator requires an api key provided through --api-key"
|
63 |
+
)
|
64 |
+
elif languages:
|
65 |
+
print_supported_languages(translator, api_key)
|
66 |
+
else:
|
67 |
+
translate(translator, source, target, text, api_key)
|
68 |
|
69 |
def translate(translator, source, target, text, api_key):
|
70 |
"""
|
|
|
117 |
click.echo(f" | Translation from {source} to {target} |")
|
118 |
click.echo(f"Translated text: \n {res}")
|
119 |
|
|
|
120 |
def print_supported_languages(requested_translator, api_key):
|
121 |
"""
|
122 |
function used to print the languages supported by the translator service
|
|
|
153 |
for k, v in supported_languages.items():
|
154 |
click.echo(f"|- {k}: {v}")
|
155 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
if __name__ == "__main__":
|
157 |
+
main()
|
deep_translator/deepl.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import requests
|
2 |
-
from
|
3 |
-
from
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
|
8 |
|
9 |
class DeepL(object):
|
|
|
1 |
import requests
|
2 |
+
from .constants import BASE_URLS, DEEPL_LANGUAGE_TO_CODE
|
3 |
+
from .exceptions import (ServerException,
|
4 |
+
TranslationNotFound,
|
5 |
+
LanguageNotSupportedException,
|
6 |
+
AuthorizationException)
|
7 |
|
8 |
|
9 |
class DeepL(object):
|
deep_translator/detection.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
language detection API
|
3 |
"""
|
4 |
import requests
|
5 |
-
from
|
6 |
from requests.exceptions import HTTPError
|
7 |
|
8 |
|
|
|
2 |
language detection API
|
3 |
"""
|
4 |
import requests
|
5 |
+
from .configs import config # TODO: Discussion: Could this be moved here and remove configs.py entirely?
|
6 |
from requests.exceptions import HTTPError
|
7 |
|
8 |
|
deep_translator/exceptions.py
CHANGED
@@ -82,7 +82,7 @@ class NotValidLength(BaseError):
|
|
82 |
|
83 |
class RequestError(Exception):
|
84 |
"""
|
85 |
-
exception thrown if an error
|
86 |
"""
|
87 |
|
88 |
def __init__(self, message="Request exception can happen due to an api connection error. "
|
@@ -108,7 +108,7 @@ class MicrosoftAPIerror(Exception):
|
|
108 |
|
109 |
class TooManyRequests(Exception):
|
110 |
"""
|
111 |
-
exception thrown if an error
|
112 |
"""
|
113 |
|
114 |
def __init__(self, message="Server Error: You made too many requests to the server. According to google, you are allowed to make 5 requests per second and up to 200k requests per day. You can wait and try again later or you can try the translate_batch function"):
|
|
|
82 |
|
83 |
class RequestError(Exception):
|
84 |
"""
|
85 |
+
exception thrown if an error occurred during the request call, e.g a connection problem.
|
86 |
"""
|
87 |
|
88 |
def __init__(self, message="Request exception can happen due to an api connection error. "
|
|
|
108 |
|
109 |
class TooManyRequests(Exception):
|
110 |
"""
|
111 |
+
exception thrown if an error occurred during the request call, e.g a connection problem.
|
112 |
"""
|
113 |
|
114 |
def __init__(self, message="Server Error: You made too many requests to the server. According to google, you are allowed to make 5 requests per second and up to 200k requests per day. You can wait and try again later or you can try the translate_batch function"):
|
deep_translator/google_trans.py
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
google translator API
|
3 |
"""
|
4 |
|
5 |
-
from
|
6 |
-
from
|
7 |
-
from
|
8 |
from bs4 import BeautifulSoup
|
9 |
import requests
|
10 |
from time import sleep
|
|
|
2 |
google translator API
|
3 |
"""
|
4 |
|
5 |
+
from .constants import BASE_URLS, GOOGLE_LANGUAGES_TO_CODES
|
6 |
+
from .exceptions import TooManyRequests, LanguageNotSupportedException, TranslationNotFound, NotValidPayload, RequestError
|
7 |
+
from .parent import BaseTranslator
|
8 |
from bs4 import BeautifulSoup
|
9 |
import requests
|
10 |
from time import sleep
|
deep_translator/linguee.py
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
linguee translator API
|
3 |
"""
|
4 |
|
5 |
-
from
|
6 |
-
from
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
from
|
13 |
from bs4 import BeautifulSoup
|
14 |
import requests
|
15 |
from requests.utils import requote_uri
|
|
|
2 |
linguee translator API
|
3 |
"""
|
4 |
|
5 |
+
from .constants import BASE_URLS, LINGUEE_LANGUAGES_TO_CODES, LINGUEE_CODE_TO_LANGUAGE
|
6 |
+
from .exceptions import (LanguageNotSupportedException,
|
7 |
+
TranslationNotFound,
|
8 |
+
NotValidPayload,
|
9 |
+
ElementNotFoundInGetRequest,
|
10 |
+
RequestError,
|
11 |
+
TooManyRequests)
|
12 |
+
from .parent import BaseTranslator
|
13 |
from bs4 import BeautifulSoup
|
14 |
import requests
|
15 |
from requests.utils import requote_uri
|
deep_translator/microsoft.py
CHANGED
@@ -4,8 +4,8 @@ import requests
|
|
4 |
import logging
|
5 |
import sys
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
|
10 |
|
11 |
class MicrosoftTranslator:
|
|
|
4 |
import logging
|
5 |
import sys
|
6 |
|
7 |
+
from .constants import BASE_URLS, MICROSOFT_CODES_TO_LANGUAGES
|
8 |
+
from .exceptions import LanguageNotSupportedException, ServerException, MicrosoftAPIerror
|
9 |
|
10 |
|
11 |
class MicrosoftTranslator:
|
deep_translator/mymemory.py
CHANGED
@@ -4,13 +4,13 @@ mymemory translator API
|
|
4 |
import logging
|
5 |
import warnings
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
from
|
14 |
import requests
|
15 |
from time import sleep
|
16 |
|
|
|
4 |
import logging
|
5 |
import warnings
|
6 |
|
7 |
+
from .constants import BASE_URLS, GOOGLE_LANGUAGES_TO_CODES
|
8 |
+
from .exceptions import (NotValidPayload,
|
9 |
+
TranslationNotFound,
|
10 |
+
LanguageNotSupportedException,
|
11 |
+
RequestError,
|
12 |
+
TooManyRequests)
|
13 |
+
from .parent import BaseTranslator
|
14 |
import requests
|
15 |
from time import sleep
|
16 |
|
deep_translator/papago.py
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
google translator API
|
3 |
"""
|
4 |
import json
|
5 |
-
from
|
6 |
-
from
|
7 |
import requests
|
8 |
import warnings
|
9 |
import logging
|
|
|
2 |
google translator API
|
3 |
"""
|
4 |
import json
|
5 |
+
from .constants import BASE_URLS, PAPAGO_LANGUAGE_TO_CODE
|
6 |
+
from .exceptions import LanguageNotSupportedException, TranslationNotFound, NotValidPayload
|
7 |
import requests
|
8 |
import warnings
|
9 |
import logging
|
deep_translator/parent.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
"""parent translator class"""
|
2 |
|
3 |
-
from
|
4 |
from abc import ABC, abstractmethod
|
5 |
import string
|
6 |
-
|
7 |
-
|
8 |
class BaseTranslator(ABC):
|
9 |
"""
|
10 |
Abstract class that serve as a parent translator for other different translators
|
|
|
1 |
"""parent translator class"""
|
2 |
|
3 |
+
from .exceptions import NotValidPayload, NotValidLength, InvalidSourceOrTargetLanguage
|
4 |
from abc import ABC, abstractmethod
|
5 |
import string
|
|
|
|
|
6 |
class BaseTranslator(ABC):
|
7 |
"""
|
8 |
Abstract class that serve as a parent translator for other different translators
|
deep_translator/pons.py
CHANGED
@@ -3,14 +3,14 @@ pons translator API
|
|
3 |
"""
|
4 |
from bs4 import BeautifulSoup
|
5 |
import requests
|
6 |
-
from
|
7 |
-
from
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
from
|
14 |
from requests.utils import requote_uri
|
15 |
|
16 |
|
|
|
3 |
"""
|
4 |
from bs4 import BeautifulSoup
|
5 |
import requests
|
6 |
+
from .constants import BASE_URLS, PONS_LANGUAGES_TO_CODES, PONS_CODES_TO_LANGUAGES
|
7 |
+
from .exceptions import (LanguageNotSupportedException,
|
8 |
+
TranslationNotFound,
|
9 |
+
NotValidPayload,
|
10 |
+
ElementNotFoundInGetRequest,
|
11 |
+
RequestError,
|
12 |
+
TooManyRequests)
|
13 |
+
from .parent import BaseTranslator
|
14 |
from requests.utils import requote_uri
|
15 |
|
16 |
|
deep_translator/qcri.py
CHANGED
@@ -1,9 +1,7 @@
|
|
1 |
|
2 |
import requests
|
3 |
-
from
|
4 |
-
from
|
5 |
-
ServerException, TranslationNotFound)
|
6 |
-
|
7 |
|
8 |
class QCRI(object):
|
9 |
"""
|
|
|
1 |
|
2 |
import requests
|
3 |
+
from .constants import BASE_URLS, QCRI_LANGUAGE_TO_CODE
|
4 |
+
from .exceptions import (ServerException, TranslationNotFound)
|
|
|
|
|
5 |
|
6 |
class QCRI(object):
|
7 |
"""
|
deep_translator/tests/test_cli.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
"""Tests for the CLI interface."""
|
4 |
+
|
5 |
+
from click.testing import CliRunner
|
6 |
+
from deep_translator import __main__
|
7 |
+
|
8 |
+
def results_test():
|
9 |
+
runner = CliRunner()
|
10 |
+
result = runner.invoke(__main__.main, [ 'google', 'auto', 'en', '좋은'])
|
11 |
+
assert result.exit_code == 0
|
12 |
+
assert result == 'good'
|
13 |
+
|
14 |
+
api_error = runner.invoke(__main__.main, ['microsoft','auto','en','Zwei minimale Dellchen auf der Rückseite.'])
|
15 |
+
assert api_error.exit_code == 0
|
16 |
+
assert api_error == "This translator requires an api key provided through --api-key"
|
deep_translator/utils.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1 |
"""
|
2 |
utilities
|
3 |
"""
|
|
|
|
1 |
"""
|
2 |
utilities
|
3 |
"""
|
4 |
+
# TODO: Discussion: Whats the purpsoe of this module?
|
deep_translator/yandex.py
CHANGED
@@ -2,10 +2,8 @@
|
|
2 |
Yandex translator API
|
3 |
"""
|
4 |
import requests
|
5 |
-
from
|
6 |
-
from
|
7 |
-
ServerException, TranslationNotFound, TooManyRequests)
|
8 |
-
|
9 |
|
10 |
class YandexTranslator(object):
|
11 |
"""
|
|
|
2 |
Yandex translator API
|
3 |
"""
|
4 |
import requests
|
5 |
+
from .constants import BASE_URLS
|
6 |
+
from .exceptions import (RequestError, ServerException, TranslationNotFound, TooManyRequests)
|
|
|
|
|
7 |
|
8 |
class YandexTranslator(object):
|
9 |
"""
|
pyproject.toml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[build-system]
|
2 |
+
requires = ["setuptools", "wheel"]
|
3 |
+
build-backend = "setuptools.build_meta"
|
setup.cfg
CHANGED
@@ -1,3 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
[bumpversion]
|
2 |
current_version = 1.4.4
|
3 |
commit = True
|
@@ -11,16 +66,15 @@ replace = version='{new_version}'
|
|
11 |
search = __version__ = '{current_version}'
|
12 |
replace = __version__ = '{new_version}'
|
13 |
|
14 |
-
[bdist_wheel]
|
15 |
-
universal = 1
|
16 |
-
|
17 |
-
[flake8]
|
18 |
-
exclude = docs
|
19 |
|
20 |
-
[
|
21 |
-
#
|
22 |
-
test = pytest
|
23 |
|
24 |
-
[
|
25 |
-
|
|
|
26 |
|
|
|
|
|
|
1 |
+
#main config
|
2 |
+
[metadata]
|
3 |
+
name = Deep Translator
|
4 |
+
version = 1.4.4
|
5 |
+
url = https://github.com/nidhaloff/deep_translator
|
6 |
+
author = Nidhal Baccouri
|
7 |
+
author_email = [email protected]
|
8 |
+
maintainer = Nidhal Baccouri
|
9 |
+
maintainer_email = [email protected]
|
10 |
+
classifiers =
|
11 |
+
Development Status :: 5 - Production/Stable,
|
12 |
+
Intended Audience :: Developers,
|
13 |
+
Intended Audience :: Education,
|
14 |
+
Intended Audience :: Information Technology,
|
15 |
+
License :: OSI Approved :: MIT License,
|
16 |
+
Topic :: Education,
|
17 |
+
Topic :: Software Development,
|
18 |
+
Topic :: Communications,
|
19 |
+
Topic :: Text Processing,
|
20 |
+
Topic :: Text Processing :: Linguistic,
|
21 |
+
Natural Language :: English,
|
22 |
+
Operating System :: OS Independent,
|
23 |
+
Programming Language :: Python :: 3,
|
24 |
+
Programming Language :: Python :: 3.5,
|
25 |
+
Programming Language :: Python :: 3.6,
|
26 |
+
Programming Language :: Python :: 3.7,
|
27 |
+
Programming Language :: Python :: 3.8
|
28 |
+
license = MIT
|
29 |
+
license_files = file:LICENSE
|
30 |
+
description = A flexible python tool to translate between different languages in a simple way.
|
31 |
+
long_description = file:README.rst
|
32 |
+
long_description_content_type = text/rst
|
33 |
+
keywords = deep_translator, deepL, DeepL, translator, translation, automation,
|
34 |
+
web scraping, google translator, google translation, google trans, PONS,
|
35 |
+
YANDEX, MyMemory translator, Linguee, QCRI, Language, Language detection,
|
36 |
+
detect language, free translation, unlimited translation, translate for free
|
37 |
+
|
38 |
+
# [options]
|
39 |
+
# zip_safe = 0
|
40 |
+
# setup_requires = pytest-runner
|
41 |
+
# install_requires = requests; beautifulsoup4; click
|
42 |
+
# python_requires = >=3.0
|
43 |
+
# tests_require = pytest>=3
|
44 |
+
# include_package_data = 1
|
45 |
+
# packages = find:
|
46 |
+
# package_dir = =deep_translator
|
47 |
+
|
48 |
+
# [options.entry_points]
|
49 |
+
# console_scripts = deep-translator = deep_translator.__main__:deep_translator
|
50 |
+
# dt = deep_translator.__main__:deep_translator
|
51 |
+
|
52 |
+
# [options.packages.find]
|
53 |
+
# where = deep_translator
|
54 |
+
|
55 |
+
# bumpversion config
|
56 |
[bumpversion]
|
57 |
current_version = 1.4.4
|
58 |
commit = True
|
|
|
66 |
search = __version__ = '{current_version}'
|
67 |
replace = __version__ = '{new_version}'
|
68 |
|
69 |
+
# [bdist_wheel]
|
70 |
+
# universal = 1
|
|
|
|
|
|
|
71 |
|
72 |
+
# [flake8]
|
73 |
+
# exclude = docs
|
|
|
74 |
|
75 |
+
# [aliases]
|
76 |
+
# # Define setup.py command aliases here
|
77 |
+
# test = pytest
|
78 |
|
79 |
+
# [tool:pytest]
|
80 |
+
# collect_ignore = [setup.py]
|
setup.py
CHANGED
@@ -1,75 +1,17 @@
|
|
1 |
-
#!/usr/bin/env python
|
2 |
-
|
3 |
"""The setup script."""
|
4 |
-
|
5 |
from setuptools import setup, find_packages
|
6 |
|
7 |
-
with open('README.rst') as readme_file:
|
8 |
-
readme = readme_file.read()
|
9 |
-
|
10 |
-
with open('HISTORY.rst') as history_file:
|
11 |
-
history = history_file.read()
|
12 |
-
|
13 |
-
|
14 |
-
# with open('./re') as reqs:
|
15 |
-
# requirements = reqs.read()
|
16 |
-
# print(requirements)
|
17 |
-
# exit()
|
18 |
-
setup_requirements = ['pytest-runner', ]
|
19 |
-
|
20 |
-
test_requirements = ['pytest>=3', ]
|
21 |
-
|
22 |
setup(
|
23 |
-
author="Nidhal Baccouri",
|
24 |
-
author_email='[email protected]',
|
25 |
-
maintainer="Nidhal Baccouri",
|
26 |
-
maintainer_email='[email protected]',
|
27 |
-
python_requires='>=3.0',
|
28 |
-
classifiers=[
|
29 |
-
'Development Status :: 5 - Production/Stable',
|
30 |
-
'Intended Audience :: Developers',
|
31 |
-
'Intended Audience :: Education',
|
32 |
-
'Intended Audience :: Information Technology',
|
33 |
-
'License :: OSI Approved :: MIT License',
|
34 |
-
'Topic :: Education',
|
35 |
-
'Topic :: Software Development',
|
36 |
-
'Topic :: Communications',
|
37 |
-
'Topic :: Text Processing',
|
38 |
-
'Topic :: Text Processing :: Linguistic',
|
39 |
-
'Natural Language :: English',
|
40 |
-
'Operating System :: OS Independent',
|
41 |
-
'Programming Language :: Python :: 3',
|
42 |
-
'Programming Language :: Python :: 3.5',
|
43 |
-
'Programming Language :: Python :: 3.6',
|
44 |
-
'Programming Language :: Python :: 3.7',
|
45 |
-
'Programming Language :: Python :: 3.8',
|
46 |
-
],
|
47 |
-
description="A flexible python tool to translate between different languages in a simple way.",
|
48 |
-
entry_points={
|
49 |
-
'console_scripts': [
|
50 |
-
'deep_translator=deep_translator.cli:main',
|
51 |
-
],
|
52 |
-
},
|
53 |
-
install_requires=['requests', 'beautifulsoup4'],
|
54 |
-
license="MIT license",
|
55 |
-
long_description=readme + '\n\n' + history,
|
56 |
-
include_package_data=True,
|
57 |
-
keywords=['deep_translator',
|
58 |
-
'deepL', 'DeepL',
|
59 |
-
'translator',
|
60 |
-
'translation',
|
61 |
-
'automation',
|
62 |
-
'web scraping',
|
63 |
-
'google translator', 'google translation', 'google trans',
|
64 |
-
'PONS', 'YANDEX', 'MyMemory translator', 'Linguee', 'QCRI',
|
65 |
-
'Language', 'Language detection', 'detect language',
|
66 |
-
'free translation', 'unlimited translation', 'translate for free'],
|
67 |
-
name='deep_translator',
|
68 |
-
packages=find_packages(include=['deep_translator']),
|
69 |
-
setup_requires=setup_requirements,
|
70 |
-
test_suite='tests',
|
71 |
-
tests_require=test_requirements,
|
72 |
-
url='https://github.com/nidhaloff/deep_translator',
|
73 |
-
version='1.4.4',
|
74 |
zip_safe=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
)
|
|
|
1 |
+
# #!/usr/bin/env python
|
|
|
2 |
"""The setup script."""
|
|
|
3 |
from setuptools import setup, find_packages
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
setup(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
zip_safe=False,
|
7 |
+
setup_requires=['pytest-runner',],
|
8 |
+
install_requires=['requests','beautifulsoup4','click',],
|
9 |
+
python_requires='>=3',
|
10 |
+
tests_require=['pytest>=3',],
|
11 |
+
include_package_data=True,
|
12 |
+
packages=find_packages(include=['deep_translator'],),
|
13 |
+
entry_points={'console_scripts':[
|
14 |
+
'deep-translator=deep_translator.__main__:main',
|
15 |
+
'dt=deep_translator.__main__:main',
|
16 |
+
],},
|
17 |
)
|