Skip to content
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

Initialise environment from global Python variables #989

Merged
merged 7 commits into from
Oct 30, 2024

Conversation

jesper-friis
Copy link
Collaborator

Description

Alternative to PR #988 for fixing issue #978.

This PR allows Python application to configure dlite via global variables.

Global variables in (the __main__ module of) Python that starts with "DLITE_" will be set as environment variables seen by dlite.

Hence, starting your application as

DLITE_BEHAVIOR=ON python ./app.py

has the same effect as setting DLITE_BEHAVIOR="ON" before importing dlite in app.py.

Type of change

  • Bug fix & code cleanup
  • New feature
  • Documentation update
  • Test update

Checklist for the reviewer

This checklist should be used as a help for the reviewer.

  • Is the change limited to one issue?
  • Does this PR close the issue?
  • Is the code easy to read and understand?
  • Do all new feature have an accompanying new test?
  • Has the documentation been updated as necessary?

@francescalb
Copy link
Collaborator

So do I understand correctly that with this change the warnings on bhaviour changes is remvoed by default when using dlite-validate? Can it be added if the users wants to? It would be good to write two sentences about this in the tools documentation (on dlite-validate)

@jesper-friis
Copy link
Collaborator Author

So do I understand correctly that with this change the warnings on bhaviour changes is remvoed by default when using dlite-validate? Can it be added if the users wants to? It would be good to write two sentences about this in the tools documentation (on dlite-validate)

Yes, the behavior warning is now removed in dlite-validate. It is possible to add a separate or extend the --debug option to turn on behavior warnings. In that case we have to process the options before importing dlite. Would you prefer that?

@francescalb
Copy link
Collaborator

So do I understand correctly that with this change the warnings on bhaviour changes is remvoed by default when using dlite-validate? Can it be added if the users wants to? It would be good to write two sentences about this in the tools documentation (on dlite-validate)

Yes, the behavior warning is now removed in dlite-validate. It is possible to add a separate or extend the --debug option to turn on behavior warnings. In that case we have to process the options before importing dlite. Would you prefer that?

I am not sure we need it. but if it easy do add witht he debug option it might be a good idea.

@jesper-friis
Copy link
Collaborator Author

So do I understand correctly that with this change the warnings on bhaviour changes is remvoed by default when using dlite-validate? Can it be added if the users wants to? It would be good to write two sentences about this in the tools documentation (on dlite-validate)

Yes, the behavior warning is now removed in dlite-validate. It is possible to add a separate or extend the --debug option to turn on behavior warnings. In that case we have to process the options before importing dlite. Would you prefer that?

I am not sure we need it. but if it easy do add witht he debug option it might be a good idea.

Done. Also made sure that needed cmake configurations are available in dlite-pyembed.c

@jesper-friis jesper-friis enabled auto-merge (squash) October 30, 2024 16:23
@jesper-friis jesper-friis merged commit dde498f into master Oct 30, 2024
14 checks passed
@jesper-friis jesper-friis deleted the 978-init-env-from-globals branch October 30, 2024 16:25
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.

dlite-validate output confusing information
2 participants