Skip to content

Commit 6e2ddf9

Browse files
committed
New script for developers, aiding in uploading builds to pypi.
1 parent 0284ea2 commit 6e2ddf9

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

devtools/upload_pypi.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import shutil
2+
import subprocess
3+
from pathlib import Path
4+
5+
from setuptools import setup
6+
from twine.commands.upload import upload
7+
8+
# Replace these with your package information
9+
package_name = "Pyttman"
10+
11+
# Get the package version dynamically
12+
# the file location is in a sibling directory, add it to the path
13+
14+
# Upload to PyPI using twine
15+
confirm = input("Deploying to PyPi.\n\n1: For pypi production, type 'production'"
16+
"\n2: For test.pypi.org, type 'test'\n\n")
17+
18+
if not Path("dist").exists():
19+
print("You need to build the package first. Run devtools/build.py.")
20+
exit(0)
21+
22+
print("Enter '__token__' for username, and the token for password")
23+
if confirm == "production":
24+
subprocess.run(["twine", "upload", "dist/*"])
25+
elif confirm == "test":
26+
subprocess.run(["twine", "upload", "--repository-url", "https://test.pypi.org/legacy/", "dist/*"])
27+

0 commit comments

Comments
 (0)