skillcorner 2.3.2__tar.gz → 2.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ node_modules/
2
+ dist/
3
+
4
+ # Compiled Java class files
5
+ *.class
6
+
7
+ # Compiled Python bytecode
8
+ *.py[cod]
9
+
10
+ # Log files
11
+ *.log
12
+
13
+ # Package files
14
+ *.jar
15
+
16
+ # Maven
17
+ target/
18
+ dist/
19
+
20
+ # JetBrains IDE
21
+ .idea/
22
+
23
+ # Unit test reports
24
+ TEST*.xml
25
+
26
+ # Generated by MacOS
27
+ .DS_Store
28
+
29
+ # Generated by Windows
30
+ Thumbs.db
31
+
32
+ # Applications
33
+ *.app
34
+ *.exe
35
+ *.war
36
+
37
+ # Large media files
38
+ *.mp4
39
+ *.tiff
40
+ *.avi
41
+ *.flv
42
+ *.mov
43
+ *.wmv
44
+
45
+ .venv
46
+
47
+ .ruff_cache
48
+ .pytest_cache
49
+ __pycache__
50
+ .coverage
51
+ htmlcov/
52
+ site/
53
+ docs/html/
54
+ docs/doctrees/
@@ -0,0 +1,67 @@
1
+ image: python:3.12-slim
2
+
3
+ include:
4
+ - project: 'public-corner/skillcorner-CICD'
5
+ ref: stable
6
+ file: '.skillcorner-ci-common.yml'
7
+
8
+ stages:
9
+ - test
10
+ - build_and_publish
11
+ - prepare_release
12
+ - release
13
+
14
+
15
+ ruff:
16
+ tags: [aws-fargate-runner]
17
+ extends: .ruff
18
+
19
+ unit-tests:
20
+ stage: test
21
+ tags: [aws-fargate-runner]
22
+ parallel:
23
+ matrix:
24
+ - PYTHON_VERSION: ["3.8", "3.9", "3.10", "3.11", "3.12"]
25
+ variables:
26
+ UV_PYTHON: ${PYTHON_VERSION}
27
+ extends: .uv_test_with_coverage
28
+
29
+
30
+ package:gitlab:
31
+ stage: build_and_publish
32
+ tags: [aws-fargate-runner]
33
+ extends: .uv_build_and_publish
34
+
35
+ package:pypi:
36
+ stage: build_and_publish
37
+ tags: [aws-fargate-runner]
38
+ before_script:
39
+ - !reference [.init_uv]
40
+ script:
41
+ - uv build
42
+ - uvx twine upload dist/*
43
+ rules:
44
+ - !reference [.default_release_rules, rules]
45
+
46
+
47
+ prepare_job:
48
+ stage: prepare_release
49
+ tags: [aws-fargate-runner]
50
+ extends: .gitlab_release_prepare
51
+
52
+ release_job:
53
+ stage: release
54
+ tags: [aws-fargate-runner]
55
+ extends: .gitlab_release_job
56
+
57
+ pages: # has to be named pages to be deployed in Gitlab Pages
58
+ stage: release
59
+ tags: [aws-fargate-runner]
60
+ script:
61
+ - mkdir -p public/coverage/
62
+ - mv htmlcov/* public/coverage/
63
+ artifacts:
64
+ paths:
65
+ - public/coverage/
66
+ rules:
67
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
@@ -0,0 +1,36 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.6.0
4
+ hooks:
5
+ - id: check-added-large-files
6
+ - id: check-toml
7
+ - id: check-json
8
+ - id: check-yaml
9
+ args: ['--unsafe']
10
+ - id: double-quote-string-fixer
11
+ - id: end-of-file-fixer
12
+ - id: pretty-format-json
13
+ args: ['--autofix']
14
+ - id: requirements-txt-fixer
15
+ - id: sort-simple-yaml
16
+ - id: trailing-whitespace
17
+
18
+ - repo: https://github.com/astral-sh/ruff-pre-commit
19
+ rev: v0.6.4
20
+ hooks:
21
+ - id: ruff
22
+ - id: ruff-format
23
+
24
+ - repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
25
+ rev: v0.5.0
26
+ hooks:
27
+ - id: pre-commit-update
28
+
29
+ - repo: local
30
+ hooks:
31
+ - id: uv-lock
32
+ description: uv lock file
33
+ entry: uv run poe lock
34
+ language: python
35
+ name: uv lock file
36
+ pass_filenames: false
@@ -0,0 +1,20 @@
1
+ # Read the Docs configuration file for Sphinx projects
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+ version: 2
4
+
5
+ build:
6
+ os: ubuntu-22.04
7
+ tools:
8
+ python: "3.11"
9
+ jobs:
10
+ post_create_environment:
11
+ - pip install uv
12
+ post_install:
13
+ - uv pip install --upgrade fitrequest sphinx-book-theme
14
+
15
+ formats:
16
+ - pdf
17
+ - epub
18
+
19
+ sphinx:
20
+ configuration: docs/source/conf.py
@@ -1,20 +1,11 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: skillcorner
3
- Version: 2.3.2
3
+ Version: 2.3.4
4
4
  Summary: Python client for interact with SkillCorner API
5
- Home-page: https://skillcorner.com/
6
- Author: Skillcorner
7
- Requires-Python: >=3.8,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.8
10
- Classifier: Programming Language :: Python :: 3.9
11
- Classifier: Programming Language :: Python :: 3.10
12
- Classifier: Programming Language :: Python :: 3.11
13
- Classifier: Programming Language :: Python :: 3.12
14
- Requires-Dist: fitrequest (>=0.8.0,<0.9.0)
15
- Requires-Dist: orjson (>=3.9.10,<4.0.0)
16
- Project-URL: Documentation, https://skillcorner.readthedocs.io/en/latest/
17
- Project-URL: Repository, https://gitlab.com/public-corner/skillcorner
5
+ License-File: LICENSE.md
6
+ Requires-Python: <3.13,>=3.8
7
+ Requires-Dist: fitrequest>=0.8.2
8
+ Requires-Dist: orjson>=3.9.10
18
9
  Description-Content-Type: text/markdown
19
10
 
20
11
  # Skillcorner
@@ -52,4 +43,3 @@ teams = client.get_teams()
52
43
 
53
44
  ## Contact
54
45
  You can contact Skillcorner Team at: support@skillcorner.com.
55
-
@@ -0,0 +1,26 @@
1
+ import os
2
+ import sys
3
+
4
+ sys.path.insert(0, os.path.abspath('../../'))
5
+
6
+ # Configuration file for the Sphinx documentation builder.
7
+ #
8
+ # For the full list of built-in configuration values, see the documentation:
9
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
10
+
11
+ # -- Project information -----------------------------------------------------
12
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
13
+
14
+ project = 'skillcorner'
15
+ copyright = '2023, support@skillcorner.com'
16
+ author = 'SkillCorner'
17
+
18
+ # -- General configuration ---------------------------------------------------
19
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
20
+
21
+ extensions = ['sphinx.ext.autodoc']
22
+
23
+ # -- Options for HTML output -------------------------------------------------
24
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
25
+
26
+ html_theme = 'sphinx_book_theme'
@@ -0,0 +1,396 @@
1
+ Getting started
2
+ ===============
3
+
4
+ Installation
5
+ ------------
6
+
7
+ Before using the ``SkillcornerClient``, you need to install it:
8
+
9
+ .. code-block:: bash
10
+
11
+ pip install --upgrade skillcorner
12
+
13
+ Now you need to set up your Skillcorner credentials by adding the following variables to your environment:
14
+
15
+ * SKILLCORNER_USERNAME: Your username
16
+ * SKILLCORNER_PASSWORD: Your password
17
+
18
+ How to use it
19
+ -------------
20
+
21
+ You can instantiate the ``SkillcornerClient`` class like so:
22
+
23
+ .. code-block:: python
24
+
25
+ from skillcorner.client import SkillcornerClient
26
+
27
+ client = SkillcornerClient()
28
+
29
+ Alternative
30
+ -----------
31
+
32
+ If you don't want to set those environment variables you will need to provide your username and password at instantiation. We strongly recommend using environment variables or any other way to avoid having your password in your code.
33
+
34
+ .. code-block:: python
35
+
36
+ import os
37
+ from skillcorner.client import SkillcornerClient
38
+
39
+ secret_password = os.getenv('MY_PASSWORD_ENV_VAR')
40
+ client = SkillcornerClient(username='myusername', password=secret_password)
41
+
42
+ Examples
43
+ --------
44
+
45
+ Seasons
46
+ ~~~~~~~
47
+
48
+ Get and print seasons data
49
+
50
+ .. code-block:: python
51
+
52
+ seasons = client.get_seasons()
53
+ pprint(seasons)
54
+
55
+ Competitions
56
+ ~~~~~~~~~~~~
57
+
58
+ Get and print competition data for season 2023-2024 (season id 28)
59
+
60
+ .. code-block:: python
61
+
62
+ competitions = client.get_competitions(params={'season': 28})
63
+ pprint(competitions)
64
+
65
+ Save competition data to a file
66
+
67
+ .. code-block:: python
68
+
69
+ client.save_competitions(filepath='competitions_23_24.json', params={'season': 28})
70
+
71
+ Competition editions
72
+ ~~~~~~~~~~~~~~~~~~~~
73
+
74
+ Get and print competition editions for FRA Ligue 1 (competition id 3)
75
+
76
+ .. code-block:: python
77
+
78
+ competition_editions = client.get_competition_editions(competition_id=3)
79
+ pprint(competition_editions)
80
+
81
+ Save competition data to a file
82
+
83
+ .. code-block:: python
84
+
85
+ client.save_competition_editions(competition_id=3, filepath='competition_editions_FRA_Ligue_1.json')
86
+
87
+ We can also filter on the season using the 'params' parameter
88
+
89
+ .. code-block:: python
90
+
91
+ competition_editions = client.get_competition_editions(competition_id=3, params={'season': 28})
92
+ pprint(competition_editions)
93
+
94
+ Matches
95
+ ~~~~~~~
96
+
97
+ Get and print matches for FRA Ligue 1 2023-2024 (competition edition id 548)
98
+
99
+ .. code-block:: python
100
+
101
+ matches = client.get_matches(params={'competition_edition': 548})
102
+ pprint(matches)
103
+
104
+ Save matches to a file
105
+
106
+ .. code-block:: python
107
+
108
+ client.save_matches(filepath='matches_FRA_Ligue_1_2023_2024.json', params={'competition_edition': 548})
109
+
110
+ Match data
111
+ ~~~~~~~~~~
112
+
113
+ Get and print match data for FRA Ligue 1 2023-2024 - Clermont Foot vs AS Monaco (match id 1023377)
114
+
115
+ .. code-block:: python
116
+
117
+ match_id = 1023377
118
+ match_data = client.get_match(match_id=match_id)
119
+ pprint(match_data)
120
+
121
+ Save match data to a file
122
+
123
+ .. code-block:: python
124
+
125
+ client.save_match(match_id=match_id, filepath=f'match_data_{match_id}.json')
126
+
127
+ Match Tracking Data
128
+ ~~~~~~~~~~~~~~~~~~~
129
+
130
+ Get and print match tracking data (if you have access to the match tracking data API)
131
+
132
+ .. code-block:: python
133
+
134
+ match_id = 1023377 # FRA Ligue 1 2023-2024 - Clermont Foot vs AS Monaco
135
+ match_tracking_data = client.get_match_tracking_data(match_id=match_id)
136
+ pprint(match_tracking_data[10000:11000]) # print only the tracking data for frames 10000 to 11000
137
+
138
+ Save match tracking data to a file
139
+
140
+ .. code-block:: python
141
+
142
+ client.save_match_tracking_data(match_id=match_id, filepath=f'match_tracking_data_{match_id}.jsonl')
143
+
144
+ Physical Data
145
+ ~~~~~~~~~~~~~
146
+
147
+ Get and print physical data for FRA Ligue 1 2023-2024 - OGC Nice (team id 70)
148
+
149
+ .. code-block:: python
150
+
151
+ physical_data = client.get_physical(params={'season': 28, 'team': 70})
152
+ pprint(physical_data)
153
+
154
+ Save physical data to a file
155
+
156
+ .. code-block:: python
157
+
158
+ client.save_physical(filepath='physical.json', params={'season': 28, 'team': 70})
159
+
160
+ In Possession Data
161
+ ~~~~~~~~~~~~~~~~~~
162
+
163
+ Get and print off-ball running data for FRA Ligue 1 2023-2024 (competition edition id 548)
164
+
165
+ .. code-block:: python
166
+
167
+ off_ball_runs = client.get_in_possession_off_ball_runs(params={'competition_edition': 548})
168
+ pprint(off_ball_runs)
169
+
170
+ Get and print passing data for FRA Ligue 1 2023-2024 (competition edition id 548)
171
+
172
+ .. code-block:: python
173
+
174
+ passes = client.get_in_possession_passes(params={'competition_edition': 548})
175
+ pprint(passes)
176
+
177
+ Get and print overcoming pressure run data for FRA Ligue 1 2023-2024 (competition edition id 548)
178
+
179
+ .. code-block:: python
180
+
181
+ pressure_received = client.get_in_possession_on_ball_pressures(params={'competition_edition': 548})
182
+ pprint(pressure_received)
183
+
184
+ Dynamic Events
185
+ ~~~~~~~~~~~~~~
186
+
187
+ Get a bytes array containing off-ball run events for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
188
+
189
+ .. code-block:: python
190
+
191
+ import pandas as pd
192
+
193
+ from io import BytesIO
194
+
195
+ match_id = 1463739
196
+ off_ball_run_events = client.get_dynamic_events_off_ball_runs(match_id=match_id, params={'file_format':'csv'})
197
+ df_off_ball_run_events = pd.read_csv(BytesIO(off_ball_run_events))
198
+
199
+ Get a bytes array containing passing option events for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
200
+
201
+ .. code-block:: python
202
+
203
+ import pandas as pd
204
+
205
+ from io import BytesIO
206
+
207
+ match_id = 1463739
208
+ passing_options_events = client.get_dynamic_events_passing_options(match_id=match_id, params={'file_format':'csv'})
209
+ df_passing_options_events = pd.read_csv(BytesIO(passing_options_events))
210
+
211
+ Get a bytes array containing player possession events for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
212
+
213
+ .. code-block:: python
214
+
215
+ from io import BytesIO
216
+
217
+ import pandas as pd
218
+
219
+ match_id = 1463739
220
+ player_possessions_events = client.get_dynamic_events_player_possessions(match_id=match_id, params={'file_format':'csv'})
221
+ df_player_possessions_events = pd.read_csv(BytesIO(player_possessions_events))
222
+
223
+ Get a bytes array containing combined off-ball run, passing option and player possession events for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
224
+
225
+ .. code-block:: python
226
+
227
+ import pandas as pd
228
+
229
+ from io import BytesIO
230
+
231
+ match_id = 1463739
232
+ combined_dynamic_events = client.get_dynamic_events(match_id=match_id, params={'file_format':'csv'})
233
+ df_combined_dynamic_events = pd.read_csv(BytesIO(combined_dynamic_events))
234
+
235
+ Save an off-ball run events CSV file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
236
+
237
+ .. code-block:: python
238
+
239
+ match_id = 1463739
240
+ client.save_dynamic_events_off_ball_runs(match_id=match_id,
241
+ filepath=f'{match_id}_off_ball_runs.csv',
242
+ params={'file_format':'csv'})
243
+
244
+ Save a passing option events CSV file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
245
+
246
+ .. code-block:: python
247
+
248
+ match_id = 1463739
249
+ client.save_dynamic_events_passing_options(match_id=match_id,
250
+ filepath=f'{match_id}_off_ball_runs.csv',
251
+ params={'file_format':'csv'})
252
+
253
+
254
+ Save a player possession events CSV file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
255
+
256
+ .. code-block:: python
257
+
258
+ match_id = 1463739
259
+ client.save_dynamic_events_player_possessions(match_id=match_id,
260
+ filepath=f'{match_id}_off_ball_runs.csv',
261
+ params={'file_format':'csv'})
262
+
263
+ Save a combined off-ball run, passing option and player possession events CSV file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
264
+
265
+ .. code-block:: python
266
+
267
+ match_id = 1463739
268
+ client.save_dynamic_events(match_id=match_id,
269
+ filepath=f'{match_id}_off_ball_runs.csv',
270
+ params={'file_format':'csv'})
271
+
272
+ Save an off-ball run events Sportscode XML file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
273
+
274
+ .. code-block:: python
275
+
276
+ match_id = 1463739
277
+ client.save_dynamic_events_off_ball_runs(match_id=match_id,
278
+ filepath=f'{match_id}_off_ball_runs.xml',
279
+ params={'file_format':'sportscode-xml'})
280
+
281
+ Save a passing option events Sportscode XML file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
282
+
283
+ .. code-block:: python
284
+
285
+ match_id = 1463739
286
+ client.save_dynamic_events_passing_options(match_id=match_id,
287
+ filepath=f'{match_id}_off_ball_runs.xml',
288
+ params={'file_format':'sportscode-xml'})
289
+
290
+ Save a player possession events Sportscode XML file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
291
+
292
+ .. code-block:: python
293
+
294
+ match_id = 1463739
295
+ client.save_dynamic_events_player_possessions(match_id=match_id,
296
+ filepath=f'{match_id}_off_ball_runs.xml',
297
+ params={'file_format':'sportscode-xml'})
298
+
299
+ Save a combined off-ball run, passing option and player possession events Sportscode XML file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
300
+
301
+ .. code-block:: python
302
+
303
+ match_id = 1463739
304
+ client.save_dynamic_events(match_id=match_id,
305
+ filepath=f'{match_id}_off_ball_runs.xml',
306
+ params={'file_format':'sportscode-xml'})
307
+
308
+ Save an off-ball run events Focus JSON file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
309
+
310
+ .. code-block:: python
311
+
312
+ match_id = 1463739
313
+ client.save_dynamic_events_off_ball_runs(match_id=match_id,
314
+ filepath=f'{match_id}_off_ball_runs.json',
315
+ params={'file_format':'focus-json'})
316
+
317
+ Save a passing option events Focus JSON file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
318
+
319
+ .. code-block:: python
320
+
321
+ match_id = 1463739
322
+ client.save_dynamic_events_passing_options(match_id=match_id,
323
+ filepath=f'{match_id}_off_ball_runs.json',
324
+ params={'file_format':'focus-json'})
325
+
326
+ Save a player possession events Focus JSON file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
327
+
328
+ .. code-block:: python
329
+
330
+ match_id = 1463739
331
+ client.save_dynamic_events_player_possessions(match_id=match_id,
332
+ filepath=f'{match_id}_off_ball_runs.json',
333
+ params={'file_format':'focus-json'})
334
+
335
+ Save a combined off-ball run, passing option and player possession Focus JSON file for 2024-03-31 Manchester City Vs Arsenal match (match id 1463739)
336
+
337
+ .. code-block:: python
338
+
339
+ match_id = 1463739
340
+ client.save_dynamic_events(match_id=match_id,
341
+ filepath=f'{match_id}_off_ball_runs.json',
342
+ params={'file_format':'focus-json'})
343
+
344
+ Teams
345
+ ~~~~~
346
+
347
+ Get and print teams for FRA Ligue 1 2023-2024 (competition edition id 548)
348
+
349
+ .. code-block:: python
350
+
351
+ teams = client.get_teams(params={'competition_edition': 548})
352
+ pprint(teams)
353
+
354
+ Save team data
355
+
356
+ .. code-block:: python
357
+
358
+ client.save_teams(filepath='teams_FRA_Ligue_1_2023_2024.json', params={'competition_edition': 548})
359
+
360
+ Get and print team data for OGC Nice (team id 70)
361
+
362
+ .. code-block:: python
363
+
364
+ team_id = 70
365
+ team_data = client.get_team(team_id=team_id)
366
+ pprint(team_data)
367
+
368
+ Save team data
369
+
370
+ .. code-block:: python
371
+
372
+ client.save_team(team_id=team_id, filepath=f'team_{team_id}.json')
373
+
374
+ Players
375
+ ~~~~~~~
376
+
377
+ Get and print players
378
+
379
+ .. code-block:: python
380
+
381
+ players = client.get_players(params={'search': 'barcola'})
382
+ pprint(players)
383
+
384
+ Get and print player data
385
+
386
+ .. code-block:: python
387
+
388
+ player_id = 68485
389
+ player_data = client.get_player(player_id=player_id)
390
+ pprint(player_data)
391
+
392
+ Save player data
393
+
394
+ .. code-block:: python
395
+
396
+ client.save_player(player_id=player_id, filepath=f'player_{player_id}.json')
@@ -0,0 +1,23 @@
1
+ Welcome to SkillCorner's Python SDK Documentation
2
+ =================================================
3
+
4
+ Useful Links
5
+ ------------
6
+
7
+ * **Code**: `skillcorner GitLab <https://gitlab.com/public-corner/skillcorner/>`_
8
+ * **Pypi**: `skillcorner PyPI <https://pypi.org/project/skillcorner/>`_
9
+ * **SwaggerUI API Documentation**: `REST API Docs <https://www.skillcorner.com/api/docs>`_
10
+
11
+ Overview
12
+ --------
13
+
14
+ The ``SkillcornerClient`` is a Python class designed to interact with the Skillcorner API. It provides methods to retrieve and save various data related to competitions, seasons, matches, teams, and players.
15
+
16
+ Contents
17
+ --------
18
+
19
+ .. toctree::
20
+ :maxdepth: 2
21
+
22
+ getting_started
23
+ skillcorner_client
@@ -0,0 +1,6 @@
1
+ SkillcornerClient
2
+ =================
3
+
4
+ .. autoclass:: skillcorner.client.SkillcornerClient
5
+ :members:
6
+ :show-inheritance: