I've recently completed a (to a certain version, anyway) project in Python and am looking to get feedback on it.
Problem is that I want feedback on how the project and the different components are organised: the architecture and "structure," not a specific routine. For that to happen, my different files will likely need to be seen. This will amount to a rather large post. (I basically want to leave scope for this topic to be covered, which will not be possible of I post sections of the code; I do also want "normal" review feedback, where people review whatever they are comfortable reviewing).
I'll quote a Reddit post below, where I asked a similar question, so you can get a sense of how big (or how small, depending on your experience) my project is, and what sort of context I'll provide.
To be clear, when posting to not-meta-Code-Review-Stack-Exchange,
- I'll include code directly (not link to GitHub or other website)
- Take care of the character count, and split into two posts if needed
- Follow all other rules.
Would such a post be acceptable? If not, what would you advise me? If I'm expecting too much, that's understandable but I'm unable to figure this out.
Reddit post
TL;DR The following link would take you to a specific commit in the GitHub repo for this project (I won't change this so that any discussion is consistent). Can you please help me review the code in this?
Link: https://github.com/eccentricOrange/npbc/tree/efd5f37b82a42437a9ed0d61d20a8455dce6f0e0
What is this?
This application helps you calculate monthly newspaper bills. The goal is to generate a message that I can paste into WhatsApp and send to my newspaper vendor. The end result here is a CLI tool that will be later used as a back-end to build GUIs (hence learn about: C#, HTML/CSS/JS, Flutter). In its current form, everything will be "compiled" by PyInstaller into one-file stand-alone executables for the end-user using GitHub Actions.
The other important goal was to be a testbed for learning a bunch of new tools: more Python libraries, SQL connectors, GitHub Actions (CI/CD, if I understand correctly), unit tests, CLI libraries, type-hinting, regex. I had earlier built this on a different platform, so I now have a solid idea of how this application is used.
What files exist?
(ignoring conventional ones like
README
andrequirements.txt
)
File Purpose/Description npbc_core.py
Provide the core functionality: the calculation, parsing and validation of user input, interaction with the DB etc. Later on, some functionality from this will be extracted to create server-side code that can service more users, but I have to learn a lot more before getting there. npbc_cli.py
Import functionality from npbc_core.py
and wrap a CLI layer on it usingargparse
. Also provide some additional validation.npbc_updater.py
Provide a utility to update the application on the user's end. test_core.py
Test the functionality of the core file (pytest). This isn't as exhaustive as I'd like, but it did a good job of capturing many of my mistakes. data/schema.sql
Database schema. In my local environment, the data
folder also has a test database file (but I don't want to upload this online).Known problems
- Tests are not exhaustive (please suggest anything you think of).
- Tests are not well commented (working on this right now in a local branch).
- SQL injection is possible in some cases by
--key
CLI parameters, if you can figure out a way to insert a semicolon in an integer. I will remove this in a future version, once I find a way to improve or remove thegenerate_sql_query()
function.- A lot of documentation is tied up in the CLI UI and comments, and is not an explicit document.