-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Given that many have Anaconda and Windows, best to only use allowed when it's easy to install.
- Loading branch information
1 parent
24ac36b
commit e49edef
Showing
3 changed files
with
36 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,33 @@ | ||
## Quick Guide for M269 | ||
|
||
First, make sure you have Python 3.10 or 3.11. | ||
If you intend to later install further software in order to check the method calls of your code, | ||
you need 3.10 rather than 3.11. | ||
The following explains how to install and use `allowed`, a tool that checks if | ||
your TMA code only uses the Python constructs mentioned in Chapters 10, 20 and 28. | ||
The tool is merely a convenience compared to visually inspecting your code. | ||
|
||
1. Open a terminal and type `python3 -V`. | ||
2. If your Python version is 3.9 or lower, | ||
install 3.10 or 3.11 from [https://python.org](https://www.python.org/downloads/). | ||
(You don't need to uninstall your current Python.) | ||
1. Open a terminal. Enter `python -V` to obtain your Python version. | ||
|
||
Next, install the `allowed` tool: | ||
If it is 3.9 or lower, then you can't use `allowed`, sorry. | ||
While you can have multiple Python versions on your system, | ||
it's not worth the hassle and potential problems at this point in M269. | ||
|
||
3. Click on one of the download buttons above. | ||
4. Go to your downloads folder and extract the files from the downloaded archive. | ||
Next, if you have Python 3.10 or later, install the `allowed` tool: | ||
|
||
2. Click the 'Download .zip' button above. | ||
3. Go to your downloads folder and extract the files from the downloaded archive. | ||
(Your web browser may have done it automatically.) | ||
5. Move the files `allowed.py` and `m269.json` from the `allowed-main` folder | ||
4. Move the files `allowed.py` and `m269.json` from the | ||
`dsa-ou-allowed-main-24ac36b` folder (the last 7 characters may vary) | ||
to the folder with your M269 materials. | ||
|
||
To use the tool: | ||
|
||
6. Open a terminal and go to the folder where you put both files. | ||
To use the tool, open a terminal and go to the folder where you put both files: | ||
|
||
- To check the first TMA, type `python allowed.py -u 10 path/to/TMA01.ipynb`, | ||
5. To check the first TMA, type `python allowed.py -u 10 path/to/TMA01.ipynb`, | ||
e.g. `python allowed.py -u 10 TMA01/22J-TMA01-STUDENT.ipynb` or similar. | ||
(On Windows, use backslashes.) | ||
- To check the second TMA, type `python allowed.py -u 20 path/to/TMA02.ipynb`. | ||
- To check the third TMA, type `python allowed.py path/to/TMA03.ipynb`. | ||
6. To check the second TMA, type `python allowed.py -u 20 path/to/TMA02.ipynb`. | ||
7. To check the third TMA, type `python allowed.py path/to/TMA03.ipynb`. | ||
|
||
These checks won't detect if you're calling methods that haven't been taught, | ||
like `count()` on lists. | ||
To check methods calls you need Python 3.10 and do the following: | ||
|
||
7. If you're on Windows, install [WSL](https://learn.microsoft.com/en-us/windows/wsl). | ||
8. In a terminal, type `pip install pytype` to install the necessary type checker. | ||
9. Add `-m` when checking a TMA, e.g. `python allowed.py -m -u 10 path/to/TMA01.ipynb`. | ||
It's possible for `allowed` to check method calls, | ||
but it would require installing Linux on Windows. Again, not worth the trouble. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters