Refactor SQLiteTLE and modernize codebase: remove .format, drop (object), adopt pathlib, and split SQLite tests#224
Refactor SQLiteTLE and modernize codebase: remove .format, drop (object), adopt pathlib, and split SQLite tests#224JaskRendix wants to merge 1 commit intopytroll:mainfrom
.format, drop (object), adopt pathlib, and split SQLite tests#224Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
==========================================
+ Coverage 90.46% 90.66% +0.20%
==========================================
Files 19 20 +1
Lines 3040 3118 +78
==========================================
+ Hits 2750 2827 +77
- Misses 290 291 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
2a90f06 to
7989b17
Compare
|
I'm wondering on the "modern python" stuff if we should adopt |
|
@djhoese you’re right, if we want pyupgrade‑style checks, we just need to enable the I thought about adding it already, but I didn’t want to mix it into this PR since I have another pending one that touches some of the same areas. I tried to keep this PR focused on cleaning up specific things and class to avoid creating a messy situation. For example, this PR doesn’t remove the |
|
No problem. I'll leave the review of the actual refactoring and functional changes (SQLiteTLE) to the maintainers who have experience with that. |
djhoese
left a comment
There was a problem hiding this comment.
I'm OK with this being merged, but I think my general opinion of the str -> pathlib changes is that they are unnecessary and make some of the code more confusing than clearer. I say that as someone who likes pathlib for new code. There is just a bit too much str -> Path -> str conversion here and I'm worried it will introduce bugs (that aren't tested) or will make future functionality more difficult. For example, Path doesn't play well with custom protocols if I remember right so if in the future TLEs come from S3 and there is an S3 URI like s3://tle-bucket/path/to/tle.txt then converting to Path would not work correctly.
In [2]: str(Path("s3://a/b/c/tle.txt"))
Out[2]: 's3:/a/b/c/tle.txt'Note the single slash. So again, I'm fine with this being merged if other maintainers are as well, but we should be careful about wide sweeping "convert to this other API" style changes.
|
@djhoese I understand the concern regarding Pathlib and potential issues with protocols like S3. Since this refactor introduces unnecessary complexity and risk for future URI support, I will close this PR for now. I'll re-evaluate the changes and may reopen a more focused version later. Apologies for the noise. |
PR updates the SQLiteTLE class and surrounding code to use modern Python features. It removes
.format()string formatting, replacesos.pathwithpathlibwhere appropriate, and drops the old‑style(object)inheritance. The SQLite test suite is moved out of the general TLE tests into a new file focused on SQLite behavior. The refactor keeps behavior unchanged and all existing tests pass.