{"id":24216,"library":"pbxproj","title":"pbxproj","description":"A Python library for reading, modifying, and writing Xcode project files (.pbxproj). Current version 4.3.3, with occasional updates.","status":"active","version":"4.3.3","language":"python","source_language":"en","source_url":"https://github.com/kronenthaler/mod-pbxproj","tags":["xcode","pbxproj","ios","macos","project-manipulation"],"install":[{"cmd":"pip install pbxproj","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Direct import of class instead of from module.","wrong":"from pbxproj.XcodeProject import XcodeProject","symbol":"XcodeProject","correct":"from pbxproj import XcodeProject"},{"note":"PBXGenericObject is in a submodule, not top-level.","wrong":"from pbxproj import PBXGenericObject","symbol":"PBXGenericObject","correct":"from pbxproj.PBXGenericObject import PBXGenericObject"}],"quickstart":{"code":"from pbxproj import XcodeProject\n\nproject = XcodeProject.load('MyProject.xcodeproj/project.pbxproj')\n# Add a file to the project (relative path from project root)\nproject.add_file('path/to/YourFile.swift')\nproject.save()\nprint('Project updated successfully.')","lang":"python","description":"Load an Xcode project, add a file, and save."},"warnings":[{"fix":"Check the return value: `result = project.add_file(...)` and handle None.","message":"The `add_file` method returns an optional object; ignoring the return value can lead to silent failures if the file is not added (e.g., duplicate).","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade Python to 3.10+ or pin pbxproj==3.2.3.","message":"Version 4.x dropped support for Python 3.9 and earlier. Projects using Python <3.10 must use version 3.2.3.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use `XcodeProject.load(path)` to load an existing project.","message":"The `pbxproj.XcodeProject()` constructor without arguments is deprecated; use `XcodeProject.load()` or create from a file path.","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure you import `XcodeProject` from `pbxproj` (not from submodules) and use version 4.x. If using older version, `add_file` may be in `objects` attribute.","cause":"Importing from wrong module or using outdated API.","error":"'XcodeProject' object has no attribute 'add_file'"},{"fix":"Run `pip install pbxproj`.","cause":"pbxproj is not installed.","error":"ModuleNotFoundError: No module named 'pbxproj'"},{"fix":"Pass a string path: `XcodeProject.load('path/to/project.pbxproj')`.","cause":"Passing a file path string instead of a project object to `XcodeProject.load()`.","error":"'str' object has no attribute 'get'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}