Skip to content

Instantly share code, notes, and snippets.

@krummja
Created March 9, 2023 14:29
Show Gist options
  • Save krummja/0a65995daa23f7403a30ad6b88cceb42 to your computer and use it in GitHub Desktop.
Save krummja/0a65995daa23f7403a30ad6b88cceb42 to your computer and use it in GitHub Desktop.
Script to execute poetry pyproject.toml to requirements.txt for Heroku deployment
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