Package: deepwordle
deepwordleis a TUI clone of the famous wordle game powered by Python, Deepgram, Textual, Tweepy, and friends.1. Configurations1.1. Tweepy:1.1.1. Twitter Developer Account:Create an account onhttps://developer.twitter.com/, and click onSign UpFill out the required information and submit your request.Once approved, you can continue with the app setup.Note that you need to provide detailed information about your use case for the API in order to speed up the process of reviewing your request.1.1.2. Create an App:Once your request gets approved, you will be prompted to create an app as shown in the image below:Alternatively, you can go to:https://developer.twitter.com/enclick on thedeveloper portalpanel. By doing so, you will be redirected to your dashboard.Navigate to theProjects & Apps–>Overview, Scroll to the bottom of the page and click onCreate App.Choose an app name and clickComplete. By default, the app will be created in read-only mode.Add write permissions to the app in order to be able to publish tweets. Navigate to App Settings and scroll down toUser authentication settings, then clickset up.Toggle theOAuth 1.0abutton and change app permissions toRead and Write.Now your app will get its permissions elevated toRead and Write.Each app is associated with three sets of keys: an API Key, an API Key Secret, and a Bearer Token.1.1.3. Store secrets:You need to store keys and secrets of the app as environment variables in order to authenticate and
publish tweets. To do so, open your terminal, and type the following(change eachXXXXXXXXXXvalue accordingly):exportCONSUMER_KEY="XXXXXXXXXX"exportCONSUMER_SECRET="XXXXXXXXXX"exportACCESS_TOKEN="XXXXXXXXXX-XXXXXXXXXX"exportACCESS_TOKEN_SECRET="XXXXXXXXXX"1.2. Deepgram:1.2.1. Create an API Key:In order to interact with the Deepgram API, you need to grab some keys. To do so, follow along thedeepgram official docsto create anAPI Key.Now, you need to store yourAPI Keyas environment variable in order to authenticate and
transcribe audio data. To do so, open your terminal, and type the following(change theXXXXXXXXXXvalue accordingly):exportDEEPGRAM_API_KEY="XXXXXXXXXX"2. Requirements2.1. Python Interpreter:deepwordlewas tested and built with Python 3.10.1.To install Python 3.10.1, I recommend usingpyenv.gitclonehttps://github.com/pyenv/pyenv~/.pyenvConfigurepyenvon zsh:cat<< EOF >> ~/.zshrc
# pyenv config
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"
EOFOr if you are using the default bash shell, run the following command instead:cat<< EOF >> ~/.bashrc
# pyenv config
export PATH="${HOME}/.pyenv/bin:${PATH}"
export PYENV_ROOT="${HOME}/.pyenv"
eval "$(pyenv init -)"
EOFClose your terminal and open a new shell session. Now, you can installPython3.10.1.pyenvinstall3.10.1Make the interpreter available globally:pyenvglobalsystem3.10.12.2. Virtual Environment:To manage and set up Python 3.10.1 in a virtual environment, I recommend usingpoetry.You can install poetry by running the following command:curl-sSLhttps://install.python-poetry.org|python3-To test if everything was installed correctly, run the following:poetryenvuse3.10.1However, if you are using virtualenv installed via apt, you are most likely to run into
the following:Creatingvirtualenvdeepwordle-dxc671ba-py3.10in~/.cache/pypoetry/virtualenvsModuleNotFoundErrorNomodulenamed'virtualenv.seed.via_app_data'at<frozenimportlib._bootstrap>:973in_find_and_load_unlockedTo resolve this issue, you need to reinstall virtualenv through pip:sudoaptremove--purgepython3-virtualenvvirtualenvpython3-mpipinstall-UvirtualenvHaving virtualenv set up, you can use poetry to create a new project along with a virtual environment:poetrynewdeepwordle&&cddeeepwordleNow, you need to let poetry know which version of python to run:poetryenvuse3.10.1Then, you can create and activate a virtual environment to use for this project:poetryshellNow, at any point in the future, you want to use a virtual environment created by poetry, you can look up
for installed virtual environments under~/.cache/pypoetry/virtualenvs:ls~/.cache/pypoetry/virtualenvsTo activate a virtual environment, run the following:source~/.cache/pypoetry/virtualenvs/<your_virtual_environment_name>/bin/activate2.3. PortAudio:deepwordle depends onPyAudiowhich in turn depends on another library calledportaudio.
To install portaudio on Linux, run the following:sudoapt-getinstallportaudio19-dev3. Installationdeepwordle is currently available for Linux os. There are two main methods you can use to install and run the gameWithpip:python3 -m pip install deepwordleWithpipx:python3 -m pip install --user pipx
pipx install --python python3 deepwordlepipx will install and run deepwordle in your terminal, kind of similar tonpxif you are familiar with it.3. QuickstartHaving deepwordle installed on your machine, you can run it as a CLI from your terminal:deepwordleor you can use poetry to run the game:poetry run deepwordle4. Components OverviewThere are four main textual components that build up this game:rich_text: a module to create customized text with different fonts and sizes.message: a widget to display rich text within a textual panel.letter: a module to build customized buttons with different fonts, sizes, and styles.letters_grid: the main letters grid of the wordle game.5. Game Workflowa- Enter the game by simply typingdeepwordleon your terminal.b- Pressrto record a word for two seconds.c- You will be prompted to either submit the word by pressing enter or remove the letters by pressing backspace.d- Repeat stepsbandcuntil you complete the game.e- If you guessed the secret word, you will be asked to presstto tweet your results.👋 ContributeIf you are looking for a way to contribute to the project, please refer to theGuideline.📝 License:MIT licensed. See the bundledlicencefile for more details.