Skip to main content

Featured

Building a gRPC Service with Nested Messages, Repeated Fields, and Oneof in Python

Introduction:  gRPC is a high-performance, open-source framework developed by Google for building efficient and scalable distributed systems. It provides a language-agnostic way to define and implement services using Protocol Buffers (protobuf) as the interface definition language. In this tutorial, we'll explore how to build a gRPC service in Python that incorporates advanced features such as nested messages, repeated fields, and oneof. These features allow us to create complex data structures and handle scenarios where multiple values or mutually exclusive fields are involved.   Prerequisites: Basic understanding of gRPC and Protocol Buffers. Python development environment set up.   Step 1: Define the Protocol Buffers (protobuf) File  Start by defining the service and message definitions in a proto file. Here's an example of a proto file named example.proto that defines a gRPC service with nested messages, repeated fields, and oneof: syntax = "proto3" ; package

Git Basic and Push your First Poject to GitHub



Down bellow are basic Git commands to push your first Project folder to github on Windows machine. Project folder means the folder wich contains files, assets, or source code of your works. Let's get started.

 1. Make sure you have Git Bash installed on your computer and run this command:

git --version
git version 2.7.0.windows.2

Now let Git know who you are. This is important for version control systems, as each Git commit uses this information

git config --global user.name "john"
git config --global user.email "john@mail.com"

Change the user name and e-mail address to your own. You will probably also want to use this when registering to GitHub later on.

2. Make sure git is tracking your project locally, using your terminal/command line, get inside the folder where your project files are kept:

cd D:\document\src\myproject 

3. Check if git is already initialized: 

git status

If you get this error message: fatal: Not a git repository (or any of the parent directories): .git, that means the folder you are currently in is not being tracked by git. In that case, initialize git inside your project folder and make your first commit:

git init
git add .
git commit -m
"First release of my Project" 

4. Create a remote, empty folder/repository on Github by login to your Github account. Then At the top right of any Github page, you should see a '+' icon. Click that, then select 'New Repository'.

5. Give your repository a name ideally the same name as your local project. If I'm building a travel application, its folder will be called 'travel-app' on my computer, and 'travel-app' will be the Github repository name as well.

6. Click 'Create Repository'. The next screen you see will be important, so don't close it.

7. The screen you should be seeing now on Github is titled 'Quick setup — if you’ve done this kind of thing before'. Copy the link in the input right beneath the title, it should look something like this: 

https://github.com/yourname/yourproject.git

This is the web address that your local folder will use to push its contents to the remote folder on Github.

8. Go back to your project in the terminal/command line. In your terminal/command line, type:

git remote add origin https://github.com/yourname/yourproject.git

9. Push your branch to Github: 

git branch -M master
git push -u origin master


10. Do your authentification on GitHub via web browser, then go back to the folder/repository screen on Github that you just left, and refresh it. The title 'Quick setup — if you’ve done this kind of thing before' should disappear, and you should see your files there.

11. Done!


Comments