When working in the open source world it is very important that everyone feels welcome and safe. External contributors to a project need to feel welcome so that they want to contribute to the project. Since contributing to open source is an inherently social event due to the fact that there will be interactions through issues, code reviews, etc., it can be rather daunting when you approach a project for the first time and don't know what kind of personalities you will be working with. This can be rather stressful without setting some expectation that people already involved in the project will act in a welcoming, open fashion.
Project managers need to feel safe so that they feel they can positively engage with the open source community. When you manage a project you end up working with many different people. As such, project managers don't know what kind of person they will be working with when a new contributor shows up. Without setting up expectations that new contributors should be friendly towards those already involved with the project, it can be daunting when first starting to work with a new contributor as you don't know if the new contributor is coming from a place of frustration or appreciation which can affect some people in how they treat others.
One way to help make sure this desire of welcomeness and safety occurs for both new contributors and project managers is through a code of conduct. By laying out the expectations of how external contributors and project managers are expected to treat one another upfront, people can contribute to an open source project without feeling apprehensive about what may transpire and have a reasonable expectation that it will be a positive experience for everyone involved. This leads to a more welcoming environment for new contributors as they know they should expect a welcoming experience without discrimination or worry about whether their contribution will be looked down upon. Project managers can expect a cordial interaction with new contributors and not have to worry about any form of abuse that might stem from some frustration with the project's code.
To help facilitate these feelings of welcomeness and safety, we have now instituted codes of conduct for all of our open source projects: the Azure Python SDK, Python Tools for Visual Studio, and Pyjion. To be consistent with other Microsoft open source projects -- such as Roslyn -- we have chosen to use the Contributor Covenant for our code of conduct (although we are also big fans of the Python Software Foundation's Code of Conduct). By doing this we hope that everyone involved with our projects on both sides of every interaction can feel like they had a positive experience and maybe even lead to continual contributions from everyone involved.
If you have any questions about the Code of Conduct, feel free to ask in the comments below.