Skip to content

Proposing add_formal_parameter function #221

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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LauLauThom
Copy link

Following yesterday's call, here is a small PR proposing the addition of a function to facilitate the definition of FormalParameters in a workflow crate.

It makes use of type hints, which is available from python 3.5, support could be added for earlier version by adding the typing package to the list of dependencies, checking the version of python to only install if needed.

I am happy to write tests and documentation for this function if you think that's a valid addition.
Currently it can be tested with

from rocrate.rocrate import ROCrate
from pprint import pprint

crate = ROCrate()
formal_parameter = crate.add_formal_parameter(identifier = "my_param",
                                              additionalType = "Text",
                                              name = "my_param",
                                              description = "",
                                              valueRequired = False,
                                              defaultValue = "")
pprint(formal_parameter.as_jsonld())

Actually for testing I typically install the package in editable mode like so
pip install -e .
but I got an exception that it's not possible

DEPRECATION: Legacy editable install of rocrate==0.13.0 from file:///Users/thomasl/Documents/repos/ro-crate-py (setup.py develop) is deprecated. pip 25.1 will enforce this behaviour change. A possible replacement is to add a pyproject.toml or enable --use-pep517, and use setuptools >= 64. If the resulting installation is not behaving as expected, try using --config-settings editable_mode=compat. Please consult the setuptools documentation for more information. Discussion can be found at https://github.com/pypa/pip/issues/11457

So I was wondering how you test it usually.
I also had issues with test discovery, but that's maybe something with my VScode config.

Cheers !

@LauLauThom LauLauThom marked this pull request as draft April 25, 2025 09:51
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.

1 participant