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

Make fabsim a regular Python package #251

Merged
merged 1 commit into from
Dec 5, 2023
Merged

Conversation

matt-graham
Copy link
Collaborator

Part of addressing #250

Makes fabsim directory a regular Python package by adding empty __init__.py files to fabsim directory and subdirectories containing Python modules we wish to be able to import (assumed all excpet bin directory).

As a regular Python package rather than implicit namespace package, fabsim directory will be identified as importable as soon as first encountered on the search path rather than after searching all paths

Creation and loading of a regular package can take place immediately when it is located along the path. With namespace packages, all entries in the path must be scanned before the package is created. (https://peps.python.org/pep-0420/#discussion)

For now I have just left all the __init__.py files empty. These could be used to expose names at the subpackage level (allowing importing names directly from fabsim.base or fabsim.lib for example), but to keep the changes minimal I've not done this here.

@matt-graham
Copy link
Collaborator Author

This change should not require any modifications to code elsewhere in the codebase or plugins. I've tested running FabDummy and FabNESO tasks locally after these changes and both run without any issue.

Copy link
Owner

@djgroen djgroen left a comment

Choose a reason for hiding this comment

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

Fairly straightforward change. Looks all good to me!

@djgroen djgroen merged commit 339674d into master Dec 5, 2023
14 checks passed
@djgroen djgroen deleted the mmg/make-regular-package branch December 5, 2023 09:16
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.

None yet

2 participants