Not a blog Making the world a better place, one commit at a time

Lute v3 progress

Some important basics are in place: basic tech stack (Python, Flask, Flask-wtf), database setup and migrations, basic project structure, code linting and initial tests. Lots still to do.

What’s visible

Currently, running lute v3 with python main.py starts the web server, and the initial Lute page is shown. You can add and edit Languages. That’s it, and even that will have issues. But it is a start of the user-facing site.

Porting v2

Lute v2 has decent automated tests in place exercising much of the code, so I’m gradually porting those tests from v2 to v3 and implementing enough to make those tests pass.

I’m tracking the work to do in the v2 repo. The tests in the v2 repository have been commented with // V3-port: TODO, e.g.:

# in tests/src/Repository/TermRepository_Test.php
public function test_change_parent()  // V3-port: TODO

composer dev:portstats gets the comments and stats:

tests/LoadTestData_Test.php:    public function test_clear_dev_data(): void {  // V3-port: TODO
[... etc etc ...]
--------------------------------
      14
     278

So there are 14 tests ported, 278 left. The ported number is higher, I haven’t updated the comments for work already done.

Architectural differences

Lute v3 code isn’t a one-to-one transfer from v2:

  • Sqlalchemy is not Doctrine, Flask is not Symfony, and pytest is not phpunit, so obvious changes are needed.
  • Lute v2 uses Symfony which is rather opinionated on how code should be structured. Flask is more flexible, so I’m organizing the code differently, trying to group things conceptually.
  • v3 follows Python naming conventions, e.g. snake_case for variables and methods, as opposed to CamelCase for PHP.
  • v3 doesn’t use all of the getXxx() and setXxx() methods for classes, instead using @properties, or just making class members public.

With all that said, I’ve had pretty good luck translating huge swaths of code from PHP to an initial Python draft using ChatGPT, and then going back and forth between pylint and the tests until things seem to work.