Commit
·
e490a50
1
Parent(s):
486464f
Add Poetry project and documentation to setup a fully standalone working project
Browse files- .flake8 +37 -0
- .gitignore +135 -0
- README.md +191 -4
- poetry.lock +0 -0
- poetry.toml +3 -0
- pre-commit-config.yaml +62 -0
- pyproject.toml +37 -0
.flake8
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[flake8]
|
2 |
+
select = ANN,B,B9,BLK,C,D,E,F,I,S,W
|
3 |
+
# only check selected error codes
|
4 |
+
max-complexity = 12
|
5 |
+
# C9 - flake8 McCabe Complexity checker -- threshold
|
6 |
+
max-line-length = 120
|
7 |
+
# E501 - flake8 -- line length too long, actually handled by black
|
8 |
+
extend-ignore =
|
9 |
+
# E W - flake8 PEP style check
|
10 |
+
E203,E402,E501,W503, # whitespace, import, line length, binary operator line breaks
|
11 |
+
# S - flake8-bandit safety check
|
12 |
+
S101,S311,S105, # assert removed in bytecode, pRNG not secure, hardcoded password
|
13 |
+
# ANN - flake8-annotations type annotation check
|
14 |
+
ANN,ANN002,ANN003,ANN101,ANN102,ANN202, # ignore all for now, but always ignore some
|
15 |
+
# D1 - flake8-docstrings docstring style check
|
16 |
+
D100,D102,D103,D104,D105, # missing docstrings
|
17 |
+
# D2 D4 - flake8-docstrings docstring style check
|
18 |
+
D200,D205,D400,D401, # whitespace issues and first line content
|
19 |
+
# DAR - flake8-darglint docstring correctness check
|
20 |
+
DAR103, # mismatched or missing type in docstring
|
21 |
+
application-import-names = app_gradio,text_recognizer,tests,training
|
22 |
+
# flake8-import-order: which names are first party?
|
23 |
+
import-order-style = google
|
24 |
+
# flake8-import-order: which import order style guide do we use?
|
25 |
+
docstring-convention = numpy
|
26 |
+
# flake8-docstrings: which docstring style guide do we use?
|
27 |
+
strictness = short
|
28 |
+
# darglint: how "strict" are we with docstring completeness?
|
29 |
+
docstring-style = numpy
|
30 |
+
# darglint: which docstring style guide do we use?
|
31 |
+
suppress-none-returning = true
|
32 |
+
# flake8-annotations: do we allow un-annotated Nones in returns?
|
33 |
+
mypy-init-return = true
|
34 |
+
# flake8-annotations: do we allow init to have no return annotation?
|
35 |
+
per-file-ignores =
|
36 |
+
# list of case-by-case ignores, see files for details
|
37 |
+
*/__init__.py:F401,I
|
.gitignore
ADDED
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Mac Files filter
|
2 |
+
.DS_Store
|
3 |
+
|
4 |
+
# Byte-compiled / optimized / DLL files
|
5 |
+
__pycache__/
|
6 |
+
*.py[cod]
|
7 |
+
*$py.class
|
8 |
+
|
9 |
+
# C extensions
|
10 |
+
*.so
|
11 |
+
|
12 |
+
# Distribution / packaging
|
13 |
+
.Python
|
14 |
+
build/
|
15 |
+
develop-eggs/
|
16 |
+
dist/
|
17 |
+
downloads/
|
18 |
+
eggs/
|
19 |
+
.eggs/
|
20 |
+
lib/
|
21 |
+
lib64/
|
22 |
+
parts/
|
23 |
+
sdist/
|
24 |
+
var/
|
25 |
+
wheels/
|
26 |
+
pip-wheel-metadata/
|
27 |
+
share/python-wheels/
|
28 |
+
*.egg-info/
|
29 |
+
.installed.cfg
|
30 |
+
*.egg
|
31 |
+
MANIFEST
|
32 |
+
|
33 |
+
# PyInstaller
|
34 |
+
# Usually these files are written by a python script from a template
|
35 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
36 |
+
*.manifest
|
37 |
+
*.spec
|
38 |
+
|
39 |
+
# Installer logs
|
40 |
+
pip-log.txt
|
41 |
+
pip-delete-this-directory.txt
|
42 |
+
|
43 |
+
# Unit test / coverage reports
|
44 |
+
htmlcov/
|
45 |
+
.tox/
|
46 |
+
.nox/
|
47 |
+
.coverage
|
48 |
+
.coverage.*
|
49 |
+
.cache
|
50 |
+
nosetests.xml
|
51 |
+
coverage.xml
|
52 |
+
*.cover
|
53 |
+
*.py,cover
|
54 |
+
.hypothesis/
|
55 |
+
.pytest_cache/
|
56 |
+
|
57 |
+
# Translations
|
58 |
+
*.mo
|
59 |
+
*.pot
|
60 |
+
|
61 |
+
# Django stuff:
|
62 |
+
*.log
|
63 |
+
local_settings.py
|
64 |
+
db.sqlite3
|
65 |
+
db.sqlite3-journal
|
66 |
+
|
67 |
+
# Flask stuff:
|
68 |
+
instance/
|
69 |
+
.webassets-cache
|
70 |
+
|
71 |
+
# Scrapy stuff:
|
72 |
+
.scrapy
|
73 |
+
|
74 |
+
# Sphinx documentation
|
75 |
+
docs/_build/
|
76 |
+
|
77 |
+
# PyBuilder
|
78 |
+
target/
|
79 |
+
|
80 |
+
# Jupyter Notebook
|
81 |
+
.ipynb_checkpoints
|
82 |
+
|
83 |
+
# IPython
|
84 |
+
profile_default/
|
85 |
+
ipython_config.py
|
86 |
+
|
87 |
+
# pyenv
|
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 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
98 |
+
__pypackages__/
|
99 |
+
|
100 |
+
# Celery stuff
|
101 |
+
celerybeat-schedule
|
102 |
+
celerybeat.pid
|
103 |
+
|
104 |
+
# SageMath parsed files
|
105 |
+
*.sage.py
|
106 |
+
|
107 |
+
# Environments
|
108 |
+
.env
|
109 |
+
.venv
|
110 |
+
env/
|
111 |
+
venv/
|
112 |
+
ENV/
|
113 |
+
env.bak/
|
114 |
+
venv.bak/
|
115 |
+
|
116 |
+
# Spyder project settings
|
117 |
+
.spyderproject
|
118 |
+
.spyproject
|
119 |
+
|
120 |
+
# Rope project settings
|
121 |
+
.ropeproject
|
122 |
+
|
123 |
+
# mkdocs documentation
|
124 |
+
/site
|
125 |
+
|
126 |
+
# mypy
|
127 |
+
.mypy_cache/
|
128 |
+
.dmypy.json
|
129 |
+
dmypy.json
|
130 |
+
|
131 |
+
# Pyre type checker
|
132 |
+
.pyre/
|
133 |
+
|
134 |
+
# VSCode
|
135 |
+
.vscode/
|
README.md
CHANGED
@@ -15,6 +15,8 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
15 |
|
16 |
# Development Instructions
|
17 |
|
|
|
|
|
18 |
Go to the directory where you store your `dev` projects (e.g. `dev`)
|
19 |
|
20 |
```sh
|
@@ -26,14 +28,199 @@ Clone the app repo from HF spaces:
|
|
26 |
git clone https://huggingface.co/spaces/spanish-classifier-tfg/spanish-tweet-classifier
|
27 |
```
|
28 |
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
```
|
32 |
-
|
|
|
|
|
|
|
33 |
```
|
34 |
|
35 |
-
|
|
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
code .
|
39 |
-
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
# Development Instructions
|
17 |
|
18 |
+
## Clone this project
|
19 |
+
|
20 |
Go to the directory where you store your `dev` projects (e.g. `dev`)
|
21 |
|
22 |
```sh
|
|
|
28 |
git clone https://huggingface.co/spaces/spanish-classifier-tfg/spanish-tweet-classifier
|
29 |
```
|
30 |
|
31 |
+
## Python environment management with Pyenv
|
32 |
+
|
33 |
+
To avoid the problems of Python versions, lets use the `pyenv` tool.
|
34 |
+
|
35 |
+
Before we start, let's go to our $HOME directory:
|
36 |
+
```sh
|
37 |
+
cd $HOME
|
38 |
+
```
|
39 |
+
Now you shoud be in your root directory, e.g. `/Users/fperez` (You can check the current directory where you are with the command `pwd`)
|
40 |
+
|
41 |
+
Then, let's update `brew` and install `pyenv`
|
42 |
+
```sh
|
43 |
+
brew update
|
44 |
+
brew install pyenv
|
45 |
+
```
|
46 |
+
|
47 |
+
Then, for the Zsh, execute in the terminal:
|
48 |
+
```sh
|
49 |
+
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
|
50 |
+
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
|
51 |
+
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
|
52 |
+
```
|
53 |
+
|
54 |
+
Then restart the terminal to allow the previous changes to work!!!
|
55 |
+
|
56 |
+
If you executed the previous steps correctly, now you would be able to show all the python available versions at this time with `pyenv` lets execute:
|
57 |
+
|
58 |
+
```sh
|
59 |
+
pyenv versions
|
60 |
+
```
|
61 |
+
|
62 |
+
This will show us something like this:
|
63 |
+
```
|
64 |
+
system
|
65 |
+
3.6.0
|
66 |
+
* anaconda3-4.3.0 (set by /Users/fperez/.python-version)
|
67 |
+
```
|
68 |
+
|
69 |
+
Let's show the local Python version with `pyenv`, which should be the same shown when executing `python --version`
|
70 |
+
```sh
|
71 |
+
pyenv local
|
72 |
+
```
|
73 |
+
This should show your current local active version of Python. In my case shows the Python version corresponding to the * shown above (anaconda3-4.3.0 which corresponds to Python version 3.6.0)
|
74 |
+
|
75 |
+
Same applies for the global version:
|
76 |
+
```sh
|
77 |
+
pyenv global
|
78 |
+
```
|
79 |
+
|
80 |
+
Let's install a new specific global version. We will use it later in this project with Poetry:
|
81 |
+
```sh
|
82 |
+
pyenv install 3.9.12
|
83 |
+
```
|
84 |
+
|
85 |
+
Now the 3.9.12 version of Python should be installed but not set as a default neither as local nor global Python versions yet. Let's check this:
|
86 |
+
|
87 |
+
```sh
|
88 |
+
pyenv version
|
89 |
+
```
|
90 |
+
Should still show us the previous version present in your system (the same one as shown above for the `pyenv local`, 3.6.0 in my case).
|
91 |
+
|
92 |
+
Let's set 3.9.12 as the default version:
|
93 |
+
|
94 |
+
```sh
|
95 |
+
pyenv global 3.9.12
|
96 |
+
pyenv local 3.9.12
|
97 |
+
```
|
98 |
+
|
99 |
+
Doing this, sets the global version in the file `~/.pyenv/version` and the local version in `~/.python-version` both to 3.9.12 (you can check the content of these files with `cat ~/.pyenv/version` and `cat `~/.python-version`).
|
100 |
+
|
101 |
+
So, now:
|
102 |
+
```sh
|
103 |
+
python --version
|
104 |
+
pyenv version
|
105 |
+
```
|
106 |
+
should output `3.9.12`
|
107 |
|
108 |
+
In the same way:
|
109 |
+
```sh
|
110 |
+
pyenv versions
|
111 |
+
```
|
112 |
+
should output something similar to:
|
113 |
```
|
114 |
+
system
|
115 |
+
3.6.0
|
116 |
+
* 3.9.12 (set by /Users/fperez/dev/spanish-tweet-classifier/.python-version)
|
117 |
+
anaconda3-4.3.0
|
118 |
```
|
119 |
|
120 |
+
Now the problem with Python versions should be solved in your Mac! If you start a new terminal,
|
121 |
+
the `python --version` command should show `3.9.12`. Check it out by opening a new terminal!
|
122 |
|
123 |
+
Find more info about pyenv [here](https://realpython.com/intro-to-pyenv/)
|
124 |
+
|
125 |
+
## Virtual environments with Poetry
|
126 |
+
|
127 |
+
Install [poetry](https://python-poetry.org/docs/):
|
128 |
+
```sh
|
129 |
+
curl -sSL https://install.python-poetry.org | python3 -
|
130 |
+
```
|
131 |
+
|
132 |
+
Add poetry to your PATH env variable:
|
133 |
+
```sh
|
134 |
+
$HOME/.local/bin
|
135 |
```
|
136 |
+
```sh
|
137 |
+
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.zshrc
|
138 |
+
```
|
139 |
+
|
140 |
+
Restart the terminal!
|
141 |
+
|
142 |
+
When back, let's show the poetry version:
|
143 |
+
```sh
|
144 |
+
poetry --version
|
145 |
+
```
|
146 |
+
should show you something like `1.4.0`. Now poetry is working.
|
147 |
+
|
148 |
+
### Install dependencies with poetry
|
149 |
+
|
150 |
+
Go to the project directory:
|
151 |
+
```sh
|
152 |
+
cd ~/dev/spanish-tweet-classifier
|
153 |
+
```
|
154 |
+
|
155 |
+
Activate the shell, which in turn will create a Python virtual environment for the project.
|
156 |
+
```
|
157 |
+
poetry shell
|
158 |
+
```
|
159 |
+
|
160 |
+
As the poetry project has been configured to create a virtual environemnt in the project itself (see the contents
|
161 |
+
of the `poetry.toml` file), this command will create a `.venv` directory in the root directory of the project.
|
162 |
+
|
163 |
+
Install the project dependencies:
|
164 |
+
```sh
|
165 |
+
poetry install --with dev
|
166 |
+
```
|
167 |
+
|
168 |
+
All the dependencies for the project will be included in the `.venv` created by the command above.
|
169 |
+
|
170 |
+
```sh
|
171 |
+
poetry env list
|
172 |
+
```
|
173 |
+
should show something like:
|
174 |
+
```
|
175 |
+
.venv (Activated)
|
176 |
+
```
|
177 |
+
and the command
|
178 |
+
```sh
|
179 |
+
which python3
|
180 |
+
```
|
181 |
+
should show something like:;
|
182 |
+
```
|
183 |
+
/Users/fperez/.pyenv/shims/python3
|
184 |
+
```
|
185 |
+
|
186 |
+
### VSCode with poetry
|
187 |
+
|
188 |
+
Once the project has been configured with the virtual environment, you can use it (and you should) also in VSCode.
|
189 |
+
|
190 |
+
Steps:
|
191 |
+
|
192 |
+
1. Close VSCode (just in case you had the project window already open)
|
193 |
+
2. In the project directory (e.g. `~/dev/spanish-tweet-classifier`), execute the command:
|
194 |
+
```sh
|
195 |
code .
|
196 |
+
```
|
197 |
+
|
198 |
+
Then a new window for the project should appear in VSCode. When selecting a Python file it should show in the
|
199 |
+
lower right part of the IDE the Python version 3.9.12 and the active virtual environment ('.venv': poetry).
|
200 |
+
|
201 |
+
**NOTE:** If the `.venv` virtual enviroment is not activated by default, activate it manually in VSCode using `CMD+Shift+P` and selecting the Python interpreter from the `.venv` directory in the project.
|
202 |
+
|
203 |
+
Also if you open a terminal in VSCode, the virtual environment should be detected and something similar to the
|
204 |
+
following should appear in the terminal:
|
205 |
+
```
|
206 |
+
source /Users/fperez/dev/spanish-tweet-classifier/.venv/bin/activate
|
207 |
+
```
|
208 |
+
|
209 |
+
## Execute the showcase app locally in your laptop!
|
210 |
+
|
211 |
+
After all the previous steps have been done, now you should be able to execute the application locally. All the dependencies for this app should be working so:
|
212 |
+
|
213 |
+
1. Go to the root directory of the project
|
214 |
+
```sh
|
215 |
+
cd ~/dev/spanish-tweet-classifier
|
216 |
+
```
|
217 |
+
2. If you have open a new terminal, be sure that you are in a poetry shell! Otherwise activate it with:
|
218 |
+
```sh
|
219 |
+
poetry shell
|
220 |
+
```
|
221 |
+
3. Launch the showcase app with streamlit
|
222 |
+
```sh
|
223 |
+
poetry run streamlit run showcase_app.py
|
224 |
+
```
|
225 |
+
4. The previous command should launch a browser windown pointing to [http://localhost:8501](http://localhost:8581) and you should be able to play with the app!
|
226 |
+
5. In the terminal, you can stop the local web server started by streamlit pressing `CTRL+C`
|
poetry.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|
poetry.toml
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
[virtualenvs]
|
2 |
+
create = true
|
3 |
+
in-project = true
|
pre-commit-config.yaml
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
repos:
|
3 |
+
# a set of useful Python-based pre-commit hooks
|
4 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
5 |
+
rev: v4.1.0
|
6 |
+
hooks:
|
7 |
+
# list of definitions and supported hooks: https://pre-commit.com/hooks.html
|
8 |
+
- id: trailing-whitespace # removes any whitespace at the ends of lines
|
9 |
+
- id: check-toml # check toml syntax by loading all toml files
|
10 |
+
- id: check-yaml # check yaml syntax by loading all yaml files
|
11 |
+
- id: check-json # check-json syntax by loading all json files
|
12 |
+
- id: check-merge-conflict # check for files with merge conflict strings
|
13 |
+
args: ['--assume-in-merge'] # and run this check even when not explicitly in a merge
|
14 |
+
- id: check-added-large-files # check that no "large" files have been added
|
15 |
+
args: ['--maxkb=10240'] # where large means 10MB+, as in Hugging Face's git server
|
16 |
+
- id: debug-statements # check for python debug statements (import pdb, breakpoint, etc.)
|
17 |
+
- id: detect-private-key # checks for private keys (BEGIN X PRIVATE KEY, etc.)
|
18 |
+
|
19 |
+
# sort imports
|
20 |
+
- repo: https://github.com/pycqa/isort
|
21 |
+
rev: 5.10.1
|
22 |
+
hooks:
|
23 |
+
- id: isort
|
24 |
+
name: isort (python)
|
25 |
+
|
26 |
+
# black python autoformatting
|
27 |
+
- repo: https://github.com/psf/black
|
28 |
+
rev: 22.8.0
|
29 |
+
hooks:
|
30 |
+
- id: black
|
31 |
+
# additional configuration of black in pyproject.toml
|
32 |
+
|
33 |
+
# remove unused imports and variables
|
34 |
+
- repo: https://github.com/PyCQA/autoflake
|
35 |
+
rev: v1.5.3
|
36 |
+
hooks:
|
37 |
+
- id: autoflake
|
38 |
+
|
39 |
+
# flake8 python linter with all the fixins
|
40 |
+
- repo: https://github.com/PyCQA/flake8
|
41 |
+
rev: 3.9.2
|
42 |
+
hooks:
|
43 |
+
- id: flake8
|
44 |
+
exclude: ()
|
45 |
+
additional_dependencies: [
|
46 |
+
flake8-annotations, flake8-bandit, flake8-bugbear, flake8-black, flake8-docstrings,
|
47 |
+
flake8-import-order, darglint, mypy, pycodestyle, pydocstyle]
|
48 |
+
args: ["--config", ".flake8"]
|
49 |
+
# additional configuration of flake8 and extensions in .flake8
|
50 |
+
|
51 |
+
# shellcheck-py for linting shell files
|
52 |
+
- repo: https://github.com/shellcheck-py/shellcheck-py
|
53 |
+
rev: v0.8.0.4
|
54 |
+
hooks:
|
55 |
+
- id: shellcheck
|
56 |
+
|
57 |
+
# typing with mypy
|
58 |
+
# - repo: https://github.com/pre-commit/mirrors-mypy
|
59 |
+
# rev: v0.971
|
60 |
+
# hooks:
|
61 |
+
# - id: mypy
|
62 |
+
# exclude: ^tests/
|
pyproject.toml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.poetry]
|
2 |
+
name = "spanish-tweet-classifier"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = "The app to showcase the tweet classifier"
|
5 |
+
authors = ["Your Name <[email protected]>"]
|
6 |
+
license = "MIT"
|
7 |
+
readme = "README.md"
|
8 |
+
packages = [{include = "spanish_tweet_classifier"}]
|
9 |
+
|
10 |
+
[tool.poetry.dependencies]
|
11 |
+
python = "^3.9.8"
|
12 |
+
transformers = "^4.26.1"
|
13 |
+
openai = "^0.27.2"
|
14 |
+
torch = "^1.13.1"
|
15 |
+
|
16 |
+
[tool.poetry.group.dev.dependencies]
|
17 |
+
streamlit = "^1.20.0"
|
18 |
+
black = "^23.1.0"
|
19 |
+
flake8 = "^6.0.0"
|
20 |
+
mypy = "^1.1.1"
|
21 |
+
pytest = "^7.2.2"
|
22 |
+
shellcheck-py = "^0.9.0.2"
|
23 |
+
isort = "^5.12.0"
|
24 |
+
pre-commit = "^3.1.1"
|
25 |
+
autoflake = "^2.0.2"
|
26 |
+
huggingface-hub = "^0.13.1"
|
27 |
+
|
28 |
+
[build-system]
|
29 |
+
requires = ["poetry-core"]
|
30 |
+
build-backend = "poetry.core.masonry.api"
|
31 |
+
|
32 |
+
[tool.isort]
|
33 |
+
profile = "black"
|
34 |
+
|
35 |
+
[tool.black]
|
36 |
+
line-length = 120
|
37 |
+
target-version = ["py39"]
|