Hi,
At 110 in the python track, my side learnings have brought me to graph theory. I now realise that some programming problems are really fiddley with nested lists, but easier with graph theory. Such as: searching a grid, or testing a grid boundary, or looking at neighbouring cells, or even on an isometric grid. But these are easier with a graph theory tool. I can do some of the problems with import NetworkX as nx
locally and pass the tests, but I did have to pip install NetworkX
. So is this library available on the code testing servers? or is the point of the exercises to learn by doing it the fiddley way? Always checking if you are at a boundary, or have already been in this cell, or if you have counted that neighbour, or don’t count it since it is outside the map/grid?
Thanks
Try it and see? I’m fairly certain you’re mostly limited to the Standard Library but it should be really easy to run an import statement to check if a module is available or not.
The goal is Exercism is to become fluent in the language, not to explore third party packages. Writing your own graph search in Python is good practice, too!
The way to see what’s available:
- navigate to the python-test-runner repo
- look at the Dockerfile
- see that it does
pip install -r requirements.txt
- look at requirements.txt
Python Maintainer here
Currently, we do not support any third-party libraries in our student-facing tooling with the exception of pytest
, pylint
, and their related plugins.
We wouldn’t support NetworkX
even if we did have external libs. It is a difficult library (it takes up a bunch of space and has a ton of dependancies for the full version) that is buggy for several versions of Python we have to support — and its utility for our problem set is quite limited.
As Isaac has said, our primary focus is on fluency in core Python — the modules and code that come pre-packaged when you install the language from the PSF.
@glennj – the only problem with your method is that the requirements.txt
file has dependancies that we don’t support for student code as uploaded to the website. While we use pytest
, pylint
, black
and others in the server, student solution code that explicitly used them would likely fail — although I haven’t tried writing an ad-hock test and uploading it, so it could work? But probably not.
…as I go through documentation and other cleanup tasks here at year-end, I will make a note to annotate requirements.txt
files to that effect (and maybe be clearer in the track docs that we’re “fun free” when it comes to third-party libs).
Thank you so much everyone for such great answers (quick too), Plenty to work with here. (Over the break!)
Joined insiders.
Seasons Greetings.
@clexp On the other hand, assuming that you’re working locally, you could create a solution that uses 3rdparty libraries and upload it knowing it will fail the online tests but self-confident you are passing the tests locally. I have done this with Perl and Lua solutions.