Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def parse_args(args: list) -> Optional[argparse.Namespace]:
parser = argparse.ArgumentParser(description=inspect.cleandoc('''lala'''))
# Global arguments (there is also an automatically added '-h, --help' option)
parser.add_argument('--version', action='version', version=f"stm32pio v{stm32pio.app.__version__}")
parser.add_argument('-d', '--directory', dest='path', default=str(pathlib.Path.cwd()),
help="path to the project (current directory, if not given, but any other option should be specified then)")
parser.add_argument('-b', '--board', dest='board', default='', help="PlatformIO name of the board")
return parser.parse_args(args) if len(args) else None
To upload to PyPI:
$ python3 -m twine upload dist/*
"""
import setuptools
import stm32pio.app
with open('README.md', 'r') as readme:
long_description = readme.read()
setuptools.setup(
name='stm32pio',
version=stm32pio.app.__version__,
author='ussserrr',
author_email='andrei4.2008@gmail.com',
description="Small cross-platform Python app that can create and update PlatformIO projects from STM32CubeMX .ioc "
"files. It uses STM32CubeMX to generate a HAL-framework-based code and alongside creates PlatformIO "
"project with compatible parameters to stick them both together",
long_description=long_description,
long_description_content_type='text/markdown',
url="https://github.com/ussserrr/stm32pio",
packages=setuptools.find_packages(
exclude=[
'tests'
]
),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3 :: Only",
for index in range(settings.beginReadArray('projects')):
settings.setArrayIndex(index)
restored_projects_paths.append(settings.value('path'))
settings.endArray()
settings.endGroup()
engine = QQmlApplicationEngine(parent=app)
qmlRegisterType(ProjectListItem, 'ProjectListItem', 1, 0, 'ProjectListItem')
qmlRegisterType(Settings, 'Settings', 1, 0, 'Settings')
projects_model = ProjectsList(parent=engine)
boards_model = QStringListModel(parent=engine)
engine.rootContext().setContextProperty('appVersion', stm32pio.app.__version__)
engine.rootContext().setContextProperty('Logging', stm32pio.util.logging_levels)
engine.rootContext().setContextProperty('projectsModel', projects_model)
engine.rootContext().setContextProperty('boardsModel', boards_model)
engine.rootContext().setContextProperty('appSettings', settings)
engine.load(QUrl.fromLocalFile(str(MODULE_PATH.joinpath('main.qml'))))
main_window = engine.rootObjects()[0]
# Getting PlatformIO boards can take a long time when the PlatformIO cache is outdated but it is important to have
# them before the projects list is restored, so we start a dedicated loading thread. We actually can add other
# start-up operations here if there will be a need to. Use the same Worker class to spawn the thread at the pool
def loading():
boards = ['None'] + stm32pio.util.get_platformio_boards('platformio')
boards_model.setStringList(boards)