Skip to main content

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

Project description

xcodeproj

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, in the future, schemes, etc. 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 in the future more surfaces, such as schemes, will be exposed)
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.

Contributing

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-0.3.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

xcodeproj-0.3.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xcodeproj-0.3.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.1 CPython/3.9.1 Darwin/20.3.0

File hashes

Hashes for xcodeproj-0.3.0.tar.gz
Algorithm Hash digest
SHA256 61667eda1f8d0645940685eff7b8abe6685f8764d5b79836b7cd686e83c75cd5
MD5 7723ef662c97a55d0e499c8fa16fc81c
BLAKE2b-256 6483216dbcdb1867d13ae0a69cd6c761a014651ced6e15e57254e5fa6537ff75

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xcodeproj-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.1 CPython/3.9.1 Darwin/20.3.0

File hashes

Hashes for xcodeproj-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a8675c884b2130d4a272e36694367051e6238a74a750697a0e08f88de8723a3
MD5 29767aba9fd13fe2721f65ffc571cb33
BLAKE2b-256 cbb4d4744d69f7fe0816b059b2cab70488c5041f74fa2ed47c25b83c9ad45fa9

See more details on using hashes here.

Supported by

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