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

Enhance module imports in NEST Server #2632

Merged
merged 18 commits into from
Jul 31, 2023
Merged

Conversation

babsey
Copy link
Contributor

@babsey babsey commented Mar 13, 2023

This PR converts environment variable NEST_SERVER_MODULES:
NEST_SERVER_MODULES="nest,numpy as np,random from numpy"
to formatted dictionary for updating globals:
{'nest': <module 'nest'> 'np': <module 'numpy'>, 'random': <module 'numpy.random'>}

Test it on your computer

In Bash:

export NEST_SERVER_MODULES="nest,numpy as np,random from numpy"

In Python:

import nest
modules = nest.server.hl_api_server.get_modules_from_env()
globals().update(modules)
print(globals())

@babsey babsey requested a review from jougs March 13, 2023 08:11
pynest/nest/server/hl_api_server.py Outdated Show resolved Hide resolved
pynest/nest/server/hl_api_server.py Outdated Show resolved Hide resolved
pynest/nest/server/hl_api_server.py Outdated Show resolved Hide resolved
@jougs jougs requested a review from Helveg March 14, 2023 14:37
@jougs jougs added T: Enhancement New functionality, model or documentation S: Normal Handle this with default priority I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) labels Mar 14, 2023
@jougs jougs added this to In progress in PyNEST via automation Mar 14, 2023
Co-authored-by: Jochen Martin Eppler <jougs@gmx.net>
Copy link
Contributor

@jougs jougs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There seems to be some formatting issues with the new code. I'm still approving.

@github-actions
Copy link

Pull request automatically marked stale!

@github-actions github-actions bot added the stale Automatic marker for inactivity, please have another look here label May 14, 2023
@babsey babsey changed the base branch from master to 3.5-develop June 26, 2023 07:44
@babsey babsey changed the base branch from 3.5-develop to master June 26, 2023 07:44
@babsey
Copy link
Contributor Author

babsey commented Jun 26, 2023

The test failed because of NEST CI / black.
I do not understand the reason of the error.

Please clarify.

@babsey babsey requested a review from jougs June 26, 2023 07:52
@github-actions github-actions bot removed the stale Automatic marker for inactivity, please have another look here label Jun 26, 2023
@Helveg
Copy link
Contributor

Helveg commented Jun 29, 2023

The NEST CI / black is a Python source code formatting check. Please install and apply black, or install the autoformatting pre-commit hook, as outlined here

Copy link
Contributor

@jougs jougs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where my previous approval went, but I'm still happy.

@jougs
Copy link
Contributor

jougs commented Jul 3, 2023

@Helveg: can you please have a look? Thanks!

Copy link
Contributor

@Helveg Helveg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@babsey what do you think about using the stdlib AST for this parsing task?

pynest/nest/server/hl_api_server.py Outdated Show resolved Hide resolved
babsey and others added 2 commits July 12, 2023 11:10
Co-authored-by: Robin De Schepper <robin.deschepper93@gmail.com>
@babsey
Copy link
Contributor Author

babsey commented Jul 12, 2023

It looks fine. Please review! 😄

@Helveg Helveg merged commit e8932d7 into nest:master Jul 31, 2023
20 checks passed
PyNEST automation moved this from In progress to Done Jul 31, 2023
@babsey babsey deleted the server-import-modules branch July 31, 2023 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I: No breaking change Previously written code will work as before, no one should note anything changing (aside the fix) S: Normal Handle this with default priority T: Enhancement New functionality, model or documentation
Projects
PyNEST
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants