|
| 1 | +## Welcome Contributors! 🎉 |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Office365-REST-Python-Client library. This project provides a comprehensive Python client for Microsoft 365 and Microsoft Graph APIs. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +1. Getting Started |
| 8 | +2. Development Environment Setup |
| 9 | +3. Code Style and Quality Standards |
| 10 | +4. Testing Guidelines |
| 11 | +5. Submitting Changes |
| 12 | +6. Issue Reporting |
| 13 | +7. Documentation |
| 14 | +8. Community Guidelines |
| 15 | + |
| 16 | +## Getting Started |
| 17 | + |
| 18 | +### Prerequisites |
| 19 | + |
| 20 | +- Python 3.6+ |
| 21 | +- Git |
| 22 | +- A Microsoft 365 tenant for testing (recommended) |
| 23 | +- Basic understanding of REST APIs and Microsoft Graph/SharePoint APIs |
| 24 | + |
| 25 | +### Fork and Clone |
| 26 | + |
| 27 | +1. Fork the repository on GitHub |
| 28 | +2. Clone your fork locally: |
| 29 | + |
| 30 | +```bash |
| 31 | +git clone https://github.com/your-username/Office365-REST-Python-Client.git |
| 32 | +cd Office365-REST-Python-Client |
| 33 | +``` |
| 34 | + |
| 35 | +## Development Environment Setup |
| 36 | + |
| 37 | +### Virtual Environment |
| 38 | + |
| 39 | +```bash |
| 40 | +python3 -m venv venv |
| 41 | +. venv/bin/activate # On Windows: venv\Scripts\activate |
| 42 | +``` |
| 43 | + |
| 44 | +### Install Dependencies |
| 45 | + |
| 46 | +```bash |
| 47 | +pip install -r requirements.txt |
| 48 | +pip install -r requirements-dev.txt |
| 49 | +``` |
| 50 | + |
| 51 | +### Pre-commit hooks (recommended) |
| 52 | + |
| 53 | +```bash |
| 54 | +pip install pre-commit |
| 55 | +pre-commit install |
| 56 | +pre-commit run -a |
| 57 | +``` |
| 58 | + |
| 59 | +## Code Style and Quality Standards |
| 60 | + |
| 61 | +The project uses the following tools (mirroring CI): |
| 62 | + |
| 63 | +- Black (formatting) |
| 64 | +- Ruff (linting and import sorting) |
| 65 | +- Pylint (static analysis) |
| 66 | + |
| 67 | +Line length: 121 characters (configured in `pyproject.toml`). |
| 68 | + |
| 69 | +Run locally before pushing: |
| 70 | + |
| 71 | +```bash |
| 72 | +black . |
| 73 | +ruff check . |
| 74 | +pylint office365 |
| 75 | +``` |
| 76 | + |
| 77 | +## Testing Guidelines |
| 78 | + |
| 79 | +Most tests are end-to-end and require actual Microsoft 365 credentials. |
| 80 | + |
| 81 | +### Test Configuration |
| 82 | + |
| 83 | +1. Create a `.env` file in the project root: |
| 84 | + |
| 85 | +```bash |
| 86 | +export office365_python_sdk_securevars='{username};{password};{client_id};{client_secret}' |
| 87 | +``` |
| 88 | + |
| 89 | +2. Source the environment file: |
| 90 | + |
| 91 | +```bash |
| 92 | +. .env |
| 93 | +``` |
| 94 | + |
| 95 | +Note: The order of values is significant because tests parse by index. |
| 96 | + |
| 97 | +### Required Tenant Permissions |
| 98 | + |
| 99 | +For comprehensive testing, your test tenant should have these admin roles: |
| 100 | + |
| 101 | +- Global reader |
| 102 | +- Groups admin |
| 103 | +- Search admin |
| 104 | +- SharePoint admin |
| 105 | +- Teams service admin |
| 106 | + |
| 107 | +### Running Tests |
| 108 | + |
| 109 | +```bash |
| 110 | +pytest |
| 111 | +# or |
| 112 | +pytest -v |
| 113 | +# or a specific suite |
| 114 | +pytest tests/sharepoint/ |
| 115 | +``` |
| 116 | + |
| 117 | +CI note: Full E2E tests in CI rely on repository secrets and may not run on forks. Please run tests locally; maintainers trigger full CI runs as needed. |
| 118 | + |
| 119 | +### Forks and CI |
| 120 | + |
| 121 | +- Forked pull requests do not receive repository secrets. The CI pipeline will run formatting and linting, and it will skip `pytest` automatically if secrets are unavailable. |
| 122 | +- To validate your changes, run tests locally using your own tenant credentials as described above. |
| 123 | +- Maintainers will run the full E2E test suite on branches with access to secrets before merging. |
| 124 | + |
| 125 | +## Submitting Changes |
| 126 | + |
| 127 | +### Branching Strategy |
| 128 | + |
| 129 | +1. Create a feature branch from `master`: |
| 130 | + |
| 131 | +```bash |
| 132 | +git checkout -b feature/your-feature-name |
| 133 | +``` |
| 134 | + |
| 135 | +2. Make your changes with clear, focused commits |
| 136 | +3. Ensure all tests pass and quality checks are satisfied |
| 137 | + |
| 138 | +### Pull Request Process |
| 139 | + |
| 140 | +1. CI Checks must pass: |
| 141 | + - Ruff linting |
| 142 | + - Black formatting |
| 143 | + - Pylint analysis |
| 144 | + - Pytest execution |
| 145 | +2. Await maintainer review |
| 146 | +3. Update documentation where applicable |
| 147 | + |
| 148 | +### Commit Guidelines |
| 149 | + |
| 150 | +- Use clear, descriptive commit messages |
| 151 | +- Reference issue numbers when applicable |
| 152 | +- Keep commits focused and atomic |
| 153 | + |
| 154 | +## Issue Reporting |
| 155 | + |
| 156 | +Before filing an issue: |
| 157 | + |
| 158 | +1. Search existing issues |
| 159 | +2. Check documentation and examples |
| 160 | +3. Test with the latest version |
| 161 | + |
| 162 | +Include in your report: |
| 163 | + |
| 164 | +- Environment: Python version, OS, library version |
| 165 | +- Reproduction: minimal code example |
| 166 | +- Expected vs Actual behavior |
| 167 | +- Authentication method used |
| 168 | +- Targeted service area (SharePoint, Graph, etc.) |
| 169 | + |
| 170 | +## Documentation |
| 171 | + |
| 172 | +### API Coverage |
| 173 | + |
| 174 | +The library supports multiple Microsoft 365 APIs, including SharePoint REST, Microsoft Graph, OneDrive, Outlook, Teams, OneNote, and Planner. See `examples/` for usage. |
| 175 | + |
| 176 | +## Community Guidelines |
| 177 | + |
| 178 | +This project is maintained by the community. Be respectful and constructive in all interactions. |
| 179 | + |
| 180 | +### License |
| 181 | + |
| 182 | +MIT License. By contributing, you agree that your contributions are licensed under these terms. |
| 183 | + |
| 184 | + |
0 commit comments