-
-
Notifications
You must be signed in to change notification settings - Fork 120
Missing requirements.txt
and venv
in some Python-based examples
#547
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
That's actually quite a long list of cases that need an update. For the pure python / FEniCS cases the procedure is clear. Regarding the FMI cases some input from @uekerman would be appreciated since I'm not that much into the topic. |
@MakisH suggested to not put the
Instead we can use:
The files/folders marked with a Note: I think this would also apply to the nutils cases and would justify introducing a |
Possibly, yes, but let's keep these as independent PRs. Let's focus on getting |
@MakisH True. #498 is already an exception: The Edit: Or are you only referring to the nutils cases with this comment? |
If there is a common folder (e.g., But with the "let's not open that box", I was referring to Nutils. |
Sounds good. 👍 Then I think we can start implementing 🎉 Already discussed this with @NiklasVin. He will take care of all the necessary updates. |
Only requiring |
For the FEniCS cases I just ran into the the problem that accessing FEniCS from a Using anaconda and the corresponding FEniCS package (see https://fenicsproject.org/download/archive/) should be possible. We also have the fenics adapter and the python bindings on anaconda (see https://anaconda.org/conda-forge/fenicsprecice). But this is again a completely different approach... |
Seems like |
I think |
The easy way out is to keep all solver information in the solver directory including requirements.txt, and use a local venv in the participant directory where the run script is. pip uses a user-local cache for requests even when using a venv, so this shouldn't be too much of an issue. The problem with the current layout is that run scripts are pretty ugly. Example for the oscillator: This needs a subdirectory as it contains multiple files. Single-file packages don't need this extra step.
[project]
name = "oscillator"
version = "0" # we don't care
dependencies = [
"numpy",
"pyprecice~=3.0",
"scipy"
]
# Defining entry points that are available in PATH after installation.
# This is practical for calling them and killing them by name.
[project.scripts]
leftMass = "oscillator.oscillator:runLeft"
rightMass = "oscillator.oscillator:runRight" from . import problemDefinition
from . import timeSteppers
class Participant(Enum):
MASS_LEFT = "Mass-Left"
MASS_RIGHT = "Mass-Right"
def runLeft():
run(Participant.MASS_LEFT.value)
def runRight():
run(Participant.MASS_RIGHT.value)
def run(participant_name):
parser = argparse.ArgumentParser()
# ... |
requirements.txt
and venv
in some Python-based examples
Thanks for the input @fsimonis! Modularizing some of the python-based solvers better would definitely help. I would still suggest to first go for the simple approach and live with a global |
For single-file solvers, creating packages is pretty straight-forward #600 |
A generalization of #190.
Everything Nutils-based is already covered. We need to adapt our FEniCS and all Python-only examples.
The text was updated successfully, but these errors were encountered: