Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
trybe-tech-ops authored Feb 19, 2024
0 parents commit ff14b20
Show file tree
Hide file tree
Showing 45 changed files with 1,581 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"words": [
"adminasd",
"argcount",
"autouse",
"Biopharma",
"BSON",
"conftest",
"FCXL",
"fontawesome",
"Frisby",
"globulus",
"GWSP",
"histssory",
"IHVX",
"instrucao",
"isabstractmethod",
"JNQT",
"joaozinho",
"LHWJ",
"parsel",
"PHENYLEPHRINE",
"Polacrilex",
"Portugues",
"Pymongo",
"pytest",
"Pytest",
"relatorio",
"REMEDYREPACK",
"Reqs",
"requisito",
"Silicea",
"soeusei",
"Spironolactone",
"trybe",
"tryber",
"usuario",
"varnames",
"VCSI",
"venv",
"VJPY",
"VRXJ",
"Werkzeug",
"WIVL",
"XFAIL",
"XKGX",
"YYUI",
"ZCXM",
"ZOWB"
],
"language": "en, pt-BR"
}
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = false

# Matches multiple files with brace expansion notation
# Set default charset
[*.{js,html,md,css,sql,py}]
charset = utf-8
indent_style = space
indent_size = 4
147 changes: 147 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
pytestdebug.log

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
doc/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
pythonenv*

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# profiling data
.prof

# End of https://www.toptal.com/developers/gitignore/api/python

# vscode docker container
.devcontainer
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM python:3-alpine3.17

WORKDIR /projeto-traduzo

# Dica: instale primeiro as dependências antes de copiar todo projeto
COPY *requirements.txt ./

RUN apk update && apk add git
RUN python3 -m pip install --upgrade pip

RUN pip install --no-cache-dir -r requirements.txt

# Este argumento será passado dentro do docker-compose
ARG FLASK_ENV
RUN if [ "$FLASK_ENV" = "dev" ] ; then pip install --no-cache-dir -r dev-requirements.txt ; fi

COPY . .

CMD ["python3", "src/app.py"]
12 changes: 12 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-r requirements.txt

beautifulsoup4==4.12.2
black==23.3.0
flake8==4.0.1
parsel==1.8.1
pytest==7.3.1
pytest-cov==4.1.0
pytest-env==0.8.2
pytest-json==0.4.0

pytest-dependency@git+https://github.com/betrybe/pytest-dependency@984f9d7d083870d091e8862a9b9c33fdf815b8d9
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3.4'

services:
translate:
build:
# Aqui que faz funcionar nosso IF do Dockerfile
args:
- FLASK_ENV=dev
context: .
volumes:
- ./:/projeto-traduzo/.
ports:
- 8000:8000
depends_on:
- mongodb
networks:
- flask_net
environment:
- MONGO_URI=mongodb://mongodb:27017
- FLASK_ENV=dev
- DB_NAME=db_traduzo
mongodb:
image: mongo:4.4.14
container_name: mongodb
restart: always
ports:
- 27017:27017
networks:
- flask_net

networks:
flask_net:
driver: bridge
6 changes: 6 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from deep_translator import GoogleTranslator

translated = GoogleTranslator(source="auto", target="pt").translate(
"Hi, would you like some ice cream?"
)
print(translated)
89 changes: 89 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"

[project]
name = "traduzo"
version = "0.1.0"
description = "Relatório de estoques"
readme = "readme.md"
requires-python = ">=3.8"

[project.scripts]
ir = "traduzo.__main__:main"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "-vv --capture=fd"
accept_xfail = true
testpaths = ["tests"]
filterwarnings = ["ignore::pytest.PytestDeprecationWarning"]
pythonpath = ["src"]
env = ["DB_NAME = test_db_traduzo"]

[tool.black]
line-length = 79
include = '\.pyi?$'
exclude = '''
/(
\.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''

[tool.mypy]
follow_imports = "silent"
show_column_numbers = true
strict = true
ignore_missing_imports = true
no_incremental = true

[[tool.mypy.overrides]]
module = ["tests.product.conftest", "tests.product_report.conftest"]
disable_error_code = "misc"

[project.optional-dependencies]
test = [
"wheel==0.40.0",
"factory-boy==3.2.1",
"Faker==18.9.0",
"pytest==7.3.1",
"pytest-cov==4.1.0",
"pytest-json==0.4.0",
"pytest-dependency@git+https://github.com/betrybe/pytest-dependency@311e45f9c512e89e6832f79047c6c29bc5a9b0f0"
]
alltest = [
"traduzo[test]",
"coverage==7.2.7",
"iniconfig==2.0.0",
"packaging==23.1",
"pluggy==1.0.0",
"python-dateutil==2.8.2",
"six==1.16.0",
]
dev = [
"traduzo[test]",
"black==23.3.0",
"flake8==6.0.0",
"isort==5.12.0",
"mypy==1.3.0",
]
alldev = [
"traduzo[dev]",
"traduzo[alltest]",
"click==8.1.3",
"mccabe==0.7.0",
"mypy-extensions==1.0.0",
"pathspec==0.11.1",
"platformdirs==3.5.1",
"pycodestyle==2.10.0",
"pyflakes==3.0.1",
"typing_extensions==4.6.2",
]
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
deep-translator==1.11.1
Flask==2.3.1
pymongo==4.3.3
waitress==2.1.2
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[flake8]
exclude =
.git,
.github/,
__pycache__,
.venv
max-complexity = 5
Empty file added src/__init__.py
Empty file.
Loading

0 comments on commit ff14b20

Please sign in to comment.