Skip to content

Commit 6671bd1

Browse files
committed
uv project
1 parent 8268769 commit 6671bd1

File tree

16 files changed

+2072
-194
lines changed

16 files changed

+2072
-194
lines changed

.github/dependabot.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
groups:
8+
actions-deps:
9+
patterns:
10+
- "*"
11+
12+
# - package-ecosystem: "uv"
13+
# directory: "/"
14+
# schedule:
15+
# interval: "daily"
16+
# groups:
17+
# dev-deps:
18+
# dependency-type: "development"

.github/workflows/python-app.yml

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ on:
88

99
env:
1010
DEFAULT_PYTHON: "3.10"
11+
RUFF_VERSION: 0.14.10
12+
UV_VERSION: 0.9.18
1113

1214
permissions:
1315
contents: read
@@ -16,8 +18,14 @@ jobs:
1618
ruff:
1719
runs-on: ubuntu-latest
1820
steps:
19-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v6
2022
- uses: chartboost/ruff-action@v1
23+
with:
24+
version: ${{ env.RUFF_VERSION }}
25+
# - uses: chartboost/ruff-action@v1
26+
# with:
27+
# args: "format --check"
28+
# version: ${{ env.RUFF_VERSION }}
2129

2230
black:
2331
runs-on: ubuntu-latest
@@ -35,14 +43,15 @@ jobs:
3543
- uses: actions/setup-python@v4
3644
with:
3745
python-version: ${{ env.DEFAULT_PYTHON }}
38-
- name: Install dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip install -r requirements.txt
42-
pip install -r requirements-dev.txt
46+
- name: Install uv
47+
uses: astral-sh/setup-uv@v7
48+
with:
49+
version: ${{ env.UV_VERSION }}
50+
- name: Install Requirements
51+
run: uv sync --frozen --all-extras
4352
- name: Run Pylint
4453
run: |
45-
pylint --disable=too-many-positional-arguments office365
54+
uv run pylint --disable=too-many-positional-arguments office365
4655
4756
pytest:
4857
runs-on: ubuntu-latest
@@ -51,16 +60,13 @@ jobs:
5160
- black
5261
- pylint
5362
steps:
54-
- uses: actions/checkout@v3
63+
- uses: actions/checkout@v6
5564
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
56-
uses: actions/setup-python@v3
65+
uses: actions/setup-python@v6
5766
with:
5867
python-version: ${{ env.DEFAULT_PYTHON }}
59-
- name: Install dependencies
60-
run: |
61-
python -m pip install --upgrade pip
62-
pip install -r requirements.txt
63-
pip install -r requirements-dev.txt
68+
- name: Install Requirements
69+
run: uv sync --frozen --all-extras
6470
- name: Test with pytest (skip entirely if secrets missing)
6571
env:
6672
office365_python_sdk_securevars: ${{ secrets.OFFICE365_PYTHON_SDK_SECUREVARS }}
@@ -69,5 +75,5 @@ jobs:
6975
echo "No secrets available; skipping pytest"; \
7076
exit 0; \
7177
else \
72-
pytest; \
78+
uv run pytest; \
7379
fi

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ venv.bak/
1616
# C extensions
1717
*.so
1818

19+
# Caches
20+
.mypy_cache
21+
.ruff_cache
22+
1923
# Distribution / packaging
2024
.Python
2125
build/

.pre-commit-config.yaml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,41 @@
11
repos:
2-
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.0.292
2+
3+
- repo: local
44
hooks:
5-
- id: ruff
6-
args: [--fix, --exit-non-zero-on-fix]
5+
- id: pyproject-fmt
6+
name: pyproject-fmt
7+
entry: uv run pyproject-fmt pyproject.toml
8+
language: system
9+
pass_filenames: false
10+
11+
- id: uv-lock
12+
name: uv lock
13+
entry: uv lock
14+
language: system
15+
pass_filenames: false
16+
17+
- id: ruff-check
18+
name: ruff-check
19+
entry: uv run ruff check --fix --exit-non-zero-on-fix
20+
language: system
21+
pass_filenames: false
22+
23+
# A proposal to replace black & pylint
24+
# - id: ruff-format
25+
# name: ruff-format
26+
# entry: uv run ruff format --exit-non-zero-on-fix
27+
# language: system
28+
# pass_filenames: false
29+
30+
- id: pylint
31+
name: pylint
32+
entry: uv run pylint office365
33+
language: system
34+
pass_filenames: false
35+
736
- repo: https://github.com/psf/black
837
rev: 23.9.1
938
hooks:
1039
- id: black
1140
args:
12-
- --quiet
41+
- --quiet

README-dev.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,27 @@
11
# Installing to virtualenv
2-
In the pipenv/poetry era one would already forget these commands...
32

43
```bash
5-
$ python3 -m venv venv
6-
$ . venv/bin/activate
7-
$ pip install -r requirements.txt
8-
$ pip install -r requirements-dev.txt
4+
uv sync
95
```
106

11-
# Running tests
7+
## Running tests
128

13-
Most of the tests are end-to-end - operations are invoked against actual tenant (not mocked).
14-
So one has to configure his/her office/sharepoint credentials.
9+
Most of the tests are end-to-end - operations are invoked against actual tenant (not mocked).
10+
So one has to configure his/her office/sharepoint credentials.
1511
To do so, create a file ```.env``` like this (replace the bracketed values by your values):
1612

17-
```
13+
```bash
1814
export office365_python_sdk_securevars='{username};{password};{client_id};{client_secret}'
1915
```
2016

2117
This file is in .gitignore, so it will never be committed.
2218

2319
```bash
24-
$ . .env # source it to export the variable
25-
$ pytest ... # run the test(s) you need...
20+
. .env # source it to export the variable
21+
pytest ... # run the test(s) you need...
2622
```
2723

28-
#### Configure Tenant
24+
## Configure Tenant
2925

3026
Roles:
3127

office365/entity_collection.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing_extensions import Self
44

55
from office365.entity import Entity
6+
from office365.runtime.client_object import T
67
from office365.runtime.client_object_collection import ClientObjectCollection
78
from office365.runtime.compat import is_string_type
89
from office365.runtime.paths.resource_path import ResourcePath
@@ -12,8 +13,6 @@
1213
if TYPE_CHECKING:
1314
from office365.graph_client import GraphClient
1415

15-
from office365.runtime.client_object import T
16-
1716

1817
class EntityCollection(ClientObjectCollection[T]):
1918
"""A collection container which represents a named collections of entities"""

office365/py.typed

Whitespace-only changes.

office365/sharepoint/excel/excel_rest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, context):
2121
def authenticate_request(self, request):
2222
pass
2323

24+
@property
2425
def service_root_url(self):
2526
return "{0}/_vti_bin/ExcelRest.aspx"
2627

office365/sharepoint/taxonomy/service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, context):
2222
def pending_request(self):
2323
return self._pending_request
2424

25+
@property
2526
def service_root_url(self):
2627
return self._service_root_url
2728

0 commit comments

Comments
 (0)