Package: piglatinTeam7
Python Package ExerciseA little exercise to create a Python package, build it, test it, distribute it, and use it. Seeinstructionsfor details.Group membersMaaz AhmedHillary DavisWuji CaoAnkit JainFunctions in our packageOur Pig Latin Translation Rules:Our rules for pig latin are as follows: take away the first letter of a word, then add a new word that uses the first letter of the word with "ay" added to it e.g., hello becomes ello-hay. For words that start with a vowel, you add "ay" to the end of the word e.g., enter becomes enter-ay, for words that start with a consonant, all letters are removed until a vowel is reached and then all removed consonants are used to create a second word, with "ay" added to the end of it e.g., happy becomes appy-haytoEnglish(string s):This functiontakes pig Latin words as input. These words must be hyphenated at the end with their pig latin translation/addition in order for our system to be able to process them properly. As a result it returnsthe english translationto the user.toPl(string s, boolean intermediate_output_flag = True):This function takesan english wordas input and returns this word inour pig latin translationof it. In the case of an intermediate flag set to True (as is default) it will return the word in its hyphenated format. Otherwise it will return the word without hyphenation.process_input(string s, boolean translation_flag):Function that takes in aan input string and a flag corresponding to the type of translationand returns aparsed usable list, depending on the type of translation needed. Also prints useful output for debugging / running.When we call this function, we can make sure that it returns a non-empty list by checking the len().speech_bubble(string message):arguments:one argument, messagereturns:a string that is essentially ASCII art, with the message enclosed in a speech bubblearrow_to_bubble():no argumentsreturns:a string that represents ASCII art, pointing to the speech bubbleprint_pig():no_argumentsreturns:a string that represents ASCII art of a pigprint_everything(message):arguments:one argument, messagereturns:a string that represents ASCII art, with a speech bubble enclosing the message, a pig and an arrow pointing from the pig to the speech bubbleWe believe that the functions most useful to potential users are (with their use shown in theexample file)toEnglishtoPLspeech_bubbleprint_pigprint_everythingPYPIHow to install and use our packageCreate a pipenv-managed virtual environment and install the latest version of your package installed：https://test.pypi.org/project/piglatin/1.0.3/(Note that if you've previously created a pipenv virtual environment in the same directory, you may have to delete the old one first. Find out where it is located with the pipenv --venv command.)Activate the virtual environment: pipenv shell.Create a Python program file that imports your package and uses it, e.g. from piglatin import pig and then print(pig.toPL("Hello World")).Run the program: python3 my_program_filename.py.Exit the virtual environment: exit.How to contribute in this packageClone the repoInstall pipenv, build, and twine if not already installed.Add settings in pyproject.toml suitable for a setuptools-based build and add metadata fields to this file (our package do not requires any additional package apart from pytest for testing)Include your code in src/piglatin/pig.pyBuild the project by running python -m build from the same directory where the pyproject.toml file is located.Verify that the built .tar archive has the files you expect your package to have (including any important non-code files) by running the command: tar --list -f dist/piglatin-1.0.1.tar.gz, where piglatin-1.0.1 is replaced the new version.Create an account on TestPyPI where one can upload to a test repository instead of the production PyPI repo.Create a new API token on TestPyPI with the "Scope" set to “Entire account”. Save a copy of the token somewhere safe.Upload your package to the TestPyPI repository using twine, e.g. twine upload -r testpypi dist/*twine will output the URL of your package on the PyPI website - load that URL in your web browser to see your packaged publishedEvery time you change the code in your package, you will need to rebuild and reupload it to PyPI. You will need to build from a clean slate and update the version number to achieve this:delete the autogenerated dist directorydelete the autogenerated src/*.egg-info directoryupdate the version number in pyproject.toml and anywhere else it is mentioned (do a find/replace)build the package again with python -m buildupload the package again with twine upload -r testpypi dist/*Repeat as many times as necessary until the package works as expected. Once complete, upload to the real PyPI instead of the TestPyPI repository.