From f3335f4f4d31f93452130a96ce2455114d91b428 Mon Sep 17 00:00:00 2001 From: xTr4pSystem Date: Mon, 21 Nov 2022 22:04:14 +0200 Subject: [PATCH 1/3] feat(dockerfile): add dockefile and docker ignore --- .dockerignore | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++ Dockerfile | 11 +++ 2 files changed, 212 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..9e412d0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,201 @@ +**/.* +**/*.md +**/*.bak +**/*.pdf +Dockerfile* +radiance* +tests +data +docs +tags + +**/core + +# 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/ + +# 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/ + +# 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/ + +# Spyder project settings +**/.spyderproject +**/.spyproject + +# Rope project settings +**/.ropeproject + +# mkdocs documentation +**//site + +# mypy +**/.mypy_cache/ +**/.dmypy.json +**/dmypy.json + +# Pyre type checker +**/.pyre/ + +# - # +# C # +# - # +# Copied from https://github.com/github/gitignore/blob/master/C.gitignore + +# Prerequisites +**/*.d + +# Object files +**/*.o +**/*.ko +**/*.obj +**/*.elf + +# Linker output +**/*.ilk +**/*.map +**/*.exp + +# Precompiled Headers +**/*.gch +**/*.pch + +# Libraries +**/*.lib +**/*.a +**/*.la +**/*.lo + +# Shared objects (inc. Windows DLLs) +**/*.dll +**/*.so +**/*.so.* +**/*.dylib + +# Executables +**/*.exe +**/*.out +**/*.app +**/*.i*86 +**/*.x86_64 +**/*.hex + +# Debug files +**/*.dSYM/ +**/*.su +**/*.idb +**/*.pdb + +# Kernel Module Compile Results +**/*.mod* +**/*.cmd +**/.tmp_versions/ +**/modules.order +**/Module.symvers +**/Mkfile.old +**/dkms.conf + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..075dc3a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.9.5-slim + +WORKDIR /app + +COPY requirements.txt requirements.txt + +RUN pip3 install -r requirements.txt + +COPY . . + +CMD [ "gunicorn", "--chdir", "webapp", "-b", "0.0.0.0:8000", "app:app"] \ No newline at end of file From 5fe389941942571dfbf3eecc88f659d971b8bf9d Mon Sep 17 00:00:00 2001 From: xTr4pSystem Date: Mon, 21 Nov 2022 22:14:05 +0200 Subject: [PATCH 2/3] chore(readme): updated readme with docker instructions --- README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ce68cb6..8c7dc4e 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,12 @@ PULL REQUESTS WELCOME! It would be mega awesome if you could help in any way (especially with language addition/curation). **How to add a new language:** + 1. Make a folder in webapp/data/languages/ with the language code (e.g. en, de, fr, qya, etc.) -2. Add a list of 5-letter words and call it {lang_code}_5words.txt - 1. (Optional) Add a language_config.json file - 2. (Optional) Add a keyboard configuration - 3. (Optional) Add a list of supplemental words (useful to have this for weird/rare words, and only have 'common' words in the main 5words.txt file) +2. Add a list of 5-letter words and call it {lang_code}\_5words.txt + 1. (Optional) Add a language_config.json file + 2. (Optional) Add a keyboard configuration + 3. (Optional) Add a list of supplemental words (useful to have this for weird/rare words, and only have 'common' words in the main 5words.txt file) Voilà! @@ -24,14 +25,21 @@ If you want to test out your changes, you can run the server locally. 1. Install Python 3 2. Install requirements -```pip3 install -r requirements.txt``` + `pip3 install -r requirements.txt` 3. Run web server locally -```gunicorn --chdir webapp app:app``` + `gunicorn --chdir webapp app:app` 4. Navigate to [http://127.0.0.1:8000/](http://127.0.0.1:8000/) +# Using docker + +1. Make sure you have docker installed. +2. Run docker build . -t wordle +3. Run docker run -d -p 8000:8000 wordle + ## TODOs + - [ ] take into account browser bar height on mobile - [ ] curate wordlists for existing languages - [ ] add keyboard layouts for existing languages @@ -39,17 +47,20 @@ If you want to test out your changes, you can run the server locally. - [ ] fully translate game interface (missing score streaks and options) Potential improvements: + - [ ] nice animations for revealing letters & such - [ ] make a 4, 6, 7 letter version - [ ] deal with accents & character modifiers better (e.g. french is horrible right now) Nice to haves: + - [ ] improve code quality (e.g. make variable names consistent, code more reusable & less hacky) - [ ] properly integrate TailwindCSS and Vue.js (i.e. not from CDN) - [ ] tests... ## Status of Languages -``` + +``` - Hebrew (he): 🟨 (64540 words) - Serbian (sr): 🟨 (17968 words) - Central Kurdish (ckb): 🟩 (14819 words) @@ -119,6 +130,7 @@ Nice to haves: ![](scripts/out/n_words.png) ## Credits: + - Josh Wardle (original Wordle creator) - NYT (presumably holds the copyright or some IP rights or something with their $$$ purchase) - Elizabeth S (inventor of the Wordle grid) @@ -127,6 +139,7 @@ Nice to haves: - [Wordles of the World](https://gitlab.com/rwmpelstilzchen/wordles) for a community-sourced list of wordle-derivatives (it's impressive how many actually exist) ## Data sources + - https://www.nytimes.com/games/wordle/index.html - english word list - https://kaino.kotus.fi/sanat/nykysuomi/ - Finnish word list - https://github.com/wooorm/dictionaries - most other word lists ([Titus Wormer](https://wooorm.com/) is an incredible dude) From 307c02e1c0011d08b796e9deee72bc488cc5e04d Mon Sep 17 00:00:00 2001 From: xTr4pSystem Date: Mon, 21 Nov 2022 22:20:30 +0200 Subject: [PATCH 3/3] fix(readme): fix formatting --- README.md | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 8c7dc4e..2310ca9 100644 --- a/README.md +++ b/README.md @@ -9,12 +9,11 @@ PULL REQUESTS WELCOME! It would be mega awesome if you could help in any way (especially with language addition/curation). **How to add a new language:** - 1. Make a folder in webapp/data/languages/ with the language code (e.g. en, de, fr, qya, etc.) -2. Add a list of 5-letter words and call it {lang_code}\_5words.txt - 1. (Optional) Add a language_config.json file - 2. (Optional) Add a keyboard configuration - 3. (Optional) Add a list of supplemental words (useful to have this for weird/rare words, and only have 'common' words in the main 5words.txt file) +2. Add a list of 5-letter words and call it {lang_code}_5words.txt + 1. (Optional) Add a language_config.json file + 2. (Optional) Add a keyboard configuration + 3. (Optional) Add a list of supplemental words (useful to have this for weird/rare words, and only have 'common' words in the main 5words.txt file) Voilà! @@ -25,21 +24,22 @@ If you want to test out your changes, you can run the server locally. 1. Install Python 3 2. Install requirements - `pip3 install -r requirements.txt` +```pip3 install -r requirements.txt``` 3. Run web server locally - `gunicorn --chdir webapp app:app` +```gunicorn --chdir webapp app:app``` 4. Navigate to [http://127.0.0.1:8000/](http://127.0.0.1:8000/) -# Using docker +## Using docker for deployment 1. Make sure you have docker installed. -2. Run docker build . -t wordle -3. Run docker run -d -p 8000:8000 wordle +2. Run +```docker build . -t wordle``` +3. Run +```docker run -d -p 8000:8000 wordle``` ## TODOs - - [ ] take into account browser bar height on mobile - [ ] curate wordlists for existing languages - [ ] add keyboard layouts for existing languages @@ -47,20 +47,17 @@ If you want to test out your changes, you can run the server locally. - [ ] fully translate game interface (missing score streaks and options) Potential improvements: - - [ ] nice animations for revealing letters & such - [ ] make a 4, 6, 7 letter version - [ ] deal with accents & character modifiers better (e.g. french is horrible right now) Nice to haves: - - [ ] improve code quality (e.g. make variable names consistent, code more reusable & less hacky) - [ ] properly integrate TailwindCSS and Vue.js (i.e. not from CDN) - [ ] tests... ## Status of Languages - -``` +``` - Hebrew (he): 🟨 (64540 words) - Serbian (sr): 🟨 (17968 words) - Central Kurdish (ckb): 🟩 (14819 words) @@ -130,7 +127,6 @@ Nice to haves: ![](scripts/out/n_words.png) ## Credits: - - Josh Wardle (original Wordle creator) - NYT (presumably holds the copyright or some IP rights or something with their $$$ purchase) - Elizabeth S (inventor of the Wordle grid) @@ -139,7 +135,6 @@ Nice to haves: - [Wordles of the World](https://gitlab.com/rwmpelstilzchen/wordles) for a community-sourced list of wordle-derivatives (it's impressive how many actually exist) ## Data sources - - https://www.nytimes.com/games/wordle/index.html - english word list - https://kaino.kotus.fi/sanat/nykysuomi/ - Finnish word list - https://github.com/wooorm/dictionaries - most other word lists ([Titus Wormer](https://wooorm.com/) is an incredible dude)