<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Iman</title>
    <description>The latest articles on DEV Community by Iman (@imann_12).</description>
    <link>https://dev.to/imann_12</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3932861%2F50daf84d-73cc-4c5a-86ae-07c626c3a979.png</url>
      <title>DEV Community: Iman</title>
      <link>https://dev.to/imann_12</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/imann_12"/>
    <language>en</language>
    <item>
      <title>Calling Your First API Using Its OpenAPI Spec — A Python Walkthrough</title>
      <dc:creator>Iman</dc:creator>
      <pubDate>Fri, 15 May 2026 10:26:02 +0000</pubDate>
      <link>https://dev.to/imann_12/calling-your-first-api-using-its-openapi-spec-a-python-walkthrough-35hj</link>
      <guid>https://dev.to/imann_12/calling-your-first-api-using-its-openapi-spec-a-python-walkthrough-35hj</guid>
      <description>&lt;p&gt;Every public API comes with documentation. But some APIs go further — they ship an OpenAPI spec. It's a single JSON file that describes every endpoint, every parameter, and every possible response. Read it once and you know exactly how to use the API before writing a single line of code.&lt;br&gt;
Let's do that right now.&lt;/p&gt;

&lt;p&gt;What Is an OpenAPI Spec?&lt;br&gt;
It's a standardized JSON (or YAML) file that describes an API completely. Endpoints, required parameters, response shapes — all in one place. Tools like Swagger UI turn it into interactive documentation, but the raw file is what matters here.&lt;/p&gt;

&lt;p&gt;Step 1 — Get the Spec&lt;br&gt;
We're using the Swagger Petstore. It's a fake pet store API built purely for learning. Open this in your browser:&lt;br&gt;
&lt;a href="https://petstore3.swagger.io/api/v3/openapi.json" rel="noopener noreferrer"&gt;https://petstore3.swagger.io/api/v3/openapi.json&lt;/a&gt;&lt;br&gt;
Save it locally. Don't try to memorize anything — just scan the structure. You'll notice three things that matter:&lt;/p&gt;

&lt;p&gt;paths — all available endpoints&lt;br&gt;
parameters — what each endpoint accepts&lt;br&gt;
responses — what comes back&lt;/p&gt;

&lt;p&gt;That's the whole mental model.&lt;/p&gt;

&lt;p&gt;Step 2 — Find Your Endpoint&lt;br&gt;
Search for /pet/findByStatus in the spec. Here's what it looks like:&lt;br&gt;
json"/pet/findByStatus": {&lt;br&gt;
  "get": {&lt;br&gt;
    "summary": "Finds Pets by status",&lt;br&gt;
    "parameters": [&lt;br&gt;
      {&lt;br&gt;
        "name": "status",&lt;br&gt;
        "in": "query",&lt;br&gt;
        "required": false,&lt;br&gt;
        "schema": {&lt;br&gt;
          "type": "string",&lt;br&gt;
          "enum": ["available", "pending", "sold"]&lt;br&gt;
        }&lt;br&gt;
      }&lt;br&gt;
    ]&lt;br&gt;
  }&lt;br&gt;
}&lt;br&gt;
The spec tells you everything. One query parameter called status, three allowed values. No guessing.&lt;/p&gt;

&lt;p&gt;Step 3 — Call It in Python&lt;br&gt;
pythonimport requests&lt;/p&gt;

&lt;p&gt;response = requests.get(&lt;br&gt;
    "&lt;a href="https://petstore3.swagger.io/api/v3/pet/findByStatus" rel="noopener noreferrer"&gt;https://petstore3.swagger.io/api/v3/pet/findByStatus&lt;/a&gt;",&lt;br&gt;
    params={"status": "available"}&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;data = response.json()&lt;br&gt;
print(f"Status: {response.status_code}")&lt;br&gt;
print(f"Pets returned: {len(data)}")&lt;br&gt;
print(data[0])  # peek at the first result&lt;br&gt;
Run it. Then try swapping available for pending or sold and see what changes.&lt;/p&gt;

&lt;p&gt;Step 4 — Read the Response&lt;br&gt;
You'll get back a list of pet objects. Something like:&lt;br&gt;
json{&lt;br&gt;
  "id": 1,&lt;br&gt;
  "name": "doggie",&lt;br&gt;
  "status": "available",&lt;br&gt;
  "photoUrls": []&lt;br&gt;
}&lt;br&gt;
The spec told you this was coming — check the responses section for /pet/findByStatus. It describes the exact shape of what you just received.&lt;/p&gt;

&lt;p&gt;Why This Actually Matters&lt;br&gt;
Most developers go straight to tutorial blog posts when they want to use an API. The spec is better. It's always up to date, it's authoritative, and it tells you things blog posts skip — like which parameters are optional, what the valid enum values are, and what error responses look like.&lt;br&gt;
Get comfortable reading specs now. As your projects grow more complex, this habit saves hours.&lt;/p&gt;

</description>
      <category>python</category>
      <category>api</category>
      <category>developer</category>
    </item>
    <item>
      <title>Stop Breaking Your System Python: A Practical Guide to Managing Multiple Python Versions</title>
      <dc:creator>Iman</dc:creator>
      <pubDate>Fri, 15 May 2026 10:17:08 +0000</pubDate>
      <link>https://dev.to/imann_12/stop-breaking-your-system-python-a-practical-guide-to-managing-multiple-python-versions-4gfg</link>
      <guid>https://dev.to/imann_12/stop-breaking-your-system-python-a-practical-guide-to-managing-multiple-python-versions-4gfg</guid>
      <description>&lt;p&gt;Every Python developer eventually hits the same wall: one project needs Python 3.9, another requires 3.11, and the new one won't run on anything below 3.12. The instinct is to upgrade globally — which promptly breaks something else.&lt;br&gt;
There's a better way. Two tools worth knowing: pyenv and conda. They solve the same problem differently, and knowing which to reach for matters.&lt;/p&gt;

&lt;p&gt;pyenv — Lightweight, Automatic Version Switching&lt;br&gt;
pyenv lets you install and switch between Python versions at the system, user, or project level. Critically, it never touches your system Python.&lt;br&gt;
Installing pyenv&lt;br&gt;
Linux / Mac:&lt;br&gt;
bashcurl &lt;a href="https://pyenv.run" rel="noopener noreferrer"&gt;https://pyenv.run&lt;/a&gt; | bash&lt;br&gt;
Add this to your ~/.bashrc or ~/.zshrc:&lt;br&gt;
bashexport PYENV_ROOT="$HOME/.pyenv"&lt;br&gt;
export PATH="$PYENV_ROOT/bin:$PATH"&lt;br&gt;
eval "$(pyenv init -)"&lt;br&gt;
Windows — use pyenv-win:&lt;br&gt;
powershellInvoke-WebRequest -UseBasicParsing -Uri "&lt;a href="https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" rel="noopener noreferrer"&gt;https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1&lt;/a&gt;" -OutFile "./install-pyenv-win.ps1"; &amp;amp;"./install-pyenv-win.ps1"&lt;br&gt;
Basic Usage&lt;br&gt;
bash# See available versions&lt;br&gt;
pyenv install --list&lt;/p&gt;

&lt;h1&gt;
  
  
  Install a specific version
&lt;/h1&gt;

&lt;p&gt;pyenv install 3.11.9&lt;/p&gt;

&lt;h1&gt;
  
  
  Set global default
&lt;/h1&gt;

&lt;p&gt;pyenv global 3.11.9&lt;/p&gt;

&lt;h1&gt;
  
  
  Set version for current project only
&lt;/h1&gt;

&lt;p&gt;pyenv local 3.10.14&lt;br&gt;
pyenv local creates a .python-version file in your project directory. Every time you cd into that folder, pyenv switches automatically — no manual toggling.&lt;br&gt;
Per-Project Workflow&lt;br&gt;
bashcd my-project&lt;br&gt;
pyenv local 3.10.14&lt;br&gt;
python --version  # Python 3.10.14&lt;/p&gt;

&lt;p&gt;cd ../other-project&lt;br&gt;
pyenv local 3.12.0&lt;br&gt;
python --version  # Python 3.12.0&lt;br&gt;
Clean and automatic.&lt;/p&gt;

&lt;p&gt;conda — Full Environment Management&lt;br&gt;
conda handles Python versions and packages together. It's heavier than pyenv but earns its weight when dependencies get complex — particularly in data science and ML.&lt;br&gt;
Installing conda&lt;br&gt;
Download Miniconda — the minimal install — for Windows, Linux, or Mac.&lt;br&gt;
Basic Usage&lt;br&gt;
bash# Create an environment with a specific Python version&lt;br&gt;
conda create -n myenv python=3.10&lt;/p&gt;

&lt;h1&gt;
  
  
  Activate it
&lt;/h1&gt;

&lt;p&gt;conda activate myenv&lt;/p&gt;

&lt;h1&gt;
  
  
  Install packages
&lt;/h1&gt;

&lt;p&gt;conda install numpy pandas&lt;/p&gt;

&lt;h1&gt;
  
  
  Deactivate
&lt;/h1&gt;

&lt;p&gt;conda deactivate&lt;br&gt;
Per-Project Workflow&lt;br&gt;
bashcd my-project&lt;br&gt;
conda activate project-39    # Python 3.9 environment&lt;/p&gt;

&lt;p&gt;cd ../other-project&lt;br&gt;
conda activate project-312   # Python 3.12 environment&lt;br&gt;
Unlike pyenv, switching isn't automatic — you activate manually. Small trade-off for what you get in return.&lt;/p&gt;

&lt;p&gt;pyenv vs conda — Which One?&lt;br&gt;
pyenvcondaPython version switchingAutomatic (per directory)Manual activationPackage managementNo — use pip + venvYes, built-inBest forGeneral / backend / web devData science / MLWindows supportVia pyenv-win (limited)ExcellentOverheadLightweightHeavier&lt;br&gt;
Use pyenv if you want lightweight, automatic version switching per project.&lt;br&gt;
Use conda if you're in data science, need environment and package management together, or are primarily on Windows.&lt;/p&gt;

&lt;p&gt;The Ideal Setup: pyenv + venv Together&lt;br&gt;
For most developers, this combination covers everything:&lt;br&gt;
bash# Set Python version with pyenv&lt;br&gt;
pyenv local 3.11.9&lt;/p&gt;

&lt;h1&gt;
  
  
  Create a virtual environment
&lt;/h1&gt;

&lt;p&gt;python -m venv .venv&lt;/p&gt;

&lt;h1&gt;
  
  
  Activate it
&lt;/h1&gt;

&lt;p&gt;source .venv/bin/activate      # Linux/Mac&lt;br&gt;
.venv\Scripts\activate         # Windows&lt;/p&gt;

&lt;h1&gt;
  
  
  Install dependencies
&lt;/h1&gt;

&lt;p&gt;pip install -r requirements.txt&lt;br&gt;
pyenv handles the version. venv handles dependency isolation. Best of both.&lt;/p&gt;

&lt;p&gt;Common Issues Worth Knowing&lt;br&gt;
pyenv: command not found after install&lt;br&gt;
Your shell config wasn't reloaded. Run source ~/.bashrc (or ~/.zshrc) after editing it, or close and reopen your terminal.&lt;br&gt;
conda: environment not activating in scripts&lt;br&gt;
Run conda init once after installing, then restart your terminal. This adds the necessary hooks to your shell profile.&lt;br&gt;
python --version still shows system Python after pyenv local&lt;br&gt;
Make sure the pyenv init lines are actually in your shell config and that you've reloaded it. Running pyenv versions should list your installed versions.&lt;/p&gt;

&lt;p&gt;Quick Reference&lt;br&gt;
bash# pyenv&lt;br&gt;
pyenv install 3.11.9&lt;br&gt;
pyenv local 3.11.9       # project-level&lt;br&gt;
pyenv global 3.11.9      # system-level&lt;br&gt;
pyenv versions           # list installed versions&lt;/p&gt;

&lt;h1&gt;
  
  
  conda
&lt;/h1&gt;

&lt;p&gt;conda create -n myenv python=3.11&lt;br&gt;
conda activate myenv&lt;br&gt;
conda deactivate&lt;br&gt;
conda env list           # list all environments&lt;/p&gt;

&lt;p&gt;Managing Python versions correctly is one of those things that saves you hours of debugging later. Set it up once, stop thinking about it.&lt;br&gt;
If you're running into an issue not covered here, drop it in the comments.&lt;/p&gt;

</description>
      <category>python</category>
      <category>linux</category>
      <category>developer</category>
    </item>
  </channel>
</rss>
