Prints infos about the environment and the system. This should help when people make issues containg the printout.
()
| 375 | |
| 376 | |
| 377 | def print_environment_info(): |
| 378 | """ |
| 379 | Prints infos about the environment and the system. |
| 380 | This should help when people make issues containg the printout. |
| 381 | """ |
| 382 | |
| 383 | print("Environment information:") |
| 384 | |
| 385 | # Print OS information |
| 386 | print(f"System: {platform.system()} {platform.release()}") |
| 387 | |
| 388 | # Print poetry package version |
| 389 | try: |
| 390 | print(f"Current Version: {subprocess.check_output(['poetry', 'version'], stderr=subprocess.DEVNULL).decode('ascii').strip()}") |
| 391 | except (subprocess.CalledProcessError, FileNotFoundError): |
| 392 | print("Not using the poetry package") |
| 393 | |
| 394 | # Print commit hash if possible |
| 395 | try: |
| 396 | print(f"Current Commit Hash: {subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], stderr=subprocess.DEVNULL).decode('ascii').strip()}") |
| 397 | except (subprocess.CalledProcessError, FileNotFoundError): |
| 398 | print("No git or repo found") |