Created
March 9, 2023 14:29
-
-
Save krummja/0a65995daa23f7403a30ad6b88cceb42 to your computer and use it in GitHub Desktop.
Script to execute poetry pyproject.toml to requirements.txt for Heroku deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import annotations | |
from beartype.typing import * | |
if TYPE_CHECKING: | |
from subprocess import CompletedProcess | |
import subprocess | |
def run(cmd: str) -> CompletedProcess[bytes]: | |
return subprocess.run( | |
["powershell", "-Command", cmd], | |
capture_output=True, | |
) | |
def main() -> None: | |
command = "poetry export --without-hashes --format=requirements.txt > requirements.txt" | |
completed = run(command) | |
if completed.returncode != 0: | |
print(f"Error occurred: {completed.stderr}") | |
else: | |
print("Completed successfully") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment