Python project ideas

trent shipley trent.shipley at gmail.com
Fri Dec 30 13:37:28 MST 2022


Python UTF8 Treeview Project Feedback Request

I want to move beyond classroom assignments and Exercism.org toy exercises
and start work on my own project.  A major motivation is to have something
to show if I make it to an interview for a software curation and writing
job.

This kind of view of a file tree is everywhere in Python documentation.  It
would seem there is a utility, but I haven't been able to find it.

/home/user/Projects/flask-tutorial
├── flaskr/
│   ├── __init__.py
│   ├── db.py
│   ├── schema.sql
│   ├── auth.py
│   ├── blog.py
│   ├── templates/
│   │   ├── base.html
│   │   ├── auth/
│   │   │   ├── login.html
│   │   │   └── register.html
│   │   └── blog/
│   │       ├── create.html
│   │       ├── index.html
│   │       └── update.html
│   └── static/
│       └── style.css
├── tests/
│   ├── conftest.py
│   ├── data.sql
│   ├── test_factory.py
│   ├── test_db.py
│   ├── test_auth.py
│   └── test_blog.py
├── venv/
├── setup.py
└── MANIFEST.in

(https://flask.palletsprojects.com/en/2.2.x/tutorial/layout/  retrieved
2022-12-16)

What I have discovered is that writing your own program to make this kind
of ASCII representation of a file tree is a classic classroom assignment.
You write a simple general tree, you do recursion, you have to get the
output just right. It's not a bad little class assignment for a data
structures and algorithms second semester.

So I'm thinking I can put the ASCII tree classroom assignment on steroids
and gold plate it.

It would be nice to do a general implementation in C++, Rust, or Java, but
I'm spending a lot of time in Python at work. Since Python is pretty
friendly, I can probably produce a Python version with less effort than in
other languages. It might turn out to be a useful utility run from the
Python command or as a library, and it would then serve as a prototype for
an attempt in a more rigorous and generally applicable language.

*LAYERS*

The project will have Python CLI and library interfaces.  For example, it
might take a parameters such as start=top-left or start=top-center

Working from the output layer down, we have the layer which formats and
emits the file system as a pretty-printed UTF8 file.  By way of gold
plating, the program could have front ends which pretty-print in HTML,
LibreOffice Writer, and PDF.  Although it looks like ASCII representations
of file trees can be generated on the fly with a lexically ordered
depth-first traversal of the tree, there could be a tree structure and a
tree builder.  Then a tree formatter gets the populated tree collection or
data structure.  It walks the intermediate tree using a canned algorithm
provided as a parameter, the links/edges in the tree represent the tree's
structure, and the tree's nodes have default string representations which
will be printed as the nodes of the ASCII graphic.


*THE MISSING PYTHON LIBRARY*


The back of the library should be a utility which provides a general tree
data structure as a container or collection and functions providing
depth-first and breadth-first algorithms to traverse the tree.  I thought
there would certainly be a mature, robust, definitive library wrapping
optimized, long-used C implementations of the top 25 data structures and
their associated algorithms integrated into the Python ecosystem.  What I
managed to find was one recent library, implemented in Python with few
tests and little documentation (alltrees 1.2.4
https://pypi.org/search/?q=alltrees&o=  accessed 2022-12-16).  I didn't
find anything with specialized implementations of things like singly linked
lists or stacks which can be emulated by under-using Python's built-in
dictionaries, lists, sets, and tuples.

If there really isn't much in PyPI providing pure implementations of
classic data structures, then one could fill that space first by creating a
library of (inefficient) pure Python implementations of the desired data
structure containers, and then complementing the Python implementation with
a library providing wrappers around well-proven open-source implementations
of data structures written in C, and tooling the integration well enough
that using the resulting Python packages members provide idiomatic Python
syntax.  The data structure collections, while more specialized than
dictionaries, lists, sets, and tuples, would probably be reasonably useful
for hard-core Pythonistas. It's actually a much better project than the
walk-and-pretty-print-a-tree project I started out with.  Unfortunately,
The only C I even had was learned kind of in passing when I took one
semester of C++ in 1999, and except for sometimes reading a code snippet, I
haven't used it since.


I'm soliciting thoughts, feedback, and comments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20221230/35255b6f/attachment.htm>


More information about the PLUG-discuss mailing list