{"slug": "from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a", "title": "From Zero to First PR: How I Contributed to an Open-Source AI Project as a Beginner", "summary": "A developer contributed their first pull request to an open-source AI project by following a structured approach: selecting a mid-sized project with beginner-friendly issues, setting up the environment locally, and fixing a small, scoped bug. The developer chose an issue to add input validation for a TextDataset class, demonstrating that beginners can contribute to real-world AI systems without mastering the entire codebase.", "body_md": "I stared at the GitHub page for what felt like forever.\n\nThe repo had thousands of stars, hundreds of issues, and a long list of contributors who clearly knew what they were doing. Me? I had a few small personal projects, some half-finished tutorials, and a nagging feeling that I wasn’t “ready” to contribute to real open-source software.\n\nEspecially not an AI project with fancy models, complex pipelines, and people publishing papers off the codebase.\n\nBut I wanted in. I wanted to learn how real-world AI systems are built, to get feedback on my code, and to be part of something bigger than my local src/ folder.\n\nSo I made a deal with myself: no more waiting until I feel “ready.” I’d go from zero to my first pull request (PR) in one focused push.\n\nHere’s exactly how I did it, what I learned, and what I’d tell anyone hesitant about contributing to an open-source AI or machine learning project for the first time.\n\n**Step 1: Pick the Right Project (Not the Biggest One)**\n\nThe biggest mistake I almost made was aiming for the most famous AI repo I could find.\n\nBig projects are great, but they can be intimidating and slow for a first-timer. Instead, I looked for:\n\n**Active maintenance**: recent commits, issues being closed, maintainers responding.\n\nClear contribution guidelines: a CONTRIBUTING.md or at least a solid README.\n\n**Beginner-friendly issues:** labels like good first issue, beginner, or help wanted.\n\nScope I could understand: I didn’t need to grasp the entire codebase, just enough to fix one small thing.\n\n**I ended up choosing a mid-sized open-source AI library**: not unknown, not legendary. Perfect.\n\nIf you’re searching now, try queries like:\n\n“awesome open source llm”\n\n“open source machine learning projects good first issue”\n\n“open source AI tools GitHub”\n\nThen scan their issues tab for beginner-friendly tasks.\n\n**Step 2: Set Up the Project Locally (Without Panicking)**\n\nOnce I picked a project, the next hurdle was getting it to run on my machine.\n\nThe repo had a typical structure:\n\nproject/\n\nREADME.md\n\nCONTRIBUTING.md\n\nrequirements.txt\n\npyproject.toml\n\nsrc/\n\npackage_name/\n\n**init**.py\n\nmodels/\n\ndata/\n\nutils/\n\ntests/\n\nexamples/\n\nI followed these steps:\n\nFork the repo to my own GitHub account.\n\nClone my fork locally:\n\ngit clone [https://github.com/your-username/project-name.git](https://github.com/your-username/project-name.git)\n\ncd project-name\n\nCreate a virtual environment:\n\npython -m venv .venv\n\nsource .venv/bin/activate # or .venvScriptsactivate on Windows\n\nInstall dependencies:\n\npip install -e \".[dev]\" # or: pip install -r requirements.txt\n\nRun the tests to make sure everything worked:\n\npytest\n\nIf the tests passed and the example scripts ran, I knew my environment was sane.\n\nPro tip: if the project uses Docker, use it. A working docker-compose up can save you hours of dependency headaches.\n\n**Step 3: Choose a Small, Scoped Issue**\n\nI filtered the issues by good first issue and looked for things like:\n\nFixing a typo in docs.\n\nAdding a missing example.\n\nImproving error messages.\n\nWriting a small test.\n\nFixing a clear, isolated bug.\n\nI avoided:\n\nHuge refactors.\n\nVague “improve performance” tasks.\n\nAnything that required deep knowledge of the entire architecture.\n\nI picked an issue titled:\n\n“Add input validation for TextDataset and raise a clearer error when max_length is negative.”\n\nPerfect. One class, one behavior, very testable.\n\n**Step 4: Understand the Code (Without Reading Everything)**\n\nI didn’t try to read the entire codebase. Instead, I:\n\nSearched for the class name (TextDataset) in the src/ folder.\n\nOpened the file and read just that class.\n\nLooked at existing tests for TextDataset to see how it’s used.\n\nRan a small example from the docs or examples/ folder to see it in action.\n\nFor my issue, the original code looked roughly like this:\n\nclass TextDataset:\n\ndef **init**(self, texts, max_length: int = 128):\n\nself.texts = texts\n\nself.max_length = max_length\n\n``` python\ndef __getitem__(self, idx):\n    text = self.texts[idx]\n    # truncate or pad to max_length...\n    return processed_text\n```\n\nNo validation on max_length. If someone passed -1, weird things would happen later.\n\n**Step 5: Make the Change (and Write a Test)**\n\nI added simple input validation:\n\nclass TextDataset:\n\ndef **init**(self, texts, max_length: int = 128):\n\nif not isinstance(max_length, int):\n\nraise TypeError(\"max_length must be an integer\")\n\nif max_length <= 0:\n\nraise ValueError(\"max_length must be a positive integer\")\n\n``` python\n    self.texts = texts\n    self.max_length = max_length\n\ndef __getitem__(self, idx):\n    text = self.texts[idx]\n    # truncate or pad to max_length...\n    return processed_text\n```\n\nThen I added a test:\n\nimport pytest\n\nfrom package_name.data.dataset import TextDataset\n\ndef test_text_dataset_rejects_negative_max_length():\n\ntexts = [\"Hello\", \"World\"]\n\nwith pytest.raises(ValueError, match=\"positive integer\"):\n\nTextDataset(texts, max_length=-1)\n\ndef test_text_dataset_rejects_non_int_max_length():\n\ntexts = [\"Hello\", \"World\"]\n\nwith pytest.raises(TypeError, match=\"integer\"):\n\nTextDataset(texts, max_length=\"128\")\n\nRunning pytest confirmed my tests passed and I hadn’t broken anything else.\n\nStep 6: Open the Pull Request (Without Overthinking It)\n\nI created a new branch:\n\ngit checkout -b fix/text-dataset-max-length-validation\n\nCommitted my changes with a clear message:\n\nfeat(data): validate max_length in TextDataset\n\n**I made the requested changes:**\n\nif not isinstance(max_length, int):\n\nraise TypeError(f\"max_length must be an integer, got {type(max_length).**name**}\")\n\nif max_length <= 0:\n\nraise ValueError(f\"max_length must be a positive integer, got {max_length}\")\n\nAdded the extra test:\n\ndef test_text_dataset_rejects_zero_max_length():\n\ntexts = [\"Hello\", \"World\"]\n\nwith pytest.raises(ValueError, match=\"positive integer\"):\n\nTextDataset(texts, max_length=0)\n\nAnd pushed again. A day later, the PR was merged.\n\n**My first contribution to an open-source AI project. Done.**\n\nWhat I Learned (Beyond the Code)\n\nYou don’t need to be an expert. You just need to be willing to learn and follow the project’s norms.\n\n**Small contributions matter**. Docs, tests, and tiny fixes are critical and often overlooked.\n\nMaintainers are usually kind. Most want helpful contributors, not perfect ones.\n\nReading real code is the best tutorial. You’ll see patterns, testing styles, and design decisions you won’t find in courses.\n\nOne PR makes the next one easier. After the first, the fear drops dramatically.\n\n**Key Takeaways**\n\nStart with an active, beginner-friendly open-source AI or ML project.\n\nSet up the repo locally and get the tests running before touching code.\n\nPick a small, well-scoped issue (docs, tests, validation, simple bugs).\n\n**Write tests for your changes; **maintainers love that.\n\nTreat code review as a learning opportunity, not a judgment.\n\nYour first PR doesn’t have to be impressive; it just has to be real.\n\n**Ready for Your First PR?**\n\nIf you’ve been thinking about contributing to an open-source AI or machine learning project but keep waiting for the “right time,” consider this your nudge.\n\nWhat’s one small improvement you could make in a project you already use? A clearer error message, a missing test, or a doc example?\n\nIf you want, drop the repo you’re eyeing (or the issue you’re considering) in the comments. I’m happy to help think through whether it’s a good first PR and how to approach it.", "url": "https://wpnews.pro/news/from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a", "canonical_source": "https://dev.to/george_panos_607e125c9161/from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a-beginner-5eh5", "published_at": "2026-07-15 12:24:16+00:00", "updated_at": "2026-07-15 13:00:14.594554+00:00", "lang": "en", "topics": ["artificial-intelligence", "developer-tools"], "entities": ["GitHub", "TextDataset"], "alternates": {"html": "https://wpnews.pro/news/from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a", "markdown": "https://wpnews.pro/news/from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a.md", "text": "https://wpnews.pro/news/from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a.txt", "jsonld": "https://wpnews.pro/news/from-zero-to-first-pr-how-i-contributed-to-an-open-source-ai-project-as-a.jsonld"}}