-
-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor main.py #949
Comments
Yeah could probably do with a bit of clean up alright. Are you suggesting 7 files? Not sure I'd go that far. One other thing I'd like to do is remove these out of the top level directory into a |
+1 for a subdirectory to organize the code! Not suggesting each grouping has its own file. |
Are we only talking about reorganizing the code or something beyond that? I have been considering Responder to replace Flask in some of my projects going forward. |
Sky's the limit! So whatever we think is best. Why's it better than Flask? Not averse to moving, but always like a good reason for moving away something that's working fine. Also, as per some goals I suggested for this year if we are doing to take the disruption of moving then I'd prefer to consolidate the tech stack and maybe move more to JavaScript with Node and EJS, rather than a sideways move to another Python based server. Unless of course there's a good reason for it! |
I am not too excited about unnecessarily switching stack, but I mentioned Responder here because it has an elegant API, has built-in testing support with the popular Requests Python HTTP library (the two projects are steered by the same person), RESTful resource classes, API documentation, and an over-all more modern feel to its design is what feels appealing (look at their README). |
I looked at the stated goals and to be honest I would prefer going to the static site route. A lot can be done using data files and Jekyll to cover some gaps. Writing Ruby plugin for Jekyll can help cover some missing parts. After the inception of GH Actions, we do not have to limit ourselves to the Jekyll plugins whitelisted by GitHub Pages. |
For the purposes of this issue, it's narrowly scoped to reorganizing the server code. I think switching platforms is a more serious discussion that needs to be designed/debated during the off-months to ensure that it's not in the critical path of the launch. Let's not consider it blocking for 2020. |
@HTTPArchive/developers anyone with good Python skills fancy tackling this one? |
I can give it a look over the weekend. |
…n code moved to app/ directory, helper functions in separate file, routes in separate files, init file for creating and configuring the Flask app
Hey, I created a PR for that, can you take a look and see if it looks ok? |
* Refactor main.py #949 - code split in few files, all Python code moved to app/ directory, helper functions in separate file, routes in separate files, init file for creating and configuring the Flask app * Moved get_chapter_nextprev function to helpers * Move config.py to app folder * Add new app/config.py file (forgot to include) * Fix linting errors * Just a few naming bikesheds :) * Created errors.py, move everything from main.py, moved Unit tests to sub directory, made talisman and app global for routes and errors * Add Flake8 * Flake8 fixes * Linting errors * Added me as contributor for 2020 * More linting fixes * Linting fixes * Linting fixes * Linting fixes * Linting fixes * Linting fixes * Remove GitHub Action changes * Remove Github workflow changes Co-authored-by: Barry <barry@tunetheweb.com>
The main.py server code has grown in size and complexity and it may make maintenance easier to refactor it into smaller, more discrete files.
Some things that can be grouped:
@bazzadp WDYT?
The text was updated successfully, but these errors were encountered: