8000 Initial setup of doc structure. · judge0/judge0-python@1b5898f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1b5898f

Browse files
committed
Initial setup of doc structure.
1 parent 22d4ae6 commit 1b5898f

File tree

11 files changed

+145
-69
lines changed

11 files changed

+145
-69
lines changed

docs/source/api/api.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
API Module
2+
==========
3+
4+
.. automodule:: judge0.api
5+
:members:
6+
:undoc-members:

docs/source/api/clients.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Clients Module
2+
==============
3+
4+
.. automodule:: judge0.clients
5+
:members:
6+
:member-order: groupwise

docs/source/api/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.. toctree::
2+
:maxdepth: 2
3+
4+
api
5+
submission
6+
clients

docs/source/api/submission.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Submission Module
2+
=================
3+
4+
.. automodule:: judge0.submission
5+
:members:
6+
:member-order: groupwise

docs/source/api_index.rst

Lines changed: 0 additions & 26 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
exclude_patterns = []
3030

3131

32+
# add_module_names = False
33+
3234
# -- Options for HTML output -------------------------------------------------
3335
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
3436

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. toctree::
2+
:maxdepth: 2
3+
4+
contributing
5+
release_notes
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
How to create a release candidate
2+
=================================
3+
4+
TODO

docs/source/index.rst

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,54 @@
1+
===============================
12
Judge0 Python SDK documentation
23
===============================
34

5+
Getting Started
6+
===============
7+
8+
You can run minimal Hello World example in three easy steps:
9+
10+
1. Install Judge0 Python SDK:
11+
12+
.. code-block:: bash
13+
14+
pip install judge0
15+
16+
2. Create a minimal script:
17+
18+
.. code-block:: Python
19+
20+
import judge0
21+
22+
submission = judge.run(source_code="print('Hello Judge0!')")
23+
print(submission.stdout)
24+
25+
3. Run the script.
26+
27+
Want to learn more
28+
------------------
29+
30+
31+
To learn what is happening behind the scenes and how to best use Judge0 Python
32+
SDK to facilitate the development of your own product see In Depth guide and
33+
Examples.
34+
35+
Getting Involved
36+
----------------
37+
38+
TODO
39+
40+
.. toctree::
41+
:caption: Getting Involved
42+
:glob:
43+
:titlesonly:
44+
:hidden:
45+
46+
contributors_guide/index
47+
448
.. toctree::
5-
:maxdepth: 2
6-
:caption: Contents
49+
:caption: API
50+
:glob:
51+
:titlesonly:
52+
:hidden:
753

8-
api_index
9-
contributing
54+
api/index

src/judge0/clients.py

Lines changed: 61 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional, Union
1+
from typing import ClassVar, Optional, Union
22

33
import requests
44

@@ -10,7 +10,7 @@
1010

1111

1212
class Client:
13-
API_KEY_ENV = None
13+
API_KEY_ENV: ClassVar[str] = None
1414

1515
def __init__(
1616
self,
@@ -280,7 +280,7 @@ def get_submissions(
280280
class ATD(Client):
281281
"""Base class for all AllThingsDev clients."""
282282

283-
API_KEY_ENV = "JUDGE0_ATD_API_KEY"
283+
API_KEY_ENV: ClassVar[str] = "JUDGE0_ATD_API_KEY"
284284

285285
def __init__(self, endpoint, host_header_value, api_key, **kwargs):
286286
self.api_key = api_key
@@ -300,21 +300,31 @@ def _update_endpoint_header(self, header_value):
300300
class ATDJudge0CE(ATD):
301301
"""AllThingsDev client for CE flavor."""
302302

303-
DEFAULT_ENDPOINT: str = "https://judge0-ce.proxy-production.allthingsdev.co"
304-
DEFAULT_HOST: str = "Judge0-CE.allthingsdev.co"
305-
HOME_URL: str = (
303+
DEFAULT_ENDPOINT: ClassVar[str] = (
304+
"https://judge0-ce.proxy-production.allthingsdev.co"
305+
)
306+
DEFAULT_HOST: ClassVar[str] = "Judge0-CE.allthingsdev.co"
307+
HOME_URL: ClassVar[str] = (
306308
"https://www.allthingsdev.co/apimarketplace/judge0-ce/66b683c8b7b7ad054eb6ff8f"
307309
)
308310

309-
DEFAULT_ABOUT_ENDPOINT: str = "01fc1c98-ceee-4f49-8614-f2214703e25f"
310-
DEFAULT_CONFIG_INFO_ENDPOINT: str = "b7aab45d-5eb0-4519-b092-89e5af4fc4f3"
311-
DEFAULT_LANGUAGE_ENDPOINT: str = "a50ae6b1-23c1-40eb-b34c-88bc8cf2c764"
312-
DEFAULT_LANGUAGES_ENDPOINT: str = "03824deb-bd18-4456-8849-69d78e1383cc"
313-
DEFAULT_STATUSES_ENDPOINT: str = "c37b603f-6f99-4e31-a361-7154c734f19b"
314-
DEFAULT_CREATE_SUBMISSION_ENDPOINT: str = "6e65686d-40b0-4bf7-a12f-1f6d033c4473"
315-
DEFAULT_GET_SUBMISSION_ENDPOINT: str = "b7032b8b-86da-40b4-b9d3-b1f5e2b4ee1e"
316-
DEFAULT_CREATE_SUBMISSIONS_ENDPOINT: str = "402b857c-1126-4450-bfd8-22e1f2cbff2f"
317-
DEFAULT_GET_SUBMISSIONS_ENDPOINT: str = "e42f2a26-5b02-472a-80c9-61c4bdae32ec"
311+
DEFAULT_ABOUT_ENDPOINT: ClassVar[str] = "01fc1c98-ceee-4f49-8614-f2214703e25f"
312+
DEFAULT_CONFIG_INFO_ENDPOINT: ClassVar[str] = "b7aab45d-5eb0-4519-b092-89e5af4fc4f3"
313+
DEFAULT_LANGUAGE_ENDPOINT: ClassVar[str] = "a50ae6b1-23c1-40eb-b34c-88bc8cf2c764"
314+
DEFAULT_LANGUAGES_ENDPOINT: ClassVar[str] = "03824deb-bd18-4456-8849-69d78e1383cc"
315+
DEFAULT_STATUSES_ENDPOINT: ClassVar[str] = "c37b603f-6f99-4e31-a361-7154c734f19b"
316+
DEFAULT_CREATE_SUBMISSION_ENDPOINT: ClassVar[str] = (
317+
"6e65686d-40b0-4bf7-a12f-1f6d033c4473"
318+
)
319+
DEFAULT_GET_SUBMISSION_ENDPOINT: ClassVar[str] = (
320+
"b7032b8b-86da-40b4-b9d3-b1f5e2b4ee1e"
321+
)
322+
DEFAULT_CREATE_SUBMISSIONS_ENDPOINT: ClassVar[str] = (
323+
"402b857c-1126-4450-bfd8-22e1f2cbff2f"
324+
)
325+
DEFAULT_GET_SUBMISSIONS_ENDPOINT: ClassVar[str] = (
326+
"e42f2a26-5b02-472a-80c9-61c4bdae32ec"
327+
)
318328

319329
def __init__(self, api_key, **kwargs):
320330
super().__init__(
@@ -374,22 +384,32 @@ def get_submissions(
374384
class ATDJudge0ExtraCE(ATD):
375385
"""AllThingsDev client for Extra CE flavor."""
376386

377-
DEFAULT_ENDPOINT: str = "https://judge0-extra-ce.proxy-production.allthingsdev.co"
378-
DEFAULT_HOST: str = "Judge0-Extra-CE.allthingsdev.co"
379-
HOME_URL: str = (
387+
DEFAULT_ENDPOINT: ClassVar[str] = (
388+
"https://judge0-extra-ce.proxy-production.allthingsdev.co"
389+
)
390+
DEFAULT_HOST: ClassVar[str] = "Judge0-Extra-CE.allthingsdev.co"
391+
HOME_URL: ClassVar[str] = (
380392
"https://www.allthingsdev.co/apimarketplace/judge0-extra-ce/"
381393
"66b68838b7b7ad054eb70690"
382394
)
383395

384-
DEFAULT_ABOUT_ENDPOINT: str = "1fd631a1-be6a-47d6-bf4c-987e357e3096"
385-
DEFAULT_CONFIG_INFO_ENDPOINT: str = "46e05354-2a43-436a-9458-5d111456f0ff"
386-
DEFAULT_LANGUAGE_ENDPOINT: str = "10465a84-2a2c-4213-845f-45e3c04a5867"
387-
DEFAULT_LANGUAGES_ENDPOINT: str = "774ecece-1200-41f7-a992-38f186c90803"
388-
DEFAULT_STATUSES_ENDPOINT: str = "a2843b3c-673d-4966-9a14-2e7d76dcd0cb"
389-
DEFAULT_CREATE_SUBMISSION_ENDPOINT: str = "be2d195e-dd58-4770-9f3c-d6c0fbc2b6e5"
390-
DEFAULT_GET_SUBMISSION_ENDPOINT: str = "c3a457cd-37a6-4106-97a8-9e60a223abbc"
391-
DEFAULT_CREATE_SUBMISSIONS_ENDPOINT: str = "c64df5d3-edfd-4b08-8687-561af2f80d2f"
392-
DEFAULT_GET_SUBMISSIONS_ENDPOINT: str = "5d173718-8e6a-4cf5-9d8c-db5e6386d037"
396+
DEFAULT_ABOUT_ENDPOINT: ClassVar[str] = "1fd631a1-be6a-47d6-bf4c-987e357e3096"
397+
DEFAULT_CONFIG_INFO_ENDPOINT: ClassVar[str] = "46e05354-2a43-436a-9458-5d111456f0ff"
398+
DEFAULT_LANGUAGE_ENDPOINT: ClassVar[str] = "10465a84-2a2c-4213-845f-45e3c04a5867"
399+
DEFAULT_LANGUAGES_ENDPOINT: ClassVar[str] = "774ecece-1200-41f7-a992-38f186c90803"
400+
DEFAULT_STATUSES_ENDPOINT: ClassVar[str] = "a2843b3c-673d-4966-9a14-2e7d76dcd0cb"
401+
DEFAULT_CREATE_SUBMISSION_ENDPOINT: ClassVar[str] = (
402+
"be2d195e-dd58-4770-9f3c-d6c0fbc2b6e5"
403+
)
404+
DEFAULT_GET_SUBMISSION_ENDPOINT: ClassVar[str] = (
405+
"c3a457cd-37a6-4106-97a8-9e60a223abbc"
406+
)
407+
DEFAULT_CREATE_SUBMISSIONS_ENDPOINT: ClassVar[str] = (
408+
"c64df5d3-edfd-4b08-8687-561af2f80d2f"
409+
)
410+
DEFAULT_GET_SUBMISSIONS_ENDPOINT: ClassVar[str] = (
411+
"5d173718-8e6a-4cf5-9d8c-db5e6386d037"
412+
)
393413

394414
def __init__(self, api_key, **kwargs):
395415
super().__init__(
@@ -449,7 +469,7 @@ def get_submissions(
449469
class Rapid(Client):
450470
"""Base class for all RapidAPI clients."""
451471

452-
API_KEY_ENV = "JUDGE0_RAPID_API_KEY"
472+
API_KEY_ENV: ClassVar[str] = "JUDGE0_RAPID_API_KEY"
453473

454474
def __init__(self, endpoint, host_header_value, api_key, **kwargs):
455475
self.api_key = api_key
@@ -466,9 +486,9 @@ def __init__(self, endpoint, host_header_value, api_key, **kwargs):
466486
class RapidJudge0CE(Rapid):
467487
"""RapidAPI client for CE flavor."""
468488

469-
DEFAULT_ENDPOINT: str = "https://judge0-ce.p.rapidapi.com"
470-
DEFAULT_HOST: str = "judge0-ce.p.rapidapi.com"
471-
HOME_URL: str = "https://rapidapi.com/judge0-official/api/judge0-ce"
489+
DEFAULT_ENDPOINT: ClassVar[str] = "https://judge0-ce.p.rapidapi.com"
490+
DEFAULT_HOST: ClassVar[str] = "judge0-ce.p.rapidapi.com"
491+
HOME_URL: ClassVar[str] = "https://rapidapi.com/judge0-official/api/judge0-ce"
472492

473493
def __init__(self, api_key, **kwargs):
474494
super().__init__(
@@ -482,9 +502,9 @@ def __init__(self, api_key, **kwargs):
482502
class RapidJudge0ExtraCE(Rapid):
483503
"""RapidAPI client for Extra CE flavor."""
484504

485-
DEFAULT_ENDPOINT: str = "https://judge0-extra-ce.p.rapidapi.com"
486-
DEFAULT_HOST: str = "judge0-extra-ce.p.rapidapi.com"
487-
HOME_URL: str = "https://rapidapi.com/judge0-official/api/judge0-extra-ce"
505+
DEFAULT_ENDPOINT: ClassVar[str] = "https://judge0-extra-ce.p.rapidapi.com"
506+
DEFAULT_HOST: ClassVar[str] = "judge0-extra-ce.p.rapidapi.com"
507+
HOME_URL: ClassVar[str] = "https://rapidapi.com/judge0-official/api/judge0-extra-ce"
488508

489509
def __init__(self, api_key, **kwargs):
490510
super().__init__(
@@ -498,7 +518,7 @@ def __init__(self, api_key, **kwargs):
498518
class Sulu(Client):
499519
"""Base class for all Sulu clients."""
500520

501-
API_KEY_ENV = "JUDGE0_SULU_API_KEY"
521+
API_KEY_ENV: ClassVar[str] = "JUDGE0_SULU_API_KEY"
502522

503523
def __init__(self, endpoint, api_key=None, **kwargs):
504524
self.api_key = api_key
@@ -512,8 +532,8 @@ def __init__(self, endpoint, api_key=None, **kwargs):
512532
class SuluJudge0CE(Sulu):
513533
"""Sulu client for CE flavor."""
514534

515-
DEFAULT_ENDPOINT: str = "https://judge0-ce.p.sulu.sh"
516-
HOME_URL: str = "https://sparkhub.sulu.sh/apis/judge0/judge0-ce/readme"
535+
DEFAULT_ENDPOINT: ClassVar[str] = "https://judge0-ce.p.sulu.sh"
536+
HOME_URL: ClassVar[str] = "https://sparkhub.sulu.sh/apis/judge0/judge0-ce/readme"
517537

518538
def __init__(self, api_key=None, **kwargs):
519539
super().__init__(
@@ -526,8 +546,10 @@ def __init__(self, api_key=None, **kwargs):
526546
class SuluJudge0ExtraCE(Sulu):
527547
"""Sulu client for Extra CE flavor."""
528548

529-
DEFAULT_ENDPOINT: str = "https://judge0-extra-ce.p.sulu.sh"
530-
HOME_URL: str = "https://sparkhub.sulu.sh/apis/judge0/judge0-extra-ce/readme"
549+
DEFAULT_ENDPOINT: ClassVar[str] = "https://judge0-extra-ce.p.sulu.sh"
550+
HOME_URL: ClassVar[str] = (
551+
"https://sparkhub.sulu.sh/apis/judge0/judge0-extra-ce/readme"
552+
)
531553

532554
def __init__(self, api_key=None, **kwargs):
533555
super().__init__(self.DEFAULT_ENDPOINT, api_key, **kwargs)

0 commit comments

Comments
 (0)
0