Google Cloud Function : Zero to Professional Part 1 : From Scratch | Python | Pycharm | Git | Sdk

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
let's start with python now we are going to install python for windows 64-bit version see here we go we have a list of options i'll choose the direct link first one is release in case if you want to read and if you are already using python for a long time then you can you can get more information from the release the front side stable version right hand side re-release and better to avoid using older windows version windows xp or windows 7 windows 8 avoid those all the ways you can if you are if you are using indoor sound or something like that but better you can upgrade to windows 10 you can see that windows latest version latest python versions not supporting that all the windows wires even for all almost all the python versus um okay so blindly go with the test voice windows 10 in case if you don't have and now i'm going to choose mine it's a 64-bit version [Music] now the download is going to start it may take 30 seconds or one minute based on your bandwidth let's start install now i choosed and i chose everything and here let me change the location you can change based on your convenient uh if you choose first one it's going to affect every user whoever going to use your machine so and i'm going to uncheck i chose environment okay it looks good to me rename to um okay it looks perfect to me i think now i can go ahead with install environment variables everything is fine setup is in progress it may take one minute or two minute the board is moving fast now let's keep patience you can skip in case if you're already done with this python installation if your expertise in this installation maybe you can forward and skip this part but just make sure in case if you already installed all the configuration because that is big hectic if anything if you made any small mistakes during installation later then you need to roll back or uninstall okay it's successful let's verify installation by checking version hmm now it's successful okay now python installation is done let's install pycharm has more oasis windows we can choose directly by this link actually it has two two version i mean not not two person two type of uh by charm one is for open source another one for uh proportional we need to play professional in case if you're if you choose professional you need to pay i'll go with open source community version download is happening let's wait for a few seconds once it's done i mean it's you it's up to you i mean in case if you filmed it with an anaconda version any other ide then you can try with other other versions also i'm film i'm familiar with pycharm so i'm going to to i'm choosing python here sorry pycharm here this default path is clipping i'm going to modify based on based on my convenient okay click next and choose the 64-bit and environment that's these two are very important just make sure the rest all you can ignore click next uh this folder it's fine click next installation is started it will take more time i forwarded little time it's done i'll choose manual reboot okay windows by charm let's run the python okay confirm continue don't send i don't want to send as i'm using for development purpose i'm going to choose the already existing one which i installed just before by clicking this three dot so these are the environment already available in my system i'm going to add the part which i the where i installed um uncheck this button otherwise it will create main dot python main.ppy file every time okay it's looks good uh in case if you're new you can spend some time with this tips i'm going to ignore this is antivirus thing i'm going to ignore this okay setup is happening let's create new file to test python is working or not this is kind of hello world you can give any name i give first program dot py print hello pathway save it let's run this file to the file yes it's working now we verified by charm is working with python okay this looks good now time to install git installing it is super easy in case if you're using linux you can type this sudo command in case if you're using mac os then you can use this brew command and for windows you can use this link which i mentioned otherwise i will don't worry for windows users i will show the demo but you should be very careful in case if you made any change you may wrong option if you choose then you need to you can revert by global config options i mean global config cli commands using this you can change the editor also later all right now time to install git let's go to browser gate download okay don't get dirt link for mac from this also let's go to that main link for from here click the windows it will download automatically through this one you no need to review about the which bit it will take it automatically otherwise if you still think you can go with if you face any issues then you can come back and then you can download the later one but it won't happen click next path you can change in case if you want to just make sure here few few options you can change later few not i ignored first two on desktop icon and the last one for ignoring the touch updates okay this folder next and here you can choose whatever editor you want i'm going to choose the default one vm in case if you want to choose notepad you can choose even later also you can modify using global command um let's get design click next choose the second one but i'm go i'm i want to play with that unix commands more so i'm going to choose the last one you can go with recommended or else you can if you are following me then you can choose the last one click next um i'm going to choose this first one the default one and here here also i'm going to choose first one as i'm using windows and the first one is lightweight so i'm going to choose the first one which is the default one all right here also i'm going to choose the default one second one is duplicated last one is none so first one click next i'm going to choose both and click next i would strongly recommend to uncheck this box experimental hmm it won't take much time it's going to complete okay done all right you can uncheck both i'm just going to see the read for what it gonna say hmm this release notes look like having some changes information all right close this now it's time to set up github you can you can it's like a sign up for some email or it's same for flow only i already have in case if you are new just go and click sign up just going to you need to give your username and email address and it's you need to verify you are not robo and then you will your account is ready as i already have account i'm going to choose sign in and then my username is but okay and then your password let's sign in okay already reposted gcp here even from here you can choose the repository so your this is i create only one repository that is gcp i can check the clone copy from here as i don't have that public config configuration right now so i chose the stp repository where i'm going to keep all the code right click you can choose gui or bash i'm going to choose bash or print working directory i'm going to clone the that repository from github to here see it successfully clone the directory get status okay we are outside that repository that's the reason it's giving fatal error cd millers okay let's type git status now see we are good all right let's open the redmi file this is kind of maintaining index instruction i'm going to write some text just to check how it is working this is started with google cloud repo because it's uh outside the my practice section so i'm going to keep this readme file common for all google cloud stuff so now that gets to this git status is giving that changed text file so this is this one needs to be committed because we made some changes right we added some text that's the reason it's showing in the red color it needs to be staged here now it it's having only the text gcp um now time to add that readme file get add this is stage one how first we need to add the file now check by status gate status see the changes it asks us to do commit now earlier it asks us to do staging i need social color now it asks us to commit git commit do some message what we are going to committing okay good commit dash m oh okay this is a first step we need to do after installation we need to set up our credentials not a credential exactly our user name and the email id using this uh global config we can do it anytime now we have to do then only we can commit i'm going to give email id which i mentioned for github the same email id i'm going to configure as i clone that same github next i'm going to set config yes rename with my name all right it should work now cool now the final step push when you push it will go the it will go to the github grid push origin master hmm fatal fatal error and this time unbelievable what's wrong with this where i am okay i i'm in right path i got it i mentioned master but in my gate it's main okay i should follow same okay got it renamed to main um it's the first time i have to do this confirmation just you need to give the same username password the github which you sign in the same one now it's done now it push the code to github let's go to github refresh see you can see the changes this changes whatever we have done it got updated cool now github get pycharm all installation configurations done now time to see how it works with pycharm let's open pycharm in python we have a terminal through the terminal we can check in check out let's create new project now we are done with the repository instead of us we need to create the project right click new yes um okay i hear from here i need to use i'm going to change the path i'm going to choose the same location where we are configured git inside that jcp folder i'm going to create the project paste and i already chose the existing okay the location was modified existing interpreter already opted looks good to me great you can choose either first one second one this window or new window new i'm choosing this window as this development activities okay now i'm going to create readme file the one which we created let's check git status what it says yeah it's working we are inside that's inside that get repository right the gcp inside gcp repository the project which we created created that is gcp uh gcf okay now we are going to add files inside the project readme file this one is for repository we need to create one for this project this kind of has the help document instruction or index based on your convenient i mean you can utilize this one you can ignore i mean otherwise it will add automatically sometimes it will create mess type anything to recollect easily when you actually seeing the project from gate or after you check out typing something here it has lot of styles also i'm just typing some two lines of instruction now just to test it from through inside how it gets github is i'm able to connect how i'm doing checking checkout by adding ash you can change the size of the character okay it looks good now get started says it's dot for slash which means i need to add this folder also so i can go back i can add otherwise i can add from here also let's go back one step now if i type git status see that's the difference if you are going if this git is really smart you have to simply you can copy and paste and get add this that's the first step get add get space add space whatever you want to add cool now it got added now let's do commit good comment dash m and types some message which is loan to that chicken um right okay now this much files we are going to check in this is created when we created the project inside this folder see look at this one this is not related with our code we can deal with this later now we can focus check in let's push this whatever we committed okay it's done completed come fully let's go the refresh refresh again okay we need to go back it's inside readme file now we are in outside click the project you can see the two files okay click read me okay now inside the project now okay let's go back just we can modify a few just to see just to make sure adding something i mean this is helpful for beginner in case if you if your expert is in github you can skip or for fast forward that may be helpful for you if you feel you are wasting some time here and there for this configuration i'm just trying to cover for the beginner now i'm going to add this file again it add because i modified little and i'm committing by message commit you forget no added okay great push origin main i mean instead of me in case if you are using branch you are going to give branch okay committed successfully now you can see the latest changes we are good okay with the pycharm everything is working perfectly so the basic commands check in check out using pycharm everything is working i need to remove this idea of this folder because this is we know it this one we no need to keep it in good uh okay here this one inside this we have a lot of bunch of this kind of library kind of files i mean this is not relevant to um it's this is not our code right we are going we need to keep our code only in the kit so to remove the folder from remote alone we so that case you need to use git rm command get rm we need to use dash dash cached because we are going to remove from remote only i mean from the github only not not in local we are going to keep the files in local we are removing from gita moly so we executed arm command cached now we need to commit whatever we have done this case i mean we are not adding anything we are just removing from github and a social typing message to saying okay let's push we're going to delete now commit is done okay all right commit is done now we delete the directory from okay logan local everything is fine right you can see it uh tab control tab control tab control tab okay now here let's refresh see it's gone so we deleted from github this is helpful for beginner as this demo is mainly focused for the people who started from beginning but still the file is showing it will confuse in middle even if you mention git add dot it will be risk so i'm creating get ignore file uh let's cancel i will handle myself with the help of git ignore file i'm going to ignore this from saying every time whenever i hit the status with this critique node file you can whatever you want to ignore you can add it over here line by line now if you check git status it's see it's gone now it says new file added git ignore only not the unwanted one so you can remove unwanted one i mean instead of uh doing one by one you can manually focus i mean you can simply add in that kid ignore all right now we come to know one more thing did ignore and how we deleted files from remote alone let's add this whatever changes we made let it get ignored and read me for expertise people please feel free to forward this git section okay adding message commit is now completed let's push the code it's done now okay we are good with pytham configuration with git now time to see pip pip we need to install pip paper is very important people is package manager we are going to install a lot of packages going forward we need to set up environment also virtual environment it's clear okay let's go back we are going to install pip and then virtual environment people i think already installed let's confirm by taking the yes it's already satisfied by this command professionally there let's check the python version you can check python motion by dash v or dash dash version again for uh expertise you can skip and forward feel free feel free to forward this is to check the version on installing for to install the virtual environment for windows we have all the step-by-step information it's available uh it's available in the python website it's just you have to do copy paste it's super easy even after that in case if you don't want you can deactivate using this command my favorite is by inserting through the requirements i mean for uh packages hmm all right it has more information i used to use this one yes i was looking this one so this is super easy like you can keep all the information this file and then use pip install dash or requirements.txt then it will take care installing all the packages for your python okay now first step i'm going to set up visual environment now this is for windows simply going to copy paste vp install user environment all right it didn't take much time warning that's okay i know you can ignore this morning because we are using using the intro different interpreter that's okay and then enrollment for windows now i'm going to create installation is done for virtual reality now i'm going to create the environment environment name is env i'm going to use the same env dash um virtual denver environment space env env is the name i'm giving okay hit it hmm it's creating taking some time ideally it wouldn't yeah it's created okay creation is done now we need to activate the environment we can refresh then it will pop up see that environment is ready once the folder is ready we need to source i mean we need to activate the environment which we created inside the environment we can use different version of python also in case if you want to do some development activities and you can you can if whatever dependency you want you can restrict based on your need inside the virtual environment it will it not going to affect your system let's take this for windows and it's done now you can see left hand side we are inside this environment virtual environment the name is called env the path be verified now clear first packages wheel let's install the wheel is the first step okay wheel installation is completed that's the first step and then we can install a few things like request and other packages which are relevant to our google cloud functions before that let's see the version that is updated for pip i think it's updated one however i just want to confirm okay this is a command hit it okay if you want i can upgrade to this one it's okay i think that is fine okay we'll installation is done and then let's go to find that request yes this is my favorite one requirements using recommend files i'm just going to give one small demo how to use this trek one file it will be there all over the gcp setup if you are a python developer if you are going to be python developer okay the file is ready ah no cancer i'm just going to give just for just to test i'm going to add these two later i will add for other dcp stuff okay i saved controllers now i'm going to install this okay this automatic autofill is not working i need to type manually hmm cool now whatever packages i need whatever i mentioned inside this file so it will take her through this way i think it's almost done scroll up um yes here you can see what are the requirement i needed for my development this is not exactly i need this is from this is just to demo how to install this file okay whatever i mentioned it got installed there's a lot of features like other id like refactor all the stuff you can good you can go through then you will enjoy this ide i would strongly recommend pycharm for google cloud project now next you need to start with google cloud functions school food from functions for local they have the function framework with the help of function framework you can do you can start development even if you don't have google cloud account still you can do it um yeah i think here we go where it is this one right i need to install through the vip all right it's installing all the packages for google cloud functions in local even if i don't have account still it's not issues i can complete the development i mean based on the requirement what kind of what kind of changes now the changes is this is too fun okay i don't want to add this one in the gate let's add in the git ignore i'm going to ignore this too now the list is increased one to two hmm yeah now this looks good okay we are fine now we can check in these two changes okay now we can add these changes like those three steps get add git commit get push that's what you're going to see before that i forgot to see that pip installer for function framework whether it is done properly or not um this is the function this is the interpreter okay here we go let's add our existing the interpreter which which we configured it should be yes it's there see okay the pip installation successful on our virtual environment we are good now we can apply our okay whatever it's fine now we can add these files one by one quick copy paste and similarly remaining those two also again this but also people can skip whoever already expertise in git i just adding all the steps to repeat again i am repeating because of the people who were starting with uh development and who were struggling with git so it will be more be it will be helpful for those folks so other folks can skip this maybe you can do fast forward also no issues commit stan and then i'm going to push this code okay it's done okay after verify in code mean we should not use the main branch when we work in company uh even though it's development but still i want to tell how to switch from master to branch here main two branch the new branch is created and we can't we need to check out the code then only we can that star goes to development which means right now we are in main now after doing check code it will point to now we are in local branch local development underscore match it's not in gate it's created it's created here it's not in gate uh control tab okay refreshed now we can add this once we push then it will be visible in the github okay it's got updated now we can go refresh again you can see some changes happen that commit count see the branch over here we create a branch from local and pushed okay all the changes whatever we made in the main it's available in branch also okay sorry it's clear now time to create google cloud function in local let's create the function directory hello okay directory is directly got created now python file you know no need to mention the same name i mean that method name you can give method name something different also it won't be it won't affect because we are going to deal with that method name directly while deploying this is kind of normal functions some in normal python functions how we define the bracket request meant to mention because the cloud function is going to work it work based on the trigger even basis so whatever trigger happened event happened that event we received through this request only so we are this those parameter through those parameter we are going to achieve our need our requirement we are going to fulfill those based on the input that we are going to process accordingly for testing purpose i'm just you going to use something name yeah let's take this parameter and let's say if i am receiving name as a parameter name in this variable again copy see it's normal if condition first i'm checking whether it is any parameters there or not and name is there or not and then now ascending that name to this variable so this condition if the condition is satisfied then the new name will us into this variable else i'm going to give some dummy name in case if i didn't pass any value then they even trigger because i am planning to use http event tips now i'm going to return the value i'm going to say hello and whatever names whatever name comes i'm going to pass i'm going to return so it will be it will be it will be displaying that the strip strip call okay go inside this directory and then just to make sure function let's check i think i already checked yes it's there okay try function framework okay this is how we are executing in local the target method just copy paste over here hmm something some small mistake yes yes yes ordered oh okay got it colon i missed all right oh okay it looks good now we deployed successfully local you can use if you press ctrl c it will cute so just copy and then paste it over here and what's happening zero zero zero is not taking i think let's try with localhost i think for zero zero it's not taking sometimes it happen in that case you can give localhost um low close should work yes it's working so by default we didn't pass any name over here so one two seven let's try with that it should work with that also yes it's working okay that's cool so on to sound low close both are working now let's pass some parameter by default owners coming okay question mark we should add question mark i mean you can add slash question mark under whatever very name you give yeah it's working pathway hello pathway it's working cool it's working perfectly okay now we need to install postman because through cloud function we will be using other than get post also so we need to have some id like a postman okay just refresh this okay qtc ctrl c is clear and go to browser let's download postman postman is nothing i mean downloading postman installing undone you just hit the download button and then it will download and then just you need to do sign up that also they uh incorporated with the automate way like with along with gmail if you have gmail account and it's not taking much time i think it's going to complete yes it's completed and so now time to install download is completed no time to install hmm cool look it does now it's loading and then it's up now okay i already have account if in case if you don't have account then you need to click the create account this is nothing it's a sign in with your gmail or gmail and in case if you don't have you can give any name it's a normal procedure the same url if i pass here it will it will return the same response whatever response we saw over uh through over the browser i cop meanwhile i'll i prepared uh another statement like i modified to one name to first name last name and then for json also i added this is what we you are seeing now else part i mean entity lift part it's for json request in case if i pass json response how is going to handle this if part is the two old one the line which i highlighted that is for request json in case if i'm receiving json request the debug is uh the debug feature is cool i mean i no need to if i add any changes while running something while testing something i don't need to stop i'll choose okay this is usual it's working i just added two parameter first name last name so this condition now we tested we tested this two condition is working fine between unsymbol i added that's it now without any parameter the last else part you are seeing now that also working we are going to test the last one in case if it is json request in the body we need to pass the json input message through the curly braces first name last name i mean the very variable name is f name and l name i mean f name mean to first name l name into last name that's how i created the rock and last name simply give some wwe hmm it's cool it's working fine now this one from this lift condition so this is how we are we can handle that json request now we tested three different cases i mean json request and by passing two parameter between and symbol without passing parameter all three done okay now add some text and to check that the debug parameter whether it is reflecting or not yes see it's reloading again it's detecting some changes in this file and then it's reloading it's a cool this is a cool feature while developing we don't need to worry about that it's like a spring boot okay let's see here the change is also implemented it's very quick right cool now we need to now our development part is done now time to jump into the cloud google cloud world let's install cloud sdk i already installed but still i just want to let you know for beginners or whoever start who are pitching into google cloud for them i'm just showing for installing cloud sdk is super cool just you need to click the link and then it will download sdk and then if you go to i mean just a simple setup i mean this you can follow even the added screenshot also and you need to say anything under the same link um you when you see google cloud in it the gcloud init even if you read it's like you are going to you need to read and then you need to uh choose the options that's it that's how it it works okay after gcloud init already did setup but still i chose the new configuration just to show for beginners uh start i'm giving my project name the project which i create in google cloud pathway tips and it's creating i choose the second one even though if i already configured i just need to confirm by copying this link paste the link the browser where you configured your google cloud account in this browser i created i already opened that google cloud account so it's verified so that with that cloud account i it got verified now i i want to align with this project on this region so if i choose yes i'm going to choose later i choose no actually this one again i skipped and then i back to if i choose yes what will happen the list is big so i need to choose list because my place is canada canada is north america region i choose 63 to choose north american region it's done so the cloud sdk step is done in my system this config list is just it will list what cloud configuration you are having even you can change the project by saying gcloud config set also it's like the same configuration you are seeing from your google cloud sdk and that python because it will work all the cli i'm going to deploy this on google cloud function the same method i mentioned here deployment super easy so developments completed now the target is python i remember python 37 is the latest version however i will check that target is stp which means i'm using that http api call right so i'm using the distribution let's go to project i just want to make sure the python version what is the latest one which is suggested by google cloud functions go to next here we can see the versions for all the ide sorry all the program for python the stable version is 37.38 so it doesn't matter what version you are using in your local machine any python 3 version that's fine here you can change to three seven or three eight both both are fine oh some small i think us yes i missed i think yes okay let's modify i'm going to choose i'm going to allow every all the incoming by saying yes because for development for now that's okay but however i will show in next video it should be there yes the deployment is happening it will take maybe 30 seconds or one minute not more than that hmm it's still completely maybe we can check the logs how it is the deployment is go how the deployment is going on right click not working okay fine and to choose the logs let's click the latest one um there is no warning so everything is goes fine there is no yellow color or orange color so everything shows blue and green so so far everything is good i think it might completely check the log still showing i think it should completed yes it's done let's go back and check cloud maybe sometimes here you can see in case if you sometimes if you forget or some something which is not visible in the main then you can search in the research box also for example let's refresh cloud function yes it's super cheesy see this is in green channel [Applause] it's saying you can test this api it's version one and this is the api we need to use this is our api so far we used local now this one let's hit the send button cool see it's working with google cloud function now only thing is unauthenticated i mean which means it allows everything all the incoming calls so this is not good but this for development okay i'll explain that also in the next video trigger yes this is the link the same link which we which we're using through postman right that same api we are using same uh this http call we are using post can test other three further functionalities also yeah that json input raw and choose text to json paste and hit it uh okay i got it i should choose instead of get i should i should choose post because i'm passing the input in the body section right so i need to choose post cool post also working so we tested get post both through cloud functions with the cloud function through the trigger event i mean http trigger event this is stp trigger because that stp call this see this is super cool now we tested everything this is this this only thing is that unknown authenticator i will explain the next section the same link you can even we can modify from here also this is a minimal source yes this is source code which we modified let's edit and add something you did next this is this one we can't do anything because we are editing the code only next add some text like 2021 something okay in the end we can add let's deploy the deployment will take that similar time initially how long it takes right i mean the same time it's going to take maybe 30 seconds or one minute which can check the logs like deployment and successful uh the trigger event also so whenever that event happened this trigger happening or not everything we can track over over through the logs even we can check the log from here or else by choosing by choosing i mean by click by newt new tab we can choose the logs choose the cloud functions everything is fine if it is blue and green then which means it's good there is no orange or red orange is for warning red is for error jump to now sorry okay it seems like everything is going good i think deployment should completed yes it's completed let's call again 2013 will come send sometimes it introduce twice i mean but after deployment just it will take some past time we are doing very quickly back to back it's cool wonderful it's working but we can check the log there's 200 the return yes that return status 200 is there all right thanks for watching please share your feedback in the comment section happy learning you
Info
Channel: pathway tips
Views: 14,570
Rating: undefined out of 5
Keywords: #google, #aws, #azure, #cloud, #gcp, #pathwaytips, #functions, gcf, #python, #pycharm, #git, #github, #httptrigger, #event, #GettingStartedWithGCPCloud
Id: Ny-VXiaIx-I
Channel Id: undefined
Length: 71min 58sec (4318 seconds)
Published: Mon Feb 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.