ctftime-api 0.1.3__tar.gz → 0.1.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.
Files changed (39) hide show
  1. ctftime_api-0.1.4/.github/dependabot.yml +27 -0
  2. ctftime_api-0.1.4/.github/workflows/cleanup.yml +29 -0
  3. ctftime_api-0.1.4/.github/workflows/codeql.yml +37 -0
  4. ctftime_api-0.1.4/.github/workflows/docs.yml +71 -0
  5. ctftime_api-0.1.4/.github/workflows/publish.yml +81 -0
  6. ctftime_api-0.1.4/.github/workflows/test.yml +67 -0
  7. ctftime_api-0.1.4/.gitignore +143 -0
  8. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/PKG-INFO +22 -18
  9. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/README.md +4 -0
  10. ctftime_api-0.1.4/docs/api/client.md +8 -0
  11. ctftime_api-0.1.4/docs/api/models/duration.md +8 -0
  12. ctftime_api-0.1.4/docs/api/models/event.md +8 -0
  13. ctftime_api-0.1.4/docs/api/models/rating.md +8 -0
  14. ctftime_api-0.1.4/docs/api/models/team.md +24 -0
  15. ctftime_api-0.1.4/docs/api/models/vote.md +8 -0
  16. ctftime_api-0.1.4/docs/assets/fonts/inter/italic.woff2 +0 -0
  17. ctftime_api-0.1.4/docs/assets/fonts/inter/italic_ext.woff2 +0 -0
  18. ctftime_api-0.1.4/docs/assets/fonts/inter/normal.woff2 +0 -0
  19. ctftime_api-0.1.4/docs/assets/fonts/inter/normal_ext.woff2 +0 -0
  20. ctftime_api-0.1.4/docs/assets/fonts/jetbrains_mono/normal.woff2 +0 -0
  21. ctftime_api-0.1.4/docs/assets/fonts/jetbrains_mono/normal_ext.woff2 +0 -0
  22. ctftime_api-0.1.4/docs/index.md +17 -0
  23. ctftime_api-0.1.4/docs/stylesheets/fonts.css +66 -0
  24. ctftime_api-0.1.4/examples/test_methods/main.py +52 -0
  25. ctftime_api-0.1.4/justfile +11 -0
  26. ctftime_api-0.1.4/mkdocs.yml +146 -0
  27. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/pyproject.toml +78 -73
  28. ctftime_api-0.1.4/tests/__init__.py +0 -0
  29. ctftime_api-0.1.4/tests/test_client.py +254 -0
  30. ctftime_api-0.1.4/uv.lock +1452 -0
  31. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/LICENSE +0 -0
  32. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/__init__.py +0 -0
  33. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/client.py +0 -0
  34. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/models/__init__.py +0 -0
  35. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/models/duration.py +0 -0
  36. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/models/event.py +0 -0
  37. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/models/rating.py +0 -0
  38. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/models/team.py +0 -0
  39. {ctftime_api-0.1.3 → ctftime_api-0.1.4}/ctftime_api/models/vote.py +0 -0
@@ -0,0 +1,27 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip" # See documentation for possible values
4
+ directory: "/" # Location of package manifests
5
+ reviewers:
6
+ - "jotonedev"
7
+ groups:
8
+ dependencies:
9
+ patterns:
10
+ - "*" # Group all updates together
11
+ schedule:
12
+ interval: "weekly" # How often to check for updates
13
+ commit-message:
14
+ prefix: "[poetry] "
15
+
16
+ - package-ecosystem: "github-actions"
17
+ directory: "/"
18
+ reviewers:
19
+ - "jotonedev"
20
+ groups:
21
+ dependencies:
22
+ patterns:
23
+ - "*"
24
+ schedule:
25
+ interval: "weekly"
26
+ commit-message:
27
+ prefix: "[action] "
@@ -0,0 +1,29 @@
1
+ name: Cleanup caches
2
+ on:
3
+ pull_request:
4
+ types:
5
+ - closed
6
+
7
+ jobs:
8
+ cleanup:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Cleanup
12
+ run: |
13
+ gh extension install actions/gh-actions-cache
14
+
15
+ echo "Fetching list of cache key"
16
+ cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 )
17
+
18
+ ## Setting this to not fail the workflow while deleting cache keys.
19
+ set +e
20
+ echo "Deleting caches..."
21
+ for cacheKey in $cacheKeysForPR
22
+ do
23
+ gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
24
+ done
25
+ echo "Done"
26
+ env:
27
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28
+ REPO: ${{ github.repository }}
29
+ BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge
@@ -0,0 +1,37 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ analyze:
8
+ name: Analyze (${{ matrix.language }})
9
+ runs-on: 'ubuntu-latest'
10
+ permissions:
11
+ # required for all workflows
12
+ security-events: write
13
+ # required to fetch internal or private CodeQL packs
14
+ packages: read
15
+
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ include:
20
+ - language: python
21
+ build-mode: none
22
+ steps:
23
+ - name: Checkout repository
24
+ uses: actions/checkout@v4
25
+
26
+ # Initializes the CodeQL tools for scanning.
27
+ - name: Initialize CodeQL
28
+ uses: github/codeql-action/init@v3
29
+ with:
30
+ languages: ${{ matrix.language }}
31
+ build-mode: ${{ matrix.build-mode }}
32
+ queries: security-extended,security-and-quality
33
+
34
+ - name: Perform CodeQL Analysis
35
+ uses: github/codeql-action/analyze@v3
36
+ with:
37
+ category: "/language:${{matrix.language}}"
@@ -0,0 +1,71 @@
1
+ name: Update docs
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, synchronize, reopened]
6
+ push:
7
+ tags:
8
+ - 'v*.*.*'
9
+ workflow_dispatch:
10
+ inputs:
11
+ upload:
12
+ description: 'Update documentation'
13
+ required: false
14
+ type: boolean
15
+ default: false
16
+
17
+ jobs:
18
+ build:
19
+ name: Build the docs
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout code
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Install uv
27
+ uses: astral-sh/setup-uv@v6
28
+ with:
29
+ enable-cache: true
30
+ cache-dependency-glob: "uv.lock"
31
+ version: "latest"
32
+ python-version: ${{ matrix.python-version }}
33
+
34
+ - name: Install the project
35
+ run: uv sync --group docs
36
+
37
+ - name: Set git credentials
38
+ run: |
39
+ git config --global user.name "${{ github.actor }}"
40
+ git config --global user.email "${{ github.actor }}@users.noreply.github.com"
41
+
42
+ - name: Build the docs
43
+ id: build
44
+ run: uv run mkdocs build
45
+
46
+ - name: Upload docs
47
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
48
+ id: deployment
49
+ uses: actions/upload-pages-artifact@v3
50
+ with:
51
+ path: site/
52
+
53
+ deploy:
54
+ name: Deploy the docs
55
+ runs-on: ubuntu-latest
56
+ needs: build
57
+ if: ${{ (github.event.inputs.upload || github.ref_type == 'tag') }}
58
+
59
+ permissions:
60
+ contents: read
61
+ id-token: write
62
+ pages: write
63
+
64
+ environment:
65
+ name: github-pages
66
+ url: ${{ steps.deployment.outputs.page_url }}
67
+
68
+ steps:
69
+ - name: Deploy to GitHub Pages
70
+ id: deployment
71
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,81 @@
1
+ name: Publish release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+ workflow_dispatch:
8
+ inputs:
9
+ upload:
10
+ description: 'Upload release to PyPI'
11
+ required: false
12
+ type: boolean
13
+ default: false
14
+
15
+ permissions:
16
+ contents: read
17
+
18
+ jobs:
19
+ release-build:
20
+ name: Build the release
21
+ runs-on: ubuntu-latest
22
+
23
+ permissions:
24
+ contents: read
25
+ id-token: write
26
+ attestations: write
27
+
28
+ steps:
29
+ - name: Checkout code
30
+ uses: actions/checkout@v4
31
+
32
+ - name: Install uv
33
+ uses: astral-sh/setup-uv@v6
34
+ with:
35
+ enable-cache: true
36
+ cache-dependency-glob: "uv.lock"
37
+ version: "latest"
38
+
39
+ - name: Install the project
40
+ run: uv sync --no-group docs --no-group dev
41
+
42
+ - name: Package project
43
+ run: uv build -o dist/
44
+
45
+ - name: Sign build artifacts
46
+ uses: actions/attest-build-provenance@v2
47
+ with:
48
+ subject-path: "dist/*"
49
+
50
+ - name: Upload build artifacts
51
+ uses: actions/upload-artifact@v4
52
+ with:
53
+ name: release-dists
54
+ retention-days: 1
55
+ path: "dist/"
56
+
57
+
58
+ pypi-publish:
59
+ name: Publish to PyPI
60
+ runs-on: ubuntu-latest
61
+ needs: release-build
62
+ if: ${{ (github.event.inputs.upload || github.ref_type == 'tag') }}
63
+
64
+ permissions:
65
+ contents: read
66
+ id-token: write
67
+
68
+ environment:
69
+ name: pypi
70
+
71
+ steps:
72
+ - name: Retrieve release distributions
73
+ uses: actions/download-artifact@v4
74
+ with:
75
+ name: release-dists
76
+ path: dist/
77
+
78
+ - name: Publish package distributions to PyPI
79
+ uses: pypa/gh-action-pypi-publish@release/v1
80
+ with:
81
+ attestations: true
@@ -0,0 +1,67 @@
1
+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2
+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3
+
4
+ name: Test code
5
+
6
+ on:
7
+ workflow_dispatch:
8
+ push:
9
+ pull_request:
10
+
11
+ jobs:
12
+ test:
13
+ runs-on: ubuntu-latest
14
+ continue-on-error: false
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ python-version: [ "3.11", "3.12", "3.13"]
19
+
20
+ permissions:
21
+ pull-requests: write
22
+ contents: read
23
+
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+
27
+ - name: Install uv
28
+ uses: astral-sh/setup-uv@v6
29
+ with:
30
+ enable-cache: true
31
+ cache-dependency-glob: "uv.lock"
32
+ version: "latest"
33
+ python-version: ${{ matrix.python-version }}
34
+
35
+ - name: Install the project
36
+ run: uv sync --all-extras --group dev --no-group docs
37
+
38
+ - name: Lint with ruff
39
+ id: lint
40
+ if: matrix.python-version == '3.13'
41
+ run: uv run ruff check -v
42
+
43
+ - name: Check formatting with ruff
44
+ id: check
45
+ if: matrix.python-version == '3.13'
46
+ run: uv run ruff format --check
47
+
48
+ - name: Test code
49
+ id: test
50
+ run: uv run pytest
51
+
52
+ - name: Test code with coverage
53
+ id: coverage
54
+ if: matrix.python-version == '3.13'
55
+ run: uv run coverage run -m pytest && uv run coverage report -m && uv run coverage xml
56
+ continue-on-error: true
57
+
58
+ - name: Upload coverage for pull requests
59
+ if: matrix.python-version == '3.13' && github.event_name == 'pull_request'
60
+ uses: orgoro/coverage@v3.2
61
+ with:
62
+ coverageFile: ./coverage.xml
63
+ token: ${{ secrets.GITHUB_TOKEN }}
64
+
65
+ - name: Check types
66
+ id: typing
67
+ run: uv run mypy -p ctftime_api
@@ -0,0 +1,143 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
98
+ __pypackages__/
99
+
100
+ # Celery stuff
101
+ celerybeat-schedule
102
+ celerybeat.pid
103
+
104
+ # SageMath parsed files
105
+ *.sage.py
106
+
107
+ # Environments
108
+ .env
109
+ .venv
110
+ env/
111
+ venv/
112
+ ENV/
113
+ env.bak/
114
+ venv.bak/
115
+
116
+ # Spyder project settings
117
+ .spyderproject
118
+ .spyproject
119
+
120
+ # Rope project settings
121
+ .ropeproject
122
+
123
+ # mkdocs documentation
124
+ /site
125
+
126
+ # mypy
127
+ .mypy_cache/
128
+ .dmypy.json
129
+ dmypy.json
130
+
131
+ # Pyre type checker
132
+ .pyre/
133
+
134
+ # pytype static type analyzer
135
+ .pytype/
136
+
137
+ # Cython debug symbols
138
+ cython_debug/
139
+
140
+ # End of https://mrkandreev.name/snippets/gitignore-generator/#Python
141
+
142
+ .idea/
143
+ .vscode/
@@ -1,15 +1,17 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: ctftime_api
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: CTFTime API wrapper
5
- Keywords: ctftime,api,wrapper
6
- Author: John Toniutti
7
- Author-email: john.toniutti@gmail.com
8
- Requires-Python: >=3.11
5
+ Project-URL: repository, https://github.com/jotonedev/ctftime_api
6
+ Project-URL: documentation, https://jotonedev.github.io/ctftime_api/
7
+ Author-email: John Toniutti <john.toniutti@gmail.com>
8
+ License-Expression: GPL-3.0-or-later
9
+ License-File: LICENSE
10
+ Keywords: api,ctftime,wrapper
9
11
  Classifier: Development Status :: 4 - Beta
12
+ Classifier: Framework :: Pydantic
10
13
  Classifier: Intended Audience :: Developers
11
14
  Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
12
- Classifier: Framework :: Pydantic
13
15
  Classifier: Operating System :: OS Independent
14
16
  Classifier: Programming Language :: Python :: 3
15
17
  Classifier: Programming Language :: Python :: 3.11
@@ -18,18 +20,17 @@ Classifier: Programming Language :: Python :: 3.13
18
20
  Classifier: Topic :: Internet :: WWW/HTTP
19
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
22
  Classifier: Typing :: Typed
23
+ Requires-Python: >=3.11
24
+ Requires-Dist: httpx<0.29.0,>=0.28.1
25
+ Requires-Dist: pycountry<25.0.0,>=24.6.1
26
+ Requires-Dist: pydantic-extra-types<3.0.0,>=2.10.2
27
+ Requires-Dist: pydantic<3.0.0,>=2.10.6
21
28
  Provides-Extra: speed
22
- Requires-Dist: brotli (>=1.1.0,<2.0.0) ; (platform_python_implementation == "CPython") and (extra == "speed")
23
- Requires-Dist: brotlicffi (>=1.1.0.0,<2.0.0.0) ; (platform_python_implementation != "CPython") and (extra == "speed")
24
- Requires-Dist: h2 (>=4.2.0,<5.0.0) ; extra == "speed"
25
- Requires-Dist: httpx (>=0.28.1,<0.29.0)
26
- Requires-Dist: pycountry (>=24.6.1,<25.0.0)
27
- Requires-Dist: pydantic (>=2.10.6,<3.0.0)
28
- Requires-Dist: pydantic-extra-types (>=2.10.2,<3.0.0)
29
- Requires-Dist: uvloop (>=0.21.0,<1.0.0) ; (sys_platform != "win32") and (extra == "speed")
30
- Requires-Dist: zstandard (>=0.23.0,<0.24.0) ; extra == "speed"
31
- Project-URL: Documentation, https://jotonedev.github.io/ctftime_api/
32
- Project-URL: Repository, https://github.com/jotonedev/ctftime_api
29
+ Requires-Dist: brotli<2.0.0,>=1.1.0; (platform_python_implementation == 'CPython') and extra == 'speed'
30
+ Requires-Dist: brotlicffi<2.0.0.0,>=1.1.0.0; (platform_python_implementation != 'CPython') and extra == 'speed'
31
+ Requires-Dist: h2<5.0.0,>=4.2.0; extra == 'speed'
32
+ Requires-Dist: uvloop<1.0.0,>=0.21.0; (sys_platform != 'win32') and extra == 'speed'
33
+ Requires-Dist: zstandard<0.24.0,>=0.23.0; extra == 'speed'
33
34
  Description-Content-Type: text/markdown
34
35
 
35
36
  # ctftime_api
@@ -96,3 +97,6 @@ This project is licensed under the GNU General Public License v3 or later (GPLv3
96
97
  - [Project Documentation Website](https://jotonedev.github.io/ctftime_api)
97
98
  - [GitHub Repository](https://github.com/jotonedev/ctftime_api)
98
99
 
100
+ ## License
101
+
102
+ This project is released under the [GPL 3.0 or later](LICENSE) license.
@@ -61,3 +61,7 @@ This project is licensed under the GNU General Public License v3 or later (GPLv3
61
61
 
62
62
  - [Project Documentation Website](https://jotonedev.github.io/ctftime_api)
63
63
  - [GitHub Repository](https://github.com/jotonedev/ctftime_api)
64
+
65
+ ## License
66
+
67
+ This project is released under the [GPL 3.0 or later](LICENSE) license.
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Client module
3
+ summary: Provides the main interface to the API.
4
+ ---
5
+
6
+ The Client module provides the main interface to the API.
7
+
8
+ ::: ctftime_api.CTFTimeClient
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Duration
3
+ summary: Provides a dataclass for representing a duration in hours and days.
4
+ ---
5
+
6
+ Provides a dataclass for representing a duration in hours and days.
7
+
8
+ ::: ctftime_api.models.duration.Duration
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Event module
3
+ summary: Provides the Event objects
4
+ ---
5
+
6
+ ::: ctftime_api.models.event.Event
7
+
8
+ ::: ctftime_api.models.event.EventResult
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Rating
3
+ summary: Provides a dataclass for representing a CTF team rating.
4
+ ---
5
+
6
+ Provides a dataclass for representing a CTF team rating.
7
+
8
+ ::: ctftime_api.models.rating.Rating
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: Team
3
+ summary: Provides dataclasses for representing a CTF team and its related information.
4
+ ---
5
+
6
+ Provides dataclasses for representing a CTF team and its related information.
7
+
8
+ ::: ctftime_api.models.team.BaseTeam
9
+
10
+ ::: ctftime_api.models.team.Team
11
+ options:
12
+ show_inheritance_diagram: true
13
+
14
+ ::: ctftime_api.models.team.TeamRank
15
+ options:
16
+ show_inheritance_diagram: true
17
+
18
+ ::: ctftime_api.models.team.TeamComplete
19
+ options:
20
+ show_inheritance_diagram: true
21
+
22
+ ::: ctftime_api.models.team.TeamResult
23
+ options:
24
+ show_inheritance_diagram: true
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: Vote
3
+ summary: Provides a dataclass for representing a vote to a CTF.
4
+ ---
5
+
6
+ Provides a dataclass for representing a vote to a CTF.
7
+
8
+ ::: ctftime_api.models.vote.Vote
@@ -0,0 +1,17 @@
1
+ # Introduction
2
+
3
+ ## Description
4
+
5
+ ### What is ctftime_api?
6
+
7
+ `ctftime_api` is a simple Python wrapper for the CTFTime API.
8
+
9
+ ## Features
10
+
11
+ - Fully type annotated
12
+ - Asynchronous
13
+ - Easy to use
14
+
15
+ ## Manuals
16
+
17
+ - Official CTFtime API documentation: [CTFtime docs](https://ctftime.org/api/)