def Upload2Pypi(): '''Recreates distribution & build, updates version on setup.py, pushes upload to Pypi Must be used in the same folder as setup.py''' if os.path.exists(cwd + "\\setup.py"): deleteDirectory(os.path.dirname(sys.argv[0])+'\\build\\') deleteDirectory(os.path.dirname(sys.argv[0])+'\\dist\\') deleteDirectory(os.path.dirname(sys.argv[0])+'\\__pycache__\\') updateSetupVer() if "PYPI_USER" in os.environ and "PYPI_PASS" in os.environ: if "twine" in os.environ: cmd(f'cd {cwd}', 'python setup.py sdist bdist_wheel', # f'twine upload dist/* -u {os.environ["PYPI_USER"]} -p {os.environ["PYPI_PASS"]}') f'{os.environ["twine"]} upload dist/* -u {os.environ["PYPI_USER"]} -p {os.environ["PYPI_PASS"]}') else: cmd(f'cd {cwd}', 'python setup.py sdist bdist_wheel', f'twine upload dist/* -u {os.environ["PYPI_USER"]} -p {os.environ["PYPI_PASS"]}') # f'{os.environ["twine"]} upload dist/* -u {os.environ["PYPI_USER"]} -p {os.environ["PYPI_PASS"]}') else: print("RECOMMENDED: Setup PYPI_USER and PYPI_PASS environment variables.") if "twine" in os.environ: cmd(f'cd {cwd}', 'python setup.py sdist bdist_wheel', # f'twine upload dist/*') f'{os.environ["twine"]} upload dist/*') else: cmd(f'cd {cwd}', 'python setup.py sdist bdist_wheel', f'twine upload dist/*') # f'{os.environ["twine"]} upload dist/*') else: print(f"setup.py not found in {cwd}")
from grtoolkit.PYPI import Upload2Pypi, pypiVersion import time packageName = "grtoolkit" #UPDATE PACKAGE ON PYPI Upload2Pypi() #UPDATE LOCAL PACKAGE TO LATEST VER ON PYPI from grtoolkit.Windows import cmd install_package = f'python -m pip install --upgrade {packageName} --user' cmd(install_package, install_package) #DELETE DIST FILES FOR FOLDER STRUCTURE READABILITY from grtoolkit.Storage import deleteDirectory from grtoolkit import cwd parentFolder = cwd() deleteDirectory(parentFolder + '\\build') deleteDirectory(parentFolder + '\\dist') deleteDirectory(parentFolder + f'\\{packageName}.egg-info')
packageName = "pypi_flow" #UPDATE LOCATE PACKAGE TO LATEST VER ON PYPI from grtoolkit.Windows import cmd uninstall_package = f'pip uninstall {packageName}' cmd(uninstall_package)