.. _students: For students ============ As a student in a *Making With Code* course, you will use ``mwc`` to set up your computer, to download starter code for labs and projects, to submit your work, and to receive updates and feedback from your teacher. Your curriculum contains all the instructions you need, and your teacher will show you how this works. ``mwc`` expects a command as its first argument. Depending on the command, subcommands or arguments may also be expected. If you run ``mwc`` all by itself, you get the program's help message, listing available commands: .. code-block:: text % mwc Usage: mwc [OPTIONS] COMMAND [ARGS]... Command line interface for Making with Code Commands: setup Set up the MWC command line interface submit Submit your work. teach Commands for teachers update Update the MWC work directory version Print MWC version You can add the ``--help`` option to the end of any command to get more information. mwc version ----------- Shows the version of this ``mwc`` you have installed. This is useful to confirm that ``mwc`` installed correctly. Occasionally it's also helpful for debugging problems. .. code-block:: % mwc version MWC 3.1.0 mwc setup --------- .. important:: You will need a MWC account (username and password) to use this command. If you don't have a MWC account, ask your teacher. This command asks you some questions about how you want to set up your computer, then installs required software and configures some settings. After ``mwc setup`` finishes, :ref:`mwc_update` automatically runs. ``mwc setup`` only needs to be run once, but it won't do any harm if you re-run it in the future. (You can re-run setup if you want to change any of the settings.) .. code-block:: % mwc setup Welcome to Making with Code setup. This program will ask you for some settings and make sure all the required software is installed on your computer. Some of the steps may take a while to complete. A few notes: - You can re-run this script if you want to make any changes. - You can quit this program by pressing Control + C at the same time. - Many questions have default values, shown in [brackets]. Press enter to accept the default. - The setup may ask for your password. As a security measure, you won't see any characters when you type it in. - If you get stuck or have any questions, ask a teacher. What is your MWC username?: chris What is your MWC password?: There are a few rarely-used options which can be added to your config file by passing options to ``mwc setup``: * ``--git-name`` The name which should be attached to git commits. Only useful if you already use git for other projects. * ``--git-email`` The email address which should be attached to git commits. Only useful if you already use git for other projects. * ``--mwc-accounts-url`` The URL for your MWC accounts server. Only useful if your school uses a locally-hosted MWC accounts server. .. admonition:: Technical details :collapsible: closed After running ``mwc setup`` your settings are stored in ``~/.mwc``. ``mwc setup`` installs some common programs if they are not already present: * Xcode Command Line Tools (on Macs) * git * tree * Visual Studio Code (if code selected as editor) * ImageMagick * httpie ``mwc setup`` then configures the system by creating ``~/.mwc_rc`` and sourcing it in the shell's main rc file (e.g. ``~/.bash_profile``, ``.zprofile``, etc.) Finally, ``mwc setup`` sets the following global git settings: * core.editor * user.name (customize this with ``git_name`` in the config file, see :ref:`config`) * user.email (customize this with ``git_email`` in the config file, see :ref:`config`) .. _mwc_update: mwc update ---------- Updates each of your labs, problem sets, and projects, and makes sure that the required Python packages are installed for each. If your teacher makes changes or leaves feedback on your work, you will not see it until you run ``mwc update``. .. code-block:: text % mwc update Checking mwc1/unit1/lab_turtle for updates. Already up to date. Checking mwc1/unit1/lab_terminal for updates. Already up to date. Checking mwc1/unit1/lab_names for updates. Already up to date. Checking mwc1/unit1/lab_iteration for updates. Already up to date. ... .. admonition:: Technical details :collapsible: closed Each lab, problem set, and project (collectively called *modules*) is distributed as a git repository. ``mwc update`` iterates through each module in the course (defined by the course's manifest file, for example https://makingwithcode.org/manifest) and: * If the user does not have a corresponding repo on the MWC git server, creates a new repo from the module's template repo. * If the repo is not checked out in the expected location, checks it out. The expected location is the ``work_dir`` setting in the MWC config file, with subdirectories for the course, unit, and module. * If the repo is checked out, pulls any upstream changes from the MWC git server. * Finally, runs ``poetry install`` in each repo, creating a virtual environment and installing the project dependencies. mwc submit ---------- Save your work and send it to the MWC server. This command only works when you are in the project directory for a lab, problem set, project or other MWC module. When you run ``mwc submit``, you will see the changes you have made since your last submission, and will be asked to confirm that these changes look ok. You will then describe what you have changed. Sometimes there is a specific question or reflection prompt. You can--and should--submit each project multiple times, at least once per work session. Some people find it helpful to submit even more frequently, after each chunk of work. .. code-block:: % cd ~/Desktop/mwc1/unit1/lab_iteration % mwc submit ... Here are the current changes. Looks OK? [y/N]: y Write your commit message, then save and exit the window... .. admonition:: Technical details :collapsible: closed ``mwc submit`` is basically just a wrapper around: * ``git add .`` * ``git commit`` * ``git push`` .. _config: Configuration ------------- After you run ``mwc setup``, your MWC settings are saved in a config file in YAML format. By default, the config file is saved at ``~/.mwc``. You can use a different config file by adding the ``--config`` option to any command and specifying the config file's location, or by setting the ``MWC_CONFIG`` environment variable. In most cases there is no reason to do this, but it could be useful if, for example, two students were sharing the same computer. There are a few optional configuration values which can help keep this tool from interfering with other settings on your computer: * ``skip_git_config``: When ``true``, will not apply global git settings. * ``git_name``: Value for the global git setting ``user.name`` (by default, your MWC username is used.) * ``git_email``: Value for the global git setting ``user.email`` (by default, ``nobody@makingwithcode.org`` is used.)