8000 Restructure and modernize by heevasti · Pull Request #137 · EUDAT-B2HANDLE/PYHANDLE · GitHub
[go: up one dir, main page]

Skip to content

Restructure and modernize - #137

Open
heevasti wants to merge 9 commits into
EUDAT-B2HANDLE:develfrom
heevasti:restructure-and-modernize
Open

heevasti wants to merge 9 commits into
EUDAT-B2HANDLE:develfrom
heevasti:restructure-and-modernize

Conversation

@heevasti
@heevasti heevasti commented Oct 21, 2026 •
Copy link
Copy Markdown

The whole PYHANDLE project has be updated and upgraded for to work with Python versions 3.11-3.15. The project framework now uses the more modern pyproject.toml definition, and the testing has been separated from the pyhandle package to be independent tests module, not to be included in release packages. The Github workflows have been updated to do the testing based on Astral's uv, ruff and ty packages for dependency managing, formatting and linting, and typing, respectively.

Also the release workflow was updated, but cannot be tested with the fork.

The code itself has been also updated such that no separate logical cases for Python versions < 3.11 are present. Some path-related issues that could arise when running on Windows were fixed. The linting, formatting and typing have been done to satisfy the newer standards on these, using PEP8 as basis.

All major work was carried out with Claude Opus 5.5 medium settings. Some smaller manual edits and changes were done here and there.

themiszamani and others added 8 commits November 26, 2024 15:57
…nized code could look like. First pass without looking for real upgrades later than py 3.13 and still keeping 3.9 in.
…ter checks. Bump the supported versions up from 3.9-3.13 to 3.11-3.15. Did automated fixes with Ruff to formatting and linting.
…unused imports. Fixing a pathutils bug which causes an error on Windows machines. Removed "star" imports where possible and used explicit imports. Fixed the rest of the `ty` and `ruff`` issues. Removal of duplicate tests and other code, and fixing of typos and `None` check and assertion errors.
…nd remove all code related to versions check with Python 2 and <Python 3.11.
@agelostsal
agelostsal self-requested a review November 19, 2026 21:32
@agelostsal
agelostsal commented Nov 19, 2026 •
Copy link
Copy Markdown
Collaborator

Hello @heevasti, thanks for the massive upgrade.

The changes look good!

I found one thing I'd like to settle before merge, plus a question about how the DB client is used.

DBHandleClient.generate_and_register_handle now returns None and drops checksum

pyhandle/client/dbhandleclient.py, around line 369:

handle = self.generate_PID_name(prefix)                                                                      
handle = self.register_handle(handle, location, overwrite=True, **extratypes)                                
return handle                                                                                                

register_handle in the DB client doesn't return anything, so this method returns None and the caller
never learns the generated PID. checksum is accepted but no longer used.

Before this PR (on devel), the same method raised immediately, because checksum was passed positionally
into the overwrite slot as well as overwrite=True:

TypeError: DBHandleClient.register_handle() got multiple values for argument 'overwrite'        

Does anyone actually use the db path for the client?

@heevasti
Copy link
Copy Markdown
Author

Hello @heevasti, thanks for the massive upgrade.

The changes look good!

I found one thing I'd like to settle before merge, plus a question about how the DB client is used.

DBHandleClient.generate_and_register_handle now returns None and drops checksum

pyhandle/client/dbhandleclient.py, around line 369:

handle = self.generate_PID_name(prefix)
handle = self.register_handle(handle, location, overwrite=True, **extratypes)
return handle
register_handle in the DB client doesn't return anything, so this method returns None and the caller never learns the generated PID. checksum is accepted but no longer used.

Before this PR (on devel), the same method raised immediately, because checksum was passed positionally into the overwrite slot as well as overwrite=True:

TypeError: DBHandleClient.register_handle() got multiple values for argument 'overwrite'        

Does anyone actually use the db path for the client?

Thanks Angelos! I don't know if someone would like to use the DB client. I did not consider user-cases when deploying Claude for the upgrade. It surely wasn't used before as it was raising an exception, and potential users did not seem to consider it important issue enough for creating an issue ticket about it. You can consider deprecating the DB client option, or just leave it for now and see if people will start using it.

What happened with the code editing is likely to be the following: When ty was used for type checking, it noticed the signature of the register_handle did not match the call handle = self.register_handle(handle, location, checksum, overwrite=True, **extratypes). So, Claude corrected it, deciding the checksum input was the unnecessary input, and removed it. This seemed the right correction, as the checksum is not used anywhere in the method. The REST handle client does use it, but even there it is optional. The DB handle client has some "TODO"s so perhaps it was just never implemented in the end. Implementing a use for the checksum would keep the register_handle call uniform with the REST client from outside, or it could simply be ignored.

In either case, I think the call should be without expecting a return value (simply self.register_handle(handle, location, overwrite=True, **extratypes)) so that we don't overwrite the handle value obtained in the previous line with None.

….register_handle` call in `DBHandleClient.generate_and_register_handle(...)` as it overwrites the `handle` value with `None`.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0