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

types.py makes local debugging difficult #602

Open
mshafer-NI opened this issue Jun 20, 2024 · 2 comments
Open

types.py makes local debugging difficult #602

mshafer-NI opened this issue Jun 20, 2024 · 2 comments

Comments

@mshafer-NI
Copy link
Collaborator

When attempting to run a single script, the cwd (which is vscode will be the folder of the script) is considered for imports first. This causes Python to import ./types when expecting to import stdlib types (https://docs.python.org/3/library/types.html).

This violates [O.2.1] ❌ DO NOT Redefine or “shadow” declarations

@bkeryan
Copy link
Collaborator

bkeryan commented Jun 20, 2024

@mshafer-NI Does this affect users of nidaqmx-python or does it only affect developers working on nidaqmx-python? For users, the current directory should be outside the nidaqmx package.

nidaqmx/types.py has been there since the beginning: https://github.com/ni/nidaqmx-python/blob/0.5.2/nidaqmx/types.py . Renaming nidaqmx.types to something else would break compatibility. If this affects users, would it be acceptable to rename the submodule to _types.py and alias it in nidaqmx/__init__.py?

import _types as types

__all__ = [..., "types"]

@mshafer-NI
Copy link
Collaborator Author

It only affects developers (as clients are not expected to be working IN the library folder).

import _types as types

__all__ = [..., "types"]

This is a good solution

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

No branches or pull requests

2 participants