Prepare Your Work Environment

Before moving on, you need to find the materials associated with this coding challenge. The materials provide a place for you to start, including a preconfigured Python project, a set of acceptance criteria for each task, as well as an automation tool to track your progress and give you feedback. Depending on where you want to continue, you have two choices:

  1. Cloud Environment: Run a container in GitHub Codespaces
  2. Local Computer: Download the materials and work locally

Both have pros and cons, so pick the option that best fits your preferences. You’ll find more information about each approach below.

Cloud Environment

This is by far the quickest and most straightforward way to start solving the challenge. As long as you have a GitHub account and haven’t used up your monthly quota of free hours in GitHub Codespaces, then you can spin up a new cloud environment—or resume where you left off—by clicking the link below:

🚀 Open the Coding Challenge in GitHub Codespaces

This will launch a preconfigured development environment in your web browser tailored to the exercise, which will remain private to you, allowing you to start coding instantly, even on a tablet device! There’s no installation or configuration involved, so you can focus on writing code and solving your tasks.

If you’d like to persist your work by pushing the edited code back to GitHub, then instead of clicking the link provided earlier, make sure to fork the materials repository under your unique GitHub username before proceeding. Afterward, you can use GitHub’s web interface to manually create a new codespace for your repository using the wordcount configuration:

GitHub Codespaces in Forked Materials

The underlying cloud environment runs a web-based version of Visual Studio Code with the necessary Python extensions and a Git client already hooked up, so you can commit your changes as follows:

Shell
$ git add src/wordcount.py
$ git commit -am "Solution for task 1"
$ git push

Remember to fork the repository first, or else you won’t have sufficient permissions, preventing you from pushing local commits or opening a pull request to receive feedback from other community members. That said, you’ll always get automated feedback about your solution.

That’s it! Once the codespace is loaded, you’re ready to start solving the challenge. In the next lesson, you’ll get familiar with the recommended workflow and learn how to use the provided automation tool.

Local Computer

If you opt to work on your local computer instead, then you can download the materials and set up the project locally. This option allows you to use your preferred development environment and tools. Plus, you won’t be limited by the free hour’s quota of GitHub Codespaces.

Use the downloader tool to get the project files, or clone the entire materials repository from GitHub and change your directory to materials/wordcount/:

Shell
$ git clone https://github.com/realpython/materials.git
$ cd materials/wordcount/

Next, install the Python package that came with it, along with its dependencies, using the editable mode. This mode ensures that you can edit the underlying source code without reinstalling the Python package every time you make some changes. Don’t forget to create a virtual environment to isolate the exercise dependencies:

Shell
$ python -m venv venv/
$ source venv/bin/activate
(venv) $ python -m pip install -r requirements.txt -e .

Make sure to include the period at the end of the command! Once your environment is set up, you can open the project in a code editor of your choice and start solving the challenge by following the instructions that will be provided in the next lesson.

What’s Next?

🔧 Continue to the next lesson, where you’ll explore the recommended workflow for solving this challenge.

Become a Member to join the conversation.