|
| https://realpython.com/ |
| Start Here | https://realpython.com/start-here/ |
|
Learn Python
| https://realpython.com/lessons/python-maze-solver-structure/ |
| Your Learning Plan →Your personalized Python learning plan | https://realpython.com/account/learning-plan/ |
| Python Tutorials →In-depth articles and video courses | https://realpython.com/search?kind=article&kind=course&order=newest&_from=nav_library |
| Learning Paths →Guided study plans for accelerated learning | https://realpython.com/learning-paths/ |
| Quizzes & Exercises →Check your learning progress | https://realpython.com/search?kind=exercise&kind=quiz&_from=nav_library |
| Browse Topics →Focus on a specific area or skill level | https://realpython.com/tutorials/all/ |
| Reference →Concise definitions for common Python terms | https://realpython.com/ref/ |
| Mentor AI →NewYour personal Python mentor | https://realpython.com/mentor/ |
| Office Hours →Live Q&A calls with Python experts | https://realpython.com/office-hours/ |
| Community Chat →Learn with other Pythonistas | https://realpython.com/community/ |
| Live Courses →Live, instructor-led Python courses | https://realpython.com/live/ |
| Books →Round out your knowledge and learn offline | https://realpython.com/products/books/ |
| Podcast →Hear what’s new in the world of Python | https://realpython.com/podcasts/rpp/ |
| Unlock All Content and Become a Python Expert →Get unlimited access to all Real Python has to offer | https://realpython.com/account/join/?from=navbar_learn |
| Unlock All Content →Become a Python Expert | https://realpython.com/account/join/?from=navbar_learn |
|
More
| https://realpython.com/lessons/python-maze-solver-structure/ |
| Learner Stories | https://realpython.com/learner-stories/ |
| Python Newsletter | https://realpython.com/newsletter/ |
| Python Job Board | https://www.pythonjobshq.com |
| Meet the Team | https://realpython.com/team/ |
| Become a Contributor | https://realpython.com/jobs/ |
| Search | https://realpython.com/search |
| https://realpython.com/search |
| Join | https://realpython.com/account/join/ |
| Sign‑In | https://realpython.com/account/login/?intent=navbar&next=%2Flessons%2Fpython-maze-solver-structure%2F |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-maze-solver |
| Unlock This Lesson | https://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-maze-solver |
|
| https://realpython.com/courses/python-maze-solver/#team |
| Mazes in Python: Build, Visualize, Store, and Solve | https://realpython.com/courses/python-maze-solver/ |
| Darren Jones | https://realpython.com/courses/python-maze-solver/#team |
| Recommended Tutorial | https://realpython.com/python-maze-solver/ |
| Course Slides (.pdf) | https://realpython.com/courses/python-maze-solver/downloads/mazes-in-python-slides/ |
| Sample Code (.zip) | https://realpython.com/courses/python-maze-solver/downloads/mazes-in-python-code/ |
| Ask a Question | https://realpython.com/lessons/python-maze-solver-structure/#discussion |
| https://realpython.com/feedback/survey/course/python-maze-solver/liked/?from=lesson-title |
| https://realpython.com/feedback/survey/course/python-maze-solver/disliked/?from=lesson-title |
| Contents | https://realpython.com/lessons/python-maze-solver-structure/#description |
| Transcript | https://realpython.com/lessons/python-maze-solver-structure/#transcript |
| Discussion | https://realpython.com/lessons/python-maze-solver-structure/#discussion |
| Start Managing Multiple Python Versions With pyenv | https://realpython.com/courses/start-with-pyenv/ |
| 00:00 | https://realpython.com/lessons/python-maze-solver-structure/#t=0.88 |
| Scaffold the Project Structure. | https://realpython.com/lessons/python-maze-solver-structure/#t=0.88 |
| The first step is to use your favorite code editor or a cloud-based IDE to create | https://realpython.com/lessons/python-maze-solver-structure/#t=4.74 |
| a new Python project while specifying an isolated virtual environment for the | https://realpython.com/lessons/python-maze-solver-structure/#t=8.72 |
| dependencies needed. | https://realpython.com/lessons/python-maze-solver-structure/#t=12.6 |
| 00:14 | https://realpython.com/lessons/python-maze-solver-structure/#t=14.48 |
| The minimum interpreter version required for this project is Python 3.10 due | https://realpython.com/lessons/python-maze-solver-structure/#t=14.48 |
| to a few syntactic constructs that you’ll be using. | https://realpython.com/lessons/python-maze-solver-structure/#t=18.74 |
| If you can, consider switching to a more recent release for better performance | https://realpython.com/lessons/python-maze-solver-structure/#t=21.8 |
| and other improvements. | https://realpython.com/lessons/python-maze-solver-structure/#t=25.76 |
| 00:29 | https://realpython.com/lessons/python-maze-solver-structure/#t=29.17 |
| If you want to know about managing multiple Python versions on your computer, | https://realpython.com/lessons/python-maze-solver-structure/#t=29.17 |
| then take a look at this Real Python course. | https://realpython.com/lessons/python-maze-solver-structure/#t=32.58 |
| Once you have the project set up in your editor, | https://realpython.com/lessons/python-maze-solver-structure/#t=38.06 |
| scaffold the initial folder structure with these two nested Python packages, | https://realpython.com/lessons/python-maze-solver-structure/#t=40.35 |
| both of which should be empty at this point. | https://realpython.com/lessons/python-maze-solver-structure/#t=44.18 |
| 00:46 | https://realpython.com/lessons/python-maze-solver-structure/#t=46.892 |
| By placing the project’s root | https://realpython.com/lessons/python-maze-solver-structure/#t=46.892 |
| package under the src/ subfolder, | https://realpython.com/lessons/python-maze-solver-structure/#t=48.7 |
| you follow the so-called src layout convention for organizing files in a | https://realpython.com/lessons/python-maze-solver-structure/#t=50.84 |
| project. | https://realpython.com/lessons/python-maze-solver-structure/#t=54.74 |
| 00:55 | https://realpython.com/lessons/python-maze-solver-structure/#t=55.89 |
| Note that the pyproject.toml files should live outside of the src/ | https://realpython.com/lessons/python-maze-solver-structure/#t=55.89 |
| subfolder. | https://realpython.com/lessons/python-maze-solver-structure/#t=59.89 |
| The alternative is a flat layout with all the files in the same folder. | https://realpython.com/lessons/python-maze-solver-structure/#t=62.91 |
| 01:07 | https://realpython.com/lessons/python-maze-solver-structure/#t=67.24 |
| You can read about their differences in the official Python Packaging User | https://realpython.com/lessons/python-maze-solver-structure/#t=67.24 |
| Guide. | https://realpython.com/lessons/python-maze-solver-structure/#t=70.83 |
| In a nutshell, | https://realpython.com/lessons/python-maze-solver-structure/#t=72.166 |
| the src layout is preferred for larger projects because it allows you to better | https://realpython.com/lessons/python-maze-solver-structure/#t=75.17 |
| separate the project code from other files, such as tests. | https://realpython.com/lessons/python-maze-solver-structure/#t=79.39 |
| 01:24 | https://realpython.com/lessons/python-maze-solver-structure/#t=84.88 |
| While the project’s name is maze-solver with a hyphen, | https://realpython.com/lessons/python-maze-solver-structure/#t=84.88 |
| you name the corresponding Python package using an underscore (_) to form a valid | https://realpython.com/lessons/python-maze-solver-structure/#t=88.37 |
| Python identifier, which follows the same rules as variable names. | https://realpython.com/lessons/python-maze-solver-structure/#t=92.19 |
| 01:38 | https://realpython.com/lessons/python-maze-solver-structure/#t=98.75 |
| The rules for naming a Python project, or a distribution package in slightly more | https://realpython.com/lessons/python-maze-solver-structure/#t=98.75 |
| technical terms, are more liberal. | https://realpython.com/lessons/python-maze-solver-structure/#t=102.69 |
| If you’re curious enough, | https://realpython.com/lessons/python-maze-solver-structure/#t=104.578 |
| you can check out PEP 508 to find the regular expression that validates these | https://realpython.com/lessons/python-maze-solver-structure/#t=106.2 |
| names. | https://realpython.com/lessons/python-maze-solver-structure/#t=110.26 |
| 01:53 | https://realpython.com/lessons/python-maze-solver-structure/#t=113.63 |
| To install your project in an active virtual environment, | https://realpython.com/lessons/python-maze-solver-structure/#t=113.63 |
| you’ll need to specify the minimum required configuration in the TOML file. | https://realpython.com/lessons/python-maze-solver-structure/#t=116.27 |
| This will include the name and the version of the project. | https://realpython.com/lessons/python-maze-solver-structure/#t=120.79 |
| 02:05 | https://realpython.com/lessons/python-maze-solver-structure/#t=125.2 |
| Go ahead and open the pyproject.toml file and enter the content seen on- | https://realpython.com/lessons/python-maze-solver-structure/#t=125.2 |
| screen. | https://realpython.com/lessons/python-maze-solver-structure/#t=129.14 |
| This | https://realpython.com/lessons/python-maze-solver-structure/#t=129.903 |
| 02:14 | https://realpython.com/lessons/python-maze-solver-structure/#t=134.94 |
| is a pretty standard configuration and a good starting point for most Python | https://realpython.com/lessons/python-maze-solver-structure/#t=134.94 |
| projects and libraries. | https://realpython.com/lessons/python-maze-solver-structure/#t=138.7 |
| Note that you don’t have to explicitly state the folder layout you are using | https://realpython.com/lessons/python-maze-solver-structure/#t=140.86 |
| because build tools such as setuptools will automatically find the Python | https://realpython.com/lessons/python-maze-solver-structure/#t=144.22 |
| source code. | https://realpython.com/lessons/python-maze-solver-structure/#t=148.13 |
| 02:28 | https://realpython.com/lessons/python-maze-solver-structure/#t=148.994 |
| If you’re planning to publish your package on PyPI, | https://realpython.com/lessons/python-maze-solver-structure/#t=148.994 |
| then you should pick a globally unique name that won’t conflict with an existing | https://realpython.com/lessons/python-maze-solver-structure/#t=152.72 |
| Python distribution package. | https://realpython.com/lessons/python-maze-solver-structure/#t=156.93 |
| 02:38 | https://realpython.com/lessons/python-maze-solver-structure/#t=158.771 |
| Other than this, | https://realpython.com/lessons/python-maze-solver-structure/#t=158.771 |
| you have a fair amount of freedom in choosing your project name. | https://realpython.com/lessons/python-maze-solver-structure/#t=160.11 |
| 02:46 | https://realpython.com/lessons/python-maze-solver-structure/#t=166.72 |
| It’s good practice to work in a Python virtual environment when you’re working | https://realpython.com/lessons/python-maze-solver-structure/#t=166.72 |
| with third-party packages or installing your own. | https://realpython.com/lessons/python-maze-solver-structure/#t=169.69 |
| So, on-screen you’ll see one being created on macOS with the commands that will | https://realpython.com/lessons/python-maze-solver-structure/#t=173.04 |
| also work on Linux. | https://realpython.com/lessons/python-maze-solver-structure/#t=176.42 |
| 03:08 | https://realpython.com/lessons/python-maze-solver-structure/#t=188.44 |
| And here are the commands needed when working on Windows. | https://realpython.com/lessons/python-maze-solver-structure/#t=188.44 |
| 03:24 | https://realpython.com/lessons/python-maze-solver-structure/#t=204.63 |
| After you’ve saved your changes in the pyproject.toml file, | https://realpython.com/lessons/python-maze-solver-structure/#t=204.63 |
| you can install maze-solver with pip by running the command seen on-screen from | https://realpython.com/lessons/python-maze-solver-structure/#t=207.68 |
| the root directory of the project. | https://realpython.com/lessons/python-maze-solver-structure/#t=211.74 |
| 03:38 | https://realpython.com/lessons/python-maze-solver-structure/#t=218.55 |
| During the development of a src-layout project, | https://realpython.com/lessons/python-maze-solver-structure/#t=218.55 |
| it’s advisable to use the --editable flag or its -e alias | https://realpython.com/lessons/python-maze-solver-structure/#t=220.8 |
| to ensure that any changes you make to your code are immediately reflected in | https://realpython.com/lessons/python-maze-solver-structure/#t=224.13 |
| the virtual environment. | https://realpython.com/lessons/python-maze-solver-structure/#t=227.97 |
| 03:49 | https://realpython.com/lessons/python-maze-solver-structure/#t=229.456 |
| Otherwise, | https://realpython.com/lessons/python-maze-solver-structure/#t=229.456 |
| you’d need to manually reinstall the package each time you edit the code. | https://realpython.com/lessons/python-maze-solver-structure/#t=230.11 |
| If you run into an error about not being able to install the directory in | https://realpython.com/lessons/python-maze-solver-structure/#t=236.7 |
| editable mode due to a missing setup.py or setup.cfg file, | https://realpython.com/lessons/python-maze-solver-structure/#t=239.84 |
| then you may need to upgrade pip itself. | https://realpython.com/lessons/python-maze-solver-structure/#t=244.11 |
| 04:17 | https://realpython.com/lessons/python-maze-solver-structure/#t=257.5 |
| To confirm that you’ve successfully installed the maze_solver package in your | https://realpython.com/lessons/python-maze-solver-structure/#t=257.5 |
| virtual environment, open up your REPL and try importing the package. | https://realpython.com/lessons/python-maze-solver-structure/#t=260.96 |
| 04:28 | https://realpython.com/lessons/python-maze-solver-structure/#t=268.04 |
| If everything works fine, | https://realpython.com/lessons/python-maze-solver-structure/#t=268.04 |
| then you shouldn’t see any output or error messages after running this line of | https://realpython.com/lessons/python-maze-solver-structure/#t=269.21 |
| code. | https://realpython.com/lessons/python-maze-solver-structure/#t=273.06 |
| Otherwise, you’ll immediately get a ModuleNotFoundError. | https://realpython.com/lessons/python-maze-solver-structure/#t=273.384 |
| 04:40 | https://realpython.com/lessons/python-maze-solver-structure/#t=280.92 |
| With the scaffolded Python project in place, | https://realpython.com/lessons/python-maze-solver-structure/#t=280.92 |
| you can now proceed to coding an object-oriented representation of the maze, | https://realpython.com/lessons/python-maze-solver-structure/#t=283.27 |
| and that’s what you’ll be doing next. | https://realpython.com/lessons/python-maze-solver-structure/#t=287.19 |
| Become a Member | https://realpython.com/account/join/ |
| https://realpython.com/videos/python-maze-solver-groundwork/ |
| Overview | https://realpython.com/courses/python-maze-solver/ |
| https://realpython.com/lessons/represent-maze-with-objects/ |
|
Mazes in Python: Build and Visualize 02:47
| https://realpython.com/videos/python-maze-solver-part-1-overview/ |
|
Check Out What You'll Make 02:39
| https://realpython.com/videos/python-maze-solver-project/ |
|
Lay the Groundwork 04:02
| https://realpython.com/videos/python-maze-solver-groundwork/ |
|
Scaffold the Project Structure 04:50
| https://realpython.com/lessons/python-maze-solver-structure/ |
|
Represent the Maze With Objects 06:37
| https://realpython.com/lessons/represent-maze-with-objects/ |
|
Create Border Patterns 06:32
| https://realpython.com/lessons/python-maze-border-patterns/ |
|
Model the Square 02:25
| https://realpython.com/lessons/model-python-maze-square/ |
|
Build the Maze 09:07
| https://realpython.com/lessons/build-python-maze/ |
|
Visualize the Maze With SVG 04:45
| https://realpython.com/lessons/python-maze-svg/ |
|
Implement Geometric Primitives 04:48
| https://realpython.com/lessons/python-maze-geometric-primitives/ |
|
Add More Primitives 03:47
| https://realpython.com/lessons/python-maze-more-primitives/ |
|
Decompose the Border Into Primitives 04:41
| https://realpython.com/lessons/decompose-python-maze-border/ |
|
Add More Border Patterns 03:58
| https://realpython.com/lessons/python-maze-more-border-patterns/ |
|
Build the SVG Renderer 03:49
| https://realpython.com/lessons/python-maze-svg-renderer/ |
|
Add Features to the Renderer 06:50
| https://realpython.com/lessons/python-maze-renderer-features/ |
|
Draw the Solution 03:13
| https://realpython.com/lessons/draw-python-maze-solution/ |
|
Preview the Rendered Maze and Its Solution 04:56
| https://realpython.com/lessons/preview-python-maze/ |
|
Mazes in Python: Build and Visualize (Recap) 01:14
| https://realpython.com/lessons/python-maze-solver-part-1-summary/ |
|
Mazes in Python: Store and Solve 01:48
| https://realpython.com/videos/python-maze-solver-part-2-overview/ |
|
Load the Maze From a Binary File 04:55
| https://realpython.com/videos/python-maze-binary-file/ |
|
Choose Your Data Alignment 05:09
| https://realpython.com/videos/python-maze-data-alignment/ |
|
Define the File Header and Body 08:12
| https://realpython.com/lessons/python-maze-file-header-and-body/ |
|
Serialize the Maze 05:22
| https://realpython.com/lessons/serialize-python-maze/ |
|
Deserialize the Maze 04:32
| https://realpython.com/lessons/deserialize-python-maze/ |
|
Make the Maze Self-Contained 04:30
| https://realpython.com/lessons/python-self-contained-maze/ |
|
Update the Maze Class 03:16
| https://realpython.com/lessons/python-maze-class/ |
|
Solve the Maze Using a Graph-Based Approach 03:01
| https://realpython.com/lessons/solve-python-maze-graph-based/ |
|
Transform the Maze Into a Graph 07:06
| https://realpython.com/lessons/transform-python-maze-graph/ |
|
Find the Shortest Path 05:23
| https://realpython.com/lessons/python-maze-shortest-path/ |
|
Add Weights to Graph Edges 02:36
| https://realpython.com/lessons/python-map-weights-graph-edges/ |
|
Introduce Enemies and Rewards 06:04
| https://realpython.com/lessons/python-maze-enemies-rewards/ |
|
Make a Runnable Script 03:59
| https://realpython.com/lessons/python-maze-runnable-script/ |
|
Mazes in Python: Store and Solve (Recap) 01:23
| https://realpython.com/lessons/python-maze-solver-part-2-summary/ |
| Privacy Policy | https://realpython.com/privacy-policy/ |
Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover