8.5.1.4. pymodaq_utils.plugin_tools.platforms module
Operating systems and processor architectures supported by an instrument plugin.
A plugin that only works on some systems (a Windows driver, a Raspberry Pi board…) declares it in the class of its instrument plugin:
class DAQ_Move_Xxxx(DAQ_Move_base):
supported_platforms = ('win32',) # values of sys.platform: 'win32', 'linux', 'darwin'
supported_architectures = ('aarch64', 'armv7l') # optional, values of platform.machine()
None (the default of the base classes) means all of them. PyMoDAQ then refuses to initialize the plugin on another
system, with a message, and check_plugin reads the declaration to check (and update with --fix-classifiers)
the Operating System classifiers of the pyproject.toml.
Added in version 5.3.5.
- pymodaq_utils.plugin_tools.platforms.classifiers_for(platforms=None)[source]
The
Operating Systemclassifiers of a plugin working on these systems (None: OS independent)
- pymodaq_utils.plugin_tools.platforms.declared_in_class(cls)[source]
(supported_platforms, supported_architectures)written in the body of a plugin class (None if absent or not a literal)
- pymodaq_utils.plugin_tools.platforms.describe(platforms=None, architectures=None)[source]
Text for the user, for instance
Linux (aarch64, armv7l); empty if there is no restriction- Return type:
- pymodaq_utils.plugin_tools.platforms.dynamic_classifiers(pyproject, package_folder)[source]
The classifiers of a plugin whose
classifiersfield is dynamic in thepyproject.toml: those listed in[tool.pymodaq] classifiers(theOperating SystemandProgramming Language :: Python :: 3.xones are ignored) followed by the Python versions accepted byrequires-pythonand the systems computed from thesupported_platformsof its instrument plugins. Used by the hatch metadata hook at build time
- pymodaq_utils.plugin_tools.platforms.invalid_values(platforms, architectures)[source]
Problems of a declaration: unknown system or architecture names, empty lists
- pymodaq_utils.plugin_tools.platforms.normalize_architecture(machine)[source]
Canonical name of an architecture (
arm64->aarch64…), the lowercased input if unknown- Return type:
- pymodaq_utils.plugin_tools.platforms.package_platforms(root)[source]
Systems on which the instruments of a plugin package work (union over the instrument modules), read from the sources.
Noneif at least one instrument works on all of them
- pymodaq_utils.plugin_tools.platforms.platforms_as_rst()[source]
The accepted values as two reStructuredText tables, to be included in the documentation
- Return type:
- pymodaq_utils.plugin_tools.platforms.python_classifiers(requires_python='')[source]
Programming Language :: Python :: 3.xfor each ofPYTHON_VERSIONSaccepted byrequires-python(all of them if empty or invalid)
- pymodaq_utils.plugin_tools.platforms.unsupported_reason(platforms=None, architectures=None, system=None, machine=None)[source]
Why a plugin cannot run on this computer, or an empty string if it can
- Parameters:
platforms (
Optional[Iterable[str]]) – values ofsys.platformthe plugin works on (None: all). A prefix is enough:linuxmatcheslinux2architectures (
Optional[Iterable[str]]) – values ofplatform.machine()the plugin works on (None: all)system (
Optional[str]) – replacesys.platformandplatform.machine(), for testsmachine (
Optional[str]) – replacesys.platformandplatform.machine(), for tests
- Return type:
- pymodaq_utils.plugin_tools.platforms.update_pyproject_classifiers(pyproject, platforms)[source]
Replace the
Operating Systemclassifiers in theclassifierslist of apyproject.toml(a text edit, the rest of the file is kept). Returns True if the file changed- Return type:
- pymodaq_utils.plugin_tools.platforms.windows_only_files(root)[source]
Python files of a plugin package that only the Windows-only instruments use (directly or through the other modules): code that only works on Windows is expected there. All of them if every instrument declares
supported_platforms = ('win32',). Files used by an instrument working elsewhere are never in it- Return type:
- pymodaq_utils.plugin_tools.platforms.ARCHITECTURES = {'aarch64': ('aarch64', 'arm64'), 'armv6l': ('armv6l',), 'armv7l': ('armv7l', 'armv8l'), 'i686': ('i686', 'i386', 'x86'), 'x86_64': ('x86_64', 'amd64')}
values of
platform.machine()(compared without case), with their aliases
- pymodaq_utils.plugin_tools.platforms.PLATFORMS = {'darwin': ('macOS', 'Operating System :: MacOS'), 'linux': ('Linux', 'Operating System :: POSIX :: Linux'), 'win32': ('Windows', 'Operating System :: Microsoft :: Windows')}
values of
sys.platformand the matching name and PyPI classifier
- pymodaq_utils.plugin_tools.platforms.PYTHON_VERSIONS = ('3.10', '3.11', '3.12', '3.13')
Python versions PyMoDAQ is developed for, they give the
Programming Language :: Pythonclassifiers