Skip to content

Contains the python figures and problems from chapter 7 of Computer Systems, 6th Edition

License

Notifications You must be signed in to change notification settings

Matthew-McRaven/cs6e-py-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Important Python Concepts

Generator Expressions

__methods__

Type hints

Configuring your Development Environment

This project assumes you use PyCharm Community Edition 2024.1 or higher.

Experienced python developers will be able to interact with this project entirely through a well-configured terminal.

Install Python

We require python 3.12 or higher for this project. See Python's installation instructions for the best way to get python on your platform.

Install UV

We use uv to manage our third-party python dependencies. The linked documentation includes one-time installation instructions.

Initializing a Python Instance

The following documentation from PyCharm walks through the details of adding a new python interpreter/runtime to PyCharm. During this process, we will notify PyCharm of the location of our python binary, and our package manager, uv.

Here's a video of me adding a python interpreter instance to PyCharm.

After setting up the project's interpreter, open up the IDE's terminal and execute uv sync to download all dependencies. Failure to run this command will cause future terminal commands to fail.

Helpful Terminal Commands

Task Command
Install dependencies uv sync
Execute unit tests pytest .
Format python code black .
Verify type correctness mypy .

Adding Terminal Commands as Runnable IDE Tasks

We cannot easily ship IDE configuration files, meaning users will need to add run configurations on their own.

Here's a video of me adding a configuration which runs our unit tests.

In summary:

  • Select the combo box in the top right next to the "run" and "debug" options, and select Edit Configurations...
  • Add a new Python configuration
  • Change from the type combo bow from script to module
  • From the terminal commands table above, copy the first space-separated word into the module field
  • Copy all remaining text from the command column into the script parameters field
  • Set the working directory field to $ContentRoot$, either by typing it in or using the Insert Macros... button

Enable Auto-Formatting on Save

  • In PyCharm's settings, search for "Actions on save". It will be nested under the "Tools" heading
  • Select "Run Black"
    • If there is a warning icon next to "Run Black", select the "configure..." option and
    • Set the interpreter field
    • Check "On code reformat" and "On save"

Now, any time you trigger a save through the IDE, the file will be reformatted appropriately.

About

Contains the python figures and problems from chapter 7 of Computer Systems, 6th Edition

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages