fair-workflows / nanopub

Python client for searching, publishing and modifying nanopublications.
https://fair-workflows.github.io/nanopub
Apache License 2.0
22 stars 7 forks source link

Major update to the nanopub API, adding signing in python, removing java dependency #156

Closed vemonet closed 1 year ago

vemonet commented 2 years ago

Hi everyone (and in particular @raar1, @tkuhn and @svenvanderburg), following some issues with how the nanopub library was handling users profile (cf. https://github.com/fair-workflows/nanopub/issues/150) I went through rewriting some parts to make loading profiles and publishing nanopubs more flexible. On the way I also implemented signing and publishing nanopubs directly in python by reusing the trustyuri-python codebase, so it does not require to have java installed

I brought a few changes to how nanopubs are handled, so that will probably be better to publish it as a new major version v2 to make it clear it will most probably break code written previously (at least all the publishing part).

Here is an overview of the changes made:

Documentation

You can see the updated doc website here: https://vemonet.github.io/nanopub after the merge it will be under https://fair-workflows.github.io/nanopub

Most changes mentioned here have been documented so feel free to check it out and try it!

Profile and config

Signing and Nanopub class

Signing is now done in python, removing the dependency on java!

CLI

The setup_nanopub_profile CLI was changed to a new CLI with multiple actions:

Full documentation here

I also now use Typer instead of click, which is basically a wrapper around click to make use of type annotations, and avoid repeating the types in the click decorator and the function args

Tests and logs

You can see a successful test run here: https://github.com/vemonet/nanopub/actions/workflows/build.yml

Project metadata and development setup

Feel free to check it out and let me know if you have any comments on the new API, what is not working as expected, and how it could be improved

Otherwise, do you know which libraries are using the nanopub python package? To check if they need to fix their requirements to ask for <2 or update their code with the new nanopub version (and rdflib 6 if not done already). I know only about the fairworkflows lib, I already updated our service to use this new version of nanopub

tkuhn commented 1 year ago

Thanks for this fantastic work, @vemonet!

raar1 commented 1 year ago

This is really great work, @vemonet

raar1 commented 1 year ago

@vemonet For fixing the failing build docs task, I would try either removing the git pull line that is generating the error or (if it really is needed) perhaps adding something like the following would help:

uses: actions/checkout@v3
with:
  ref: ${{ github.ref_name }}

(I think that would set the current branch to e.g. the PR branch.)

But with the checkout action do we really need the git pull in the first place?

vemonet commented 1 year ago

@raar1 Indeed we can remove the git pull part, I added it at the start because I encountered a conflict, but with the new workflow architecture it is not needed anymore

Thanks for all the feedbacks! I made all the changes in the next commit

raar1 commented 1 year ago

Hi @vemonet, is everything essentially ready to be merged now? I see that the docs build is failing but I wonder if that is just because we are merging a fork that does not have the right permissions to make the site on the nanopub repo (or something like that? I'm not sure).

If everything else is ready to go then we can try merging into main, and see if that helps to fix the docs build

vemonet commented 1 year ago

Hi @raar1 , I am quite confident that the docs failing is due to permissions. Which is good! GitHub should not let a pull request trigger an update to the official doc without being merged :)

I documented the process to create a new release in the docs btw: https://vemonet.github.io/nanopub/getting-started/development/#publish-a-new-release and I already upgraded the version to 2.0.0 in the code, so you just need to create the release on GitHub

Feel free to change the docs if you prefer a different process

raar1 commented 1 year ago

OK perfect! I will merge now and create a new release :)