Skip to content Coding Terminology Pt 2 | CurioCity

Coding Terminology Pt 2

Project Framework Environment

After finishing your project, you might want others to easily download and run your project. However, other users likely won’t have the necessary packages installed. To help them quickly set up the environment, most project frameworks provide a specific file listing all dependencies and an associated installation command (shown in the table below).

Framework/LanguageDependency FileInstallation Command
NextJS (JavaScript)package.jsonnpm install
Pythonrequirements.txtpip install -r requirements.txt

Virtual Environment (Python)

A Python virtual environment is like a separate “sandbox” or isolated workspace on your computer where you can install Python packages without affecting other projects. This ensures that each project has its own specific set of dependencies (software packages).

Why is it important?

  • Avoid conflicts: Different projects may require different versions of the same package.
  • Easy sharing: Others can recreate your exact environment effortlessly.
  • Organization: Helps keep projects tidy and manageable.

In Python, you can set up a virtual environment with the following commands:

ActionmacOS/Linux CommandWindows Command
Create a virtual environmentpython -m venv myenvpython -m venv myenv
Activate the virtual environmentsource myenv/bin/activatemyenv\Scripts\activate
Install packages (e.g., numpy)pip install numpypip install numpy
Deactivate the virtual environmentdeactivatedeactivate
Delete the virtual environment (optional)rm -rf myenvrmdir /s /q myenv (PowerShell)

APIs (Application Programming Interfaces)

Think of an API (Application Programming Interface) like a customer service counter at a restaurant. You (the customer) place an order (input), and after a short wait, the counter hands you your food (output). You don’t need to know what’s happening in the kitchen—how the chefs prepare the food, what ingredients they use, or the exact process. You just make a request and get a result.

how apis work

Just like ordering at a counter, you don’t need to know how the API fetches that data—you just get the info you need!

APIRequest DescriptionExample Request (Code)Example Output
Google Maps APIGet driving directions from SF to Mountain View.fetch('https://maps.googleapis.com/maps/api/directions/json?origin=SF&destination=MV&key=YOUR_API_KEY'){ "distance": "39 miles", "duration": "45 mins" }
OpenAI APIGenerate a summary of a book or topic.openai.chat.completions.create({model:"gpt-3.5-turbo",messages:[{role:"user",content:"Summarize book."}]})"The Fountainhead explores individualism through architect Howard Roark..."
Supabase APIRetrieve specific user information from database.supabase.from('users').select('username,email').eq('id',123){ "id":123, "username":"karena123", "email":"karena@example.com" }
Stripe APICreate a payment intent to charge a customer.stripe.paymentIntents.create({amount:2000,currency:"usd",customer:"cus_456"}){ "id": "pi_1KuXyz...", "amount":2000, "currency":"usd", "status":"succeeded" }

In your projects, you will likely be calling an API from your application. Therefore, it’s good to know at a high-level what an API is and how it works.

References

.ENV File

A .env file is like your secret vault. It stores environment variables, which include configuration settings like API keys and database credentials. This file helps keep sensitive information secure and makes it easier to manage settings across different environments (development, testing, production).

An example .env file might look like:

OPENAI_API_KEY=sk-proj-1234567890
SUPABASE_URL=https://example.com
SUPABASE_KEY=1234567890

Note, those are just example keys and you should not use them in your projects.

Version Control (like Github)

github-commits Version control systems, such as Git, help you track changes to your code and collaborate with others. Github is a popular platform that hosts Git repositories, making it easier to manage and share your projects. A deeper dive into how to use Github is covered in the next section on Github Basics section.