Package: auto-pypi-uploader
Auto Pip ExporterTable of ContentsIntroductionUsesRunning from Command LineRunning with Command Line ArgumentsImporting as a ModuleInstalling with pipcreate_setup()set_login()pypi_upload()RunningDependenciesSetting Up .env FileRunningQuality AssuranceSuggestionsContributingLicenseIntroductionWhile working on my previous project:text-excuse-generator, I just published my first package toPyPi. I quickly realized that I wasn't going to be able to remember the command line arguments to pass into the required fields, and that I was bound to forget to change the version manually in thesetup.pyfile every time I updated the package. So I decided to make a program that would automatically update the version number in thesetup.pyfile and export a project toPyPi. I also added another script that would automatically create asetup.pyfile for me with the required fields.UsesThere are three main ways to interact with the program: byrunning it in the command line, byrunning it with command line arguments, or byimporting itinto another python file.In order for this program to run, your project's directory must be set up as such:
Any files and directories in[ ]'s are optional,but highly recommended!!!project_root_dir/
    pypi_uploader.py (can be downloaded from auto_pypi_uploader/ or substituted with a program that imports the module)
    setup.py (can be created with pypi_uploader.py or setup_file_creator.py)
    [README.md] (can also be in docs/)
    [LICENSE]

    main_module_name/
            __init__.py
            (other python files...)

    [docs/]
            [README.md]You can also have multiple modules in the same directory, or even multiple modules within a module, but you will need to add the__init__.pyfile to each directory that contains a module. e.g.project_root_dir/
    pypi_uploader.py (can be downloaded from auto_pypi_uploader/ or substituted with a program that imports the module)
    setup.py (can be created with pypi_uploader.py or setup_file_creator.py)
    [README.md] (can also be in docs/)
    [LICENSE]

    main_module_name/
            __init__.py
            (other python files...)
            main_submodule_name/
                    __init__.py
                    (other python files...)

    secondary_module_name/
            __init__.py
            (other python files...)

    [docs/]
            [README.md]Running from Command LineI'd recommend downloadingpypi_uploader.pyfromincludeinto a project'sroot directoryif you want the functionality of the whole module, or justsetup_file_creator.pyif you only want to make asetup.pyfile. You can run the program by typing:python3pypi_uploader.pyWhen you run the program normally, it will first check if asetup.pyfile exists in the current directory. If it doesn't, it will then runsetup_file_creator.create_setup(), which will ask you for:The Project's NameThe Project's VersionThe Project's AuthorThe Project's DescriptionAnd ask you if you want to add these optional fields:The Project's LicenseThe Project's Long Description Type (FromREADME.md)The Project's URLThe Required PackagesKeywordsClassifiersMinimum Python VersionIf you just want to create asetup.pyfile, run:python3setup_file_creator.pyIf asetup.pyfile already exists,pypi_uploader.pywill then ask you for a new version number, and update it insetup.py. It will then upload the package toPyPi. If you haven't already set up your login credentials, it will then ask you for your username and password & save it, and then proceed to upload the package. It then automatically updates/ installs the package withpip3 install --upgrade {project_name}.The program runs:python3 setup.py sdist bdist_wheelandpython3 twine upload dist/* -u "{USERNAME}" -p "{PASSWORD}"to upload the package toPyPi.Running with Command Line ArgumentsYou can also run the program with command line arguments. If you want to send the text message, you can add--sendor-sas the last argument. All command line arguments longer than a single word need to be in parentheses. I'd recommend downloadingpypi_uploader.pyinto a project'sroot directoryif you want all the functionality, or justsetup_file_creator.pyif you only want to make asetup.pyfile, and running them from the command line. Please also include theLICENSEfile in the same directory as any files you add fromthis project.Creating asetup.pyFileIf you want to create asetup.pyfile, run:python3setup_file_creator.py--namePROJECT_NAME--versionVERSION--authorAUTHOR--descriptionDESCRIPTION[--licenseLICENSE][--long_description_content_typeLONG_DESCRIPTION_TYPE][--urlURL][--install_requires"INSTALL_REQUIRES"][--keywords"KEYWORDS"][--classifiers"CLASSIFIERS"][--python_requiresPYTHON_REQUIRES]Any parameters in [ ]'s are optional, and all parameters in " "'s can be a comma separated list: e.g.python3setup_file_creator.py-nauto_pypi_uploader-v"1.0.0"-a"Huck Dirksmeier"-d"A program to automate the creation of the 'setup.py' file, changing a pip package's version, & publishing it to PyPi."-lMIT-ldtext/markdown-uhttps://github.com/Huckdirks/auto-pypi-uploader-i"twine, python-dotenv"-k"PyPi, Pip, setup, setup.py, automation"-c"Programming Language :: Python, License :: OSI Approved :: MIT License, Operating System :: OS Independent"-p">=3.8"UploadingPyPiPackage & Adding Login InformationIf you want to upload a package toPyPi, run:python3pypi_uploader.pyVERSION[--userUSERNAMEPASSWORD]e.g.python3pypi_uploader.py"1.0.0"-uHuckdirksPASSWORDThis assumes that you've already made asetup.pyfile. If you just want to update the version number, runpython3 pypi_uploader.py VERSION. This assumes that you've already set up your login credentials. To just add login credentials, runpython3 pypi_uploader.py --user USERNAME PASSWORD. This will add your username and password to a.envfile in the current directory. If you decide to update the version & login information in a single call,make sure the version is the first argument!YOU ONLY NEED TO ADD YOUR LOGIN INFORMATION ONCE, OTHERWISE IT WILL OVERRIDE THE PREVIOUS LOGIN INFORMATION!!!Importing as a ModuleYou can also import the program as a module into another python file.Installing with pipSimply run:pipinstallauto-pypi-uploaderTheauto_pypi_uploadermodule has  two sub-modules:setup_file_creatorhas one function:create_setup()pypi_uploaderhas two functions:pypi_upload()andset_login()To import the modules into your python file, put this at the top of your file:fromauto_pypi_uploader.pypi_uploaderimport*fromauto_pypi_uploader.setup_file_creatorimport*Or you can import the individual functions.create_setup()takes in:create_setup(NAME:str,VERSION:str,AUTHOR:str,DESCRIPTION:str,help:bool,license:str,long_description_content_type:str,url:str,install_requires:list[str],keywords:list[str],classifiers:list[str],python_requires:str)->boolcreate_setup()returns True if able to generatesetup.pyand False if not.All uppercase parameters are required if parameters are passed in, and each parameter must be defined in the function call. You can also omit all parameters, and the function will prompt you for each one manually.If you want to create asetup.pyfile, call the function like this:create_setup(name="auto_pypi_uploader",version="1.0.0",author="Huck Dirksmeier",description="A program to automate the creation of the 'setup.py' file, changing a pip package's version, & publishing it to PyPi.",license="MIT",long_description_content_type="text/markdown",url="https://github.com/Huckdirks/auto-pypi-uploader",install_requires=["twine","python-dotenv"],keywords=["PyPi","Pip","setup","setup.py","automation"],classifiers=["Programming Language :: Python","License :: OSI Approved :: MIT License","Operating System :: OS Independent"],python_requires=">=3.8")Make sure to put the fields before the variables when calling the function.set_login()takes in:set_login(USERNAME:str,PASSWORD:str)->NoneIf you want to set up your .env file, callset_login()like this:set_login("USERNAME","PASSWORD")If you want user input, just callpypi_upload().pypi_upload()takes in:pypi_upload(VERSION:str,username:str,password:str)->boolpypi_upload()returns True if the package was successfully uploaded, and False if it wasn't.All uppercase parameters are required if parameters are passed in, and each parameter must be defined in the function call. You can also omit all parameters, and the function will prompt you for the version, and the login info if not previously saved.If you want to upload a package & login toPyPi, callpypi_upload()like this:pypi_upload(version="0.0.0",username="USERNAME",password="PASSWORD")RunningDependenciesAccountsYou'll need to create aPyPiaccount. Once you get your account set up, you'll need toset up the.envfilewith this information:UsernamePasswordInstall DependenciesDouble clickdependencies, or runbashdependenciesor./dependenciesin the command line in the root directory to install the python dependencies. You must havepipinstalled to download the new dependencies. Also, you'll need to installpythonyourself if you haven't already.List of DependenciesSetting Up .env FileEither run the program without any arguments to manually input the information for the .env file, run withcommand line argumentsto automatically input the information for the .env file, or pass in the correct parameters to theset_login()orpypi_upload()function.RunningYOU HAVE TO INSTALL THE DEPENDENCIES & SETUP THE.envFILE BEFORE TRYING TO RUN THE PROGRAM!!!If installed with pip, all dependencies should be installed automatically!Runpython3 pypi_uploader.pyorpython3 pypi_uploader.py VERSION [--user USERNAME PASSWORD]in the command line in the source directory.More detailed instructions are in theUsessection.Quality AssuranceAll variable, function, class, module, & file names are written insnake_caseto make sure everything is consistent, and allconstvariables are written in ALL-CAPS. The code is also quite commented and the variable names are quite verbose, so it should be easy enough to understand what's going on.If there are any other/better ways to check for quality assurance, please let me know in thesuggestions!SuggestionsIf you have any suggestions about anything, please create anew discussion in suggestions.ContributingContributions are always welcomed! Look atCONTRIBUTING.mdfor more information.LicenseThe project is available under theMITlicense.