Skip to main content

A utility for interacting with Xcode's xcodeproj bundle format.

Project description

xcodeproj

PyPI version Python versions Test

xcodeproj is a utility for interacting with Xcode's xcodeproj bundle format.

It expects some level of understanding of the internals of the pbxproj format and schemes. Note that this tool only reads projects. It does not write out any changes. If you are looking for more advanced functionality like this, I recommend looking at the Ruby gem of the same name (which is unaffiliated in anyway).

To learn more about the format, you can look at any of these locations:

Getting Started

Loading a project is very simple:

project = xcodeproj.XcodeProject("/path/to/project.xcodeproj")

From here you can explore the project in different ways:

# Get all targets
for target in project.targets:
    print(target.name)

# Print from the root level, 2 levels deep (.project is a property on the root
# project as other properties such as .schemes are also available)
for item1 in project.project.main_group.children:
    print(item1)
    if not isinstance(item1, xcodeproj.PBXGroup):
        continue

    for item2 in item1.children:
        print("\t", item2)

# Check that all files referenced in the project exist on disk
for item in project.fetch_type(xcodeproj.PBXFileReference).values():
    assert os.path.exists(item.absolute_path())

# You can access the raw objects map directly:
obj = project.objects["key here"]

# For any object you have, you can access its key/identifier via the
# `.object_key` property
key = obj.object_key

Note: This library is "lazy". Many things aren't calculated until they are used. This time will be inconsequential on smaller projects, but on larger ones, it can save quite a bit of time due to not parsing the entire project on load. These properties are usually stored though so that subsequent accesses are instant.

Note on Scheme Support

There's no DTD for xcscheme files, so the implementation has been guessed. There will definitely be holes that still need to be patched in it though. Please open an issue if you find any, along with a sample xcscheme file.

Contributing

Development

This project uses uv for dependency management and Ruff for linting and formatting.

# Install dependencies (creates a virtual environment)
uv sync

# Install the git pre-commit hooks
uv run pre-commit install

# Run the linters, formatter check, and type checker
./stylecheck.sh

# Run the tests
./test.sh

Contributor License Agreement

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcodeproj-3.0.0.tar.gz (83.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcodeproj-3.0.0-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file xcodeproj-3.0.0.tar.gz.

File metadata

  • Download URL: xcodeproj-3.0.0.tar.gz
  • Upload date:
  • Size: 83.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xcodeproj-3.0.0.tar.gz
Algorithm Hash digest
SHA256 3fb1019b6049163274be8cac2d5480b7b3d564180c8c28fe2e33bf6c5365703b
MD5 58c0d88c4118d3ee33e1e281b22335f5
BLAKE2b-256 b3885355ac9acc3a08a1d6f9192fccfa1414e9001b7397031f5fa8a54c9614cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for xcodeproj-3.0.0.tar.gz:

Publisher: publish.yml on microsoft/xcodeproj

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xcodeproj-3.0.0-py3-none-any.whl.

File metadata

  • Download URL: xcodeproj-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xcodeproj-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 368242e89b88e67dc993b1cfd40dd5232e7764de4e57eb65e2db5960efae14b8
MD5 08bda5318beb22e096dd3ce9b01bfdd1
BLAKE2b-256 5269a169ce6c44abbaef5c95338fe92739ae669724b6ad4ce2217539b5cfd318

See more details on using hashes here.

Provenance

The following attestation bundles were made for xcodeproj-3.0.0-py3-none-any.whl:

Publisher: publish.yml on microsoft/xcodeproj

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page