From 38d66efdb90532835a07f825d3948c3e0dc87bb6 Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 01:09:12 -0500 Subject: [PATCH 1/8] Fix some type issues and start work on removing old docs and implementing new --- helldivepy/enums.py | 15 ++++++--------- helldivepy/models.py | 11 +++-------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/helldivepy/enums.py b/helldivepy/enums.py index 2e32368..d7c191e 100644 --- a/helldivepy/enums.py +++ b/helldivepy/enums.py @@ -1,8 +1,6 @@ from enum import Enum import typing -# {"1": "race", "2": "unknown", "3": "goal", "11": "liberate", "12": "planet_index"} - class BetterEnum(Enum): @classmethod @@ -13,14 +11,9 @@ def parse(cls, value): return None -class CampaignTypes(BetterEnum): - - LIBERATION_DEFENSE = 0 - RECON = 1 - STORY = 2 - - class ValueTypes(BetterEnum): + """Types of values returned from the major order/assignments endpoint.""" + RACE = 1 UNKNOWN = 2 TARGET_COUNT = 3 @@ -31,10 +24,14 @@ class ValueTypes(BetterEnum): class RewardTypes(BetterEnum): + """Types of rewards given out by the major order/assignments.""" + MEDALS = 1 class AssignmentTypes(BetterEnum): + """Types of assignments.""" + ERADICATE = 3 LIBERATION = 11 DEFENSE = 12 diff --git a/helldivepy/models.py b/helldivepy/models.py index 261f705..9c76289 100644 --- a/helldivepy/models.py +++ b/helldivepy/models.py @@ -66,7 +66,7 @@ class PlanetEvent(BaseModel): """An event on a planet.""" id: int - event_type: typing.Literal[1] = Field(alias="eventType") + event_type: int = Field(alias="eventType") faction: enums.FactionType health: int max_health: int = Field(alias="maxHealth") @@ -179,7 +179,7 @@ def model_post_init(self, __context: typing.Any) -> None: for k, v in zip(self.value_types, self.values): match k: case enums.ValueTypes.PLANET: - self.data.planet = client.planets.get_planet(v, cached=True) + self.data.planet = client.planets.get_planet(v) case enums.ValueTypes.RACE: self.data.race = utils.parse_faction(v) case enums.ValueTypes.TARGET_COUNT: @@ -189,12 +189,7 @@ def model_post_init(self, __context: typing.Any) -> None: class AssignmentReward(BaseModel): - """ - A reward in an assignment\n - Medals: 1 - """ - - type: typing.Literal[1] + type: int amount: int From 3b75ef2896a9f80876ab997078935ca6cf210776 Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 01:25:28 -0500 Subject: [PATCH 2/8] Add Documentation to most models --- helldivepy/enums.py | 10 ++ helldivepy/models.py | 255 ++++++++++++++++++++++++++++++++++++++----- 2 files changed, 237 insertions(+), 28 deletions(-) diff --git a/helldivepy/enums.py b/helldivepy/enums.py index d7c191e..938b499 100644 --- a/helldivepy/enums.py +++ b/helldivepy/enums.py @@ -1,6 +1,8 @@ from enum import Enum import typing +# {"1": "race", "2": "unknown", "3": "goal", "11": "liberate", "12": "planet_index"} + class BetterEnum(Enum): @classmethod @@ -11,6 +13,14 @@ def parse(cls, value): return None +class CampaignTypes(BetterEnum): + """Types of campaigns in the game""" + + LIBERATION_DEFENSE = 0 + RECON = 1 + STORY = 2 + + class ValueTypes(BetterEnum): """Types of values returned from the major order/assignments endpoint.""" diff --git a/helldivepy/models.py b/helldivepy/models.py index 9c76289..0d7d891 100644 --- a/helldivepy/models.py +++ b/helldivepy/models.py @@ -3,15 +3,46 @@ import typing import helldivepy.enums as enums import helldivepy.utils as utils +import helldivepy.constants as constants class APIURLConfiguration(BaseModel): - diveharder: str - community: str + """Configuration for API endpoints. + + Contains URLs for different API services used by the application. + + Attributes: + diveharder (str): Base URL for the Diveharder API endpoint. + community (str): Base URL for the Community API endpoint. + """ + + diveharder: str = constants.OFFICIAL_DIVEHARDER_URL + community: str = constants.OFFICIAL_COMMUNITY_URL class Statistics(BaseModel): - """The statistics of a player.""" + """War statistics tracking various gameplay metrics. + + Tracks mission outcomes, combat statistics, and player performance metrics + for the current war campaign. + + Attributes: + missions_won (int): Number of successfully completed missions. + missions_lost (int): Number of failed missions. + mission_time (int): Total time spent in missions (seconds). + terminid_kills (int): Number of Terminid enemies eliminated. + automaton_kills (int): Number of Automaton enemies eliminated. + illuminate_kills (int): Number of Illuminate enemies eliminated. + bullets_fired (int): Total ammunition expended. + bullets_hit (int): Total successful hits on targets. + time_played (int): Total gameplay duration (seconds). + deaths (int): Total player deaths. + revives (int): Total teammate revivals performed. + friendlies (int): Total friendly fire incidents. + mission_success_rate (float): Percentage of successful missions. + accuracy (int): Overall shooting accuracy percentage. + player_count (int): Current number of active players. + """ missions_won: int = Field(alias="missionsWon") missions_lost: int = Field(alias="missionsLost") @@ -31,7 +62,19 @@ class Statistics(BaseModel): class WarInfo(BaseModel): - """The information about the current war.""" + """Information about the current galactic war. + + Contains timing information, client details, and overall war statistics. + + Attributes: + started (datetime): War start timestamp. + ended (datetime): War end timestamp. + now (datetime): Current war time. + client_version (str): Game client version. + factions (list[str]): List of participating factions. + impact_multiplier (float): Current war impact multiplier. + statistics (Statistics): Comprehensive war statistics. + """ started: datetime ended: datetime @@ -43,7 +86,16 @@ class WarInfo(BaseModel): class Dispatch(BaseModel): - """The information about the current war.""" + """War dispatch message container. + + Represents official communications during the war campaign. + + Attributes: + id (int): Unique dispatch identifier. + published (datetime): Dispatch publication timestamp. + type (Literal[0]): Message type identifier. + message (str): Dispatch content. + """ id: int published: datetime @@ -52,7 +104,18 @@ class Dispatch(BaseModel): class SteamNews(BaseModel): - """Steam patchh notes.""" + """Steam platform update information. + + Contains details about game patches and updates published on Steam. + + Attributes: + id (str): Unique news article identifier. + title (str): Update title. + url (str): Full update documentation URL. + author (str): Update author. + content (str): Update content. + published_at (datetime): Publication timestamp. + """ id: str title: str @@ -63,7 +126,21 @@ class SteamNews(BaseModel): class PlanetEvent(BaseModel): - """An event on a planet.""" + """Planetary event information. + + Tracks events affecting individual planets during the war. + + Attributes: + id (int): Unique event identifier. + event_type (int): Type of planetary event. + faction (FactionType): Associated faction. + health (int): Current planet health. + max_health (int): Maximum planet health. + start_time (datetime): Event start timestamp. + end_time (datetime): Event end timestamp. + campaign_id (int): Associated campaign identifier. + joint_operation_ids (list[int]): Related joint operation identifiers. + """ id: int event_type: int = Field(alias="eventType") @@ -77,6 +154,11 @@ class PlanetEvent(BaseModel): @property def planet(self) -> "Planet | None": + """Retrieves the planet associated with this event. + + Returns: + Planet | None: Associated planet object if available, None otherwise. + """ from helldivepy import ApiClient if ApiClient._instance: @@ -85,28 +167,71 @@ def planet(self) -> "Planet | None": class Position(BaseModel): - """A position in the game.""" + """2D coordinate position. + + Represents a location in 2D space. + + Attributes: + x (float): Horizontal coordinate. + y (float): Vertical coordinate. + """ x: float y: float class PlanetaryHazard(BaseModel): - """A hazard on a planet.""" + """Planetary environmental hazard. + + Describes environmental dangers present on a planet. + + Attributes: + name (str): Hazard identifier. + description (str): Detailed hazard description. + """ name: str description: str class Biome(BaseModel): - """A biome on a planet.""" + """Planetary biome characteristics. + + Describes the environmental characteristics of a planet. + + Attributes: + name (str): Biome identifier. + description (str): Detailed biome description. + """ name: str description: str class Planet(BaseModel): - """A planet in the game.""" + """Planetary information and status. + + Contains comprehensive information about a planet in the war. + + Attributes: + index (int): Planet index number. + name (str): Planet name. + sector (str): Galactic sector location. + biome (Biome): Planet's biome characteristics. + hazards (list[PlanetaryHazard]): Environmental hazards. + hash (int): Unique planet identifier. + position (Position): Galactic coordinates. + waypoints (list[int]): Planetary waypoints. + max_health (int): Maximum planetary health. + health (int): Current planetary health. + disabled (bool): Planet accessibility status. + initial_owner (FactionType): Original controlling faction. + current_owner (FactionType): Current controlling faction. + regen_per_second (float): Health regeneration rate. + event (PlanetEvent | None): Current planetary event. + statistics (Statistics): Planet-specific statistics. + attacking (list[int]): Attacking force identifiers. + """ index: int name: str @@ -119,9 +244,7 @@ class Planet(BaseModel): max_health: int = Field(alias="maxHealth") health: int disabled: bool - initial_owner: enums.FactionType = Field( - alias="initialOwner", - ) + initial_owner: enums.FactionType = Field(alias="initialOwner") current_owner: enums.FactionType = Field(alias="currentOwner") regen_per_second: float = Field(alias="regenPerSecond") event: PlanetEvent | None @@ -130,13 +253,13 @@ class Planet(BaseModel): @property def has_space_station(self) -> bool: - """Checks if a space station is on this planet. - - Raises: - RuntimeError: In the very rare case that the `ApiClient` is not initialized this will be raised. + """Checks for presence of an orbital space station. Returns: - bool: If the space station is on the planet + bool: True if a space station is present, False otherwise. + + Raises: + RuntimeError: If ApiClient is not properly initialized. """ from helldivepy import ApiClient @@ -144,15 +267,22 @@ def has_space_station(self) -> bool: raise RuntimeError("ApiClient not initialized.") client = ApiClient._instance - stations = client.space_stations.get_space_stations() - if self.index in [i.planet.index for i in stations]: - return True - - return False + return self.index in [i.planet.index for i in stations] class AssignmentTaskData(BaseModel): + """Assignment task specific data. + + Contains details about objectives for an assignment task. + + Attributes: + liberate (bool | None): Planet liberation objective flag. + planet (Planet | None): Target planet for assignment. + target_count (int | None): Required objective count. + race (FactionType | None): Target faction type. + """ + liberate: bool | None planet: Planet | None target_count: int | None @@ -160,7 +290,16 @@ class AssignmentTaskData(BaseModel): class AssignmentTask(BaseModel): - """A task in an assignment""" + """Individual assignment task details. + + Represents a single task within an assignment. + + Attributes: + type (AssignmentTypes): Task type classification. + values (list[int]): Task-specific values. + value_types (list[ValueTypes]): Types of provided values. + data (AssignmentTaskData): Associated task data. + """ type: enums.AssignmentTypes values: list[int] @@ -170,6 +309,14 @@ class AssignmentTask(BaseModel): ) def model_post_init(self, __context: typing.Any) -> None: + """Initializes task data after model creation. + + Args: + __context (Any): Initialization context data. + + Raises: + ValueError: If ApiClient is not properly initialized. + """ from helldivepy.api_client import ApiClient client = ApiClient._instance @@ -189,12 +336,34 @@ def model_post_init(self, __context: typing.Any) -> None: class AssignmentReward(BaseModel): + """Assignment completion reward. + + Details about rewards given for completing an assignment. + + Attributes: + type (int): Reward type identifier. + amount (int): Reward quantity. + """ + type: int amount: int class Assignment(BaseModel): - """An assignment (Major Order)""" + """Major Order assignment information. + + Contains complete information about a mission assignment. + + Attributes: + id (int): Unique assignment identifier. + progress (list[int]): Task completion progress. + title (str | None): Assignment title. + briefing (str | None): Mission briefing text. + description (str | None): Detailed assignment description. + tasks (list[AssignmentTask]): Required tasks. + reward (AssignmentReward): Completion reward. + expiration (datetime): Assignment expiration time. + """ id: int progress: list[int] @@ -207,25 +376,55 @@ class Assignment(BaseModel): @property def is_complete(self) -> bool: + """Checks if all assignment tasks are complete. + + Returns: + bool: True if all tasks meet their target count, False otherwise. + """ return all( task.data.target_count == self.progress[index] for index, task in enumerate(self.tasks) ) def __str__(self) -> str: + """Creates a string representation of the assignment. + + Returns: + str: Assignment title and briefing summary. + """ return f"{self.title} - {self.briefing}" class Campaign(BaseModel): - """A campaign or battle in the game.""" + """Campaign battle information. + + Contains details about a specific war campaign. + + Attributes: + id (int): Unique campaign identifier. + planet (Planet): Campaign target planet. + type (int): Campaign classification. + count (int): Number of battles in campaign. + """ id: int planet: Planet - type: int + type: enums.CampaignTypes count: int class SpaceStation(BaseModel): + """Orbital space station information. + + Contains details about a planetary space station. + + Attributes: + id (int): Unique station identifier. + planet (Planet): Host planet. + election_end (datetime): Station election period end time. + flags (int): Station status flags. + """ + id: int = Field(alias="id32") planet: Planet election_end: datetime = Field(alias="electionEnd") From 1abbd58b09629b3b4424e72d77140a60bb8b36be Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 01:42:17 -0500 Subject: [PATCH 3/8] Add Autodocs --- docs/api/constants.md | 5 +++++ docs/api/enums.md | 5 +++++ docs/api/index.md | 5 +++++ docs/api/models.md | 5 +++++ docs/api/routes.md | 5 +++++ docs/api/utils.md | 5 +++++ docs/index.md | 0 mkdocs.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ pyproject.toml | 5 +++++ 9 files changed, 78 insertions(+) create mode 100644 docs/api/constants.md create mode 100644 docs/api/enums.md create mode 100644 docs/api/index.md create mode 100644 docs/api/models.md create mode 100644 docs/api/routes.md create mode 100644 docs/api/utils.md create mode 100644 docs/index.md create mode 100644 mkdocs.yml diff --git a/docs/api/constants.md b/docs/api/constants.md new file mode 100644 index 0000000..94d461e --- /dev/null +++ b/docs/api/constants.md @@ -0,0 +1,5 @@ +# Constants + +::: helldivepy.constants + options: + show_source: false \ No newline at end of file diff --git a/docs/api/enums.md b/docs/api/enums.md new file mode 100644 index 0000000..f215cf7 --- /dev/null +++ b/docs/api/enums.md @@ -0,0 +1,5 @@ +# Enums + +::: helldivepy.enums + options: + show_source: false \ No newline at end of file diff --git a/docs/api/index.md b/docs/api/index.md new file mode 100644 index 0000000..c13b7c2 --- /dev/null +++ b/docs/api/index.md @@ -0,0 +1,5 @@ +# API Reference + +::: helldivepy + options: + show_source: false \ No newline at end of file diff --git a/docs/api/models.md b/docs/api/models.md new file mode 100644 index 0000000..a656c02 --- /dev/null +++ b/docs/api/models.md @@ -0,0 +1,5 @@ +# Models + +::: helldivepy.models + options: + show_source: false \ No newline at end of file diff --git a/docs/api/routes.md b/docs/api/routes.md new file mode 100644 index 0000000..091d034 --- /dev/null +++ b/docs/api/routes.md @@ -0,0 +1,5 @@ +# Routes + +::: helldivepy.api + options: + show_source: false \ No newline at end of file diff --git a/docs/api/utils.md b/docs/api/utils.md new file mode 100644 index 0000000..db52fb1 --- /dev/null +++ b/docs/api/utils.md @@ -0,0 +1,5 @@ +# Utils + +::: helldivepy.utils + options: + show_source: false \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..e69de29 diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..9c44d69 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,43 @@ +# mkdocs.yml +site_name: Helldive.py +theme: + name: material + palette: + primary: indigo + accent: indigo +plugins: + - search + - mkdocstrings: + default_handler: python + handlers: + python: + paths: [./] # Path to your source code + options: + members: true + members_order: source + show_source: true + show_root_heading: true + show_root_full_path: true + show_root_members_full_path: true + show_object_full_path: true + show_category_heading: true + show_if_no_docstring: true + filters: + - "!^_" # Exclude private members (starting with underscore) + - "!^__" # Exclude special members (starting with double underscore) + docstring_section_style: spacy + merge_init_into_class: true + show_signature: true + show_signature_annotations: true + separate_signature: true + docstring_style: google +nav: + - Home: index.md + - API Reference: + - Overview: api/index.md + - Module Name: + - api/constants.md + - api/enums.md + - api/models.md + - api/routes.md + - api/utils.md \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 85464c2..e9d8c6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,11 @@ black = "^24.10.0" flake8 = "^7.1.1" +[tool.poetry.group.dev.dependencies] +mkdocs = "^1.6.1" +mkdocstrings = {extras = ["python"], version = "^0.27.0"} +mkdocs-material = "^9.5.49" + [build-system] requires = ["poetry-core>=1.0.0"] build-backend = "poetry.core.masonry.api" \ No newline at end of file From 0d4f0b6e08e4a7b837af4832963f094a5f031372 Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 01:43:01 -0500 Subject: [PATCH 4/8] Fix some formatting issues --- docs/api/constants.md | 2 +- docs/api/enums.md | 2 +- docs/api/index.md | 2 +- docs/api/models.md | 2 +- docs/api/routes.md | 2 +- docs/api/utils.md | 2 +- helldivepy/utils.py | 4 +--- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/api/constants.md b/docs/api/constants.md index 94d461e..8b3224f 100644 --- a/docs/api/constants.md +++ b/docs/api/constants.md @@ -2,4 +2,4 @@ ::: helldivepy.constants options: - show_source: false \ No newline at end of file + show_source: false diff --git a/docs/api/enums.md b/docs/api/enums.md index f215cf7..ddb1c43 100644 --- a/docs/api/enums.md +++ b/docs/api/enums.md @@ -2,4 +2,4 @@ ::: helldivepy.enums options: - show_source: false \ No newline at end of file + show_source: false diff --git a/docs/api/index.md b/docs/api/index.md index c13b7c2..b234b65 100644 --- a/docs/api/index.md +++ b/docs/api/index.md @@ -2,4 +2,4 @@ ::: helldivepy options: - show_source: false \ No newline at end of file + show_source: false diff --git a/docs/api/models.md b/docs/api/models.md index a656c02..9e43267 100644 --- a/docs/api/models.md +++ b/docs/api/models.md @@ -2,4 +2,4 @@ ::: helldivepy.models options: - show_source: false \ No newline at end of file + show_source: false diff --git a/docs/api/routes.md b/docs/api/routes.md index 091d034..65e763e 100644 --- a/docs/api/routes.md +++ b/docs/api/routes.md @@ -2,4 +2,4 @@ ::: helldivepy.api options: - show_source: false \ No newline at end of file + show_source: false diff --git a/docs/api/utils.md b/docs/api/utils.md index db52fb1..7c91fb0 100644 --- a/docs/api/utils.md +++ b/docs/api/utils.md @@ -2,4 +2,4 @@ ::: helldivepy.utils options: - show_source: false \ No newline at end of file + show_source: false diff --git a/helldivepy/utils.py b/helldivepy/utils.py index 2814a35..1cb307a 100644 --- a/helldivepy/utils.py +++ b/helldivepy/utils.py @@ -13,9 +13,7 @@ def hdml_to_md(text: str) -> str: Returns: str: The input string converted to Markdown format. - Example: - >>> hdml_to_md("Hello World") - "[b]Hello[/b] [yellow]World[/yellow]" + """ pattern = r"(.*?)<\/i(?:=\1)?>" From 22e8dc3f13d920929612fb0ef2bc0038aa3a8b98 Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 01:44:04 -0500 Subject: [PATCH 5/8] Add documentation workflow --- .github/workflows/documentation.yml | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/documentation.yml diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000..6555e77 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,36 @@ +# .github/workflows/documentation.yml +name: documentation + +on: + push: + branches: + - main # Set this to your default branch + pull_request: + branches: + - main + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.2.2 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5.3.0 + with: + python-version: "3.x" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install mkdocs-material mkdocstrings[python] # Add any other dependencies you need + + - name: Deploy documentation + run: mkdocs gh-deploy --force + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0b6645a42c6c54119b5e6ff0b42913db836fc284 Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 02:48:21 -0500 Subject: [PATCH 6/8] Start mkdocs documentation --- docs/index.md | 57 ++++++++++++++++++++++++++++++++++++++++++++ docs/installation.md | 25 +++++++++++++++++++ mkdocs.yml | 46 ++++++++++++++++++++++++++++++----- pyproject.toml | 2 ++ 4 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 docs/installation.md diff --git a/docs/index.md b/docs/index.md index e69de29..eabd77a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -0,0 +1,57 @@ +--- +icon: material/human-greeting +--- +# Helldive.py + +[![PyPI](https://img.shields.io/pypi/v/helldivepy.svg?label=PyPI&color=blue)](https://pypi.org/project/helldivepy/) +![PyPI - Downloads](https://img.shields.io/pypi/dm/helldivepy?color=brightgreen) +![GitHub License](https://img.shields.io/github/license/ajxd2/helldive.py?color=yellow) +[![Python Versions](https://img.shields.io/pypi/pyversions/helldivepy.svg?color=orange)](https://pypi.org/project/helldivepy/) +![GitHub contributors](https://img.shields.io/github/contributors/ajxd2/helldive.py?color=ff69b4) + +> A simple Python library for diving deep into the [Helldivers Community API](https://github.com/helldivers-2/api) and [Diveharder API](https://github.com/helldivers-2/diveharder_api.py). + +--- + +## ⚙️ Installation + +To install **Helldive.py**, just use pip: + +```sh +pip install helldivepy +``` + +## 🚀 Quickstart + +Here's a super-quick example to get you diving right in: + +```py +import helldivepy + +client = helldivepy.ApiClient(user_agent="my-app", user_contact="email@example.com") + +# Get the latest dispatches +dispatches = client.dispatch.get_dispatches() + +print(dispatches) +# Output example +[ + Dispatch(id=0, published=datetime.datetime, type=0, message='Hello, World 1!'), + Dispatch(id=1, published=datetime.datetime, type=0, message='Hello, World 2!'), + Dispatch(id=2, published=datetime.datetime, type=0, message='Hello, World 3!') + ] +``` + +## 🌟 Features + +- **Easy API Access**: Communicate with the Helldivers Community API and Diveharder API without breaking a sweat. +- **Typed Data**: Get structured, easily readable data like dispatches, planets, and more! +- **Perfect for Projects**: Ideal for projects, bots, or just exploring Helldivers data. + +--- + +## 🔗 Links + +- [DiveHarder](https://github.com/helldivers-2/diveharder_api.py) +- [Community API](https://github.com/helldivers-2/api) +- [API discussion Discord](https://discord.gg/MThYGMCqgp) diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..ba6cb6c --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,25 @@ +--- +icon: material/download +--- +# ⚙️ Installation + +To install **Helldive.py**, just use pip, poetry or uv: + +```bash +pip install helldivepy +poetry add helldvivepy +uv add helldivepy +``` + +Example code: + +```py +from helldivepy import ApiClient + +client = ApiClient( + user_agent="Hello-World", + user_contact="example@example.com | discord:exampleuser123", +) + +print(client.get_war_info()) +``` diff --git a/mkdocs.yml b/mkdocs.yml index 9c44d69..91a0c53 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,11 +1,29 @@ # mkdocs.yml site_name: Helldive.py -theme: +site_description: Docs for the helldive.py library. +site_author: AJXD2 +site_url: https://ajxd2.github.io/helldive.py/ + +repo_name: ajxd2/helldive.py +repo_url: https://github.com/ajxd2/helldive.py + + +theme: name: material + icon: + logo: material/cog + language: en + features: + - navigation.sections + - navigation.tabs + - content.code.copy + - content.code.select palette: - primary: indigo - accent: indigo + scheme: slate + primary: teal + accent: teal plugins: + - search - mkdocstrings: default_handler: python @@ -32,12 +50,28 @@ plugins: separate_signature: true docstring_style: google nav: - - Home: index.md + - Home: + - Introduction: index.md + - Installation: installation.md + - API Reference: - Overview: api/index.md - - Module Name: + - Helldive.py: - api/constants.md - api/enums.md - api/models.md - api/routes.md - - api/utils.md \ No newline at end of file + - api/utils.md + +markdown_extensions: + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - admonition + - footnotes + - codehilite + - pymdownx.snippets + - pymdownx.inlinehilite + - pymdownx.details + - pymdownx.superfences \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e9d8c6e..93bd092 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,8 @@ flake8 = "^7.1.1" mkdocs = "^1.6.1" mkdocstrings = {extras = ["python"], version = "^0.27.0"} mkdocs-material = "^9.5.49" +pygments = "^2.18.0" +pymdown-extensions = "^10.12" [build-system] requires = ["poetry-core>=1.0.0"] From 692c986aeb53469950f277015b4e03785b3b303b Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 03:10:29 -0500 Subject: [PATCH 7/8] Do some more customizing. Add google analytics tag --- docs/images/favicon.png | Bin 0 -> 13725 bytes docs/index.md | 29 ---------------------- mkdocs.yml | 53 ++++++++++++++++++++++++++-------------- 3 files changed, 35 insertions(+), 47 deletions(-) create mode 100644 docs/images/favicon.png diff --git a/docs/images/favicon.png b/docs/images/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..4a343503544a73a22cb8ff9a0d13197e232e9fe6 GIT binary patch literal 13725 zcmXY2WmKI#kbZHvxI0|j-QD5h?(XhhD8=2~-QB%daV_>0iWIlvR-hD?-Lt=vNls=? zWG2bXGcjr^a;P985C8zE@(^ha0D$_aLIH@dAH`#U*#!XbSjkIEX!-rTDDXAY)FvKx zU7EAYvBtByq6i2>Sub|N#I;7I)RZ9Pgk28}g^>^sL0_koN@kga$Ap7jZ`Cyf6+D0b za{qY0c|dy#$!$N%|6_=OelV~Co;;Rm0Smp|4*~GvtS%d{;v|1R7)%0wDN(#o0RGJl z0N#f-L&5X`-15L5>{tO_h)S_2aH%;D6C95mtZ0S+lz3eO;4-M8EF-_NVz)8Y4`~sh zq2xUxz$79tsi-W=QJ7Cp|7wj7EM&)qN-|_FB`gtcQBJM_*CoV`NHCo#2yhWyYvxq= zW_zr6)sdl+&fvth+45cl;1n0==&5GCNP?{^5@7pN4-JmY*z42A*CicUfC;`A__fyv z2fTJ$;sT4aKcI%}Z~cK}(PNxKeE=K>M34akD^No{@#h4+hnPFfO|?McaAHC@N@kD5hXlaN1A5W; zpl6w$Y9m}Q3^-Sx3@GOV!rk=tr;c$?cW&aX5kC`%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zSM_Qpqc4GF|o`*g&obo3LM{SosWf%}Be$e7!O~ z=O;mh^-!4cXUbNG0g=V&brlaUAebd@GfCY>_lxtLkn`%$cg_v=XnHlmaO=0%%H|;lv~8o>infG7!EcgEdxUHokaK44zE2&fb00%wwYrF}$3JTD zY2qv(%bHeZtdxjh7$Xlal8*Q!^wja_CScd{;dFW~&W6I2ymfK=>_Ilp2Xo-E^v@Mk su- + We use cookies to recognize your repeated visits and preferences, as well + as to measure the effectiveness of our documentation and whether users + find what they're searching for. With your consent, you're helping us to + make our documentation better. + analytics: + provider: google + property: G-YS5CTZLJFE + +markdown_extensions: + - pymdownx.highlight: + anchor_linenums: true + line_spans: __span + pygments_lang_class: true + - admonition + - footnotes + - codehilite + - pymdownx.snippets + - pymdownx.inlinehilite + - pymdownx.details + - pymdownx.superfences + + + plugins: - - search - mkdocstrings: default_handler: python handlers: python: - paths: [./] # Path to your source code + paths: [./] options: members: true members_order: source @@ -41,8 +70,8 @@ plugins: show_category_heading: true show_if_no_docstring: true filters: - - "!^_" # Exclude private members (starting with underscore) - - "!^__" # Exclude special members (starting with double underscore) + - "!^_" + - "!^__" docstring_section_style: spacy merge_init_into_class: true show_signature: true @@ -63,15 +92,3 @@ nav: - api/routes.md - api/utils.md -markdown_extensions: - - pymdownx.highlight: - anchor_linenums: true - line_spans: __span - pygments_lang_class: true - - admonition - - footnotes - - codehilite - - pymdownx.snippets - - pymdownx.inlinehilite - - pymdownx.details - - pymdownx.superfences \ No newline at end of file From d2c7225e20af8673720b4909932508e653c30f2f Mon Sep 17 00:00:00 2001 From: AJXD2 Date: Tue, 17 Dec 2024 19:23:27 -0500 Subject: [PATCH 8/8] Add links page. Work a little more on the mkdocs config. Update installation.md --- docs/index.md | 2 +- docs/installation.md | 113 +++++++++++++++++++++++++++++++++++++------ docs/links.md | 13 +++++ mkdocs.yml | 29 +++++++++-- 4 files changed, 136 insertions(+), 21 deletions(-) create mode 100644 docs/links.md diff --git a/docs/index.md b/docs/index.md index 3e22d90..74f167f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -22,7 +22,7 @@ icon: material/human-greeting --- ## 🔗 Links - +- [Get Started](installation.md) - [DiveHarder](https://github.com/helldivers-2/diveharder_api.py) - [Community API](https://github.com/helldivers-2/api) - [API discussion Discord](https://discord.gg/MThYGMCqgp) diff --git a/docs/installation.md b/docs/installation.md index ba6cb6c..5f6f751 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,25 +1,106 @@ --- icon: material/download --- -# ⚙️ Installation +# 🚀 Get Started -To install **Helldive.py**, just use pip, poetry or uv: +## ⚙️ Installation -```bash -pip install helldivepy -poetry add helldvivepy -uv add helldivepy -``` +=== "Pip" -Example code: + ```sh + pip install helldivepy + ``` +=== "Poetry" + ??? note "Poetry" + Install poetry [here](https://python-poetry.org/docs/#installation). + ```sh + poetry add helldivepy + ``` -```py -from helldivepy import ApiClient +=== "UV" + ??? note "UV" + Install UV [here](https://docs.astral.sh/uv/getting-started/installation/). -client = ApiClient( - user_agent="Hello-World", - user_contact="example@example.com | discord:exampleuser123", -) + ```sh + uv add helldivepy + ``` -print(client.get_war_info()) -``` +Example code + +=== "Without Rich" + + ```py + from helldivepy import ApiClient + client = ApiClient( + user_agent="Hello-World", + user_contact="example@example.com | discord:exampleuser123", + ) + + print(client.get_war_info().model_dump()) + >>> + { + 'started': datetime.datetime(2024, 1, 23, 20, 5, 13, tzinfo=TzInfo(UTC)), + 'ended': datetime.datetime(2028, 2, 8, 20, 4, 55, tzinfo=TzInfo(UTC)), + 'now': datetime.datetime(1970, 11, 6, 14, 59, 50, tzinfo=TzInfo(UTC)), + 'client_version': '0.3.0', + 'factions': ['Humans', 'Terminids', 'Automaton', 'Illuminate'], + 'impact_multiplier': 0.034382936, + 'statistics': { + 'missions_won': 370390368, + 'missions_lost': 37224925, + 'mission_time': 1047433682627, + 'terminid_kills': 79906866134, + 'automaton_kills': 31552895947, + 'illuminate_kills': 3705435035, + 'bullets_fired': 571067857117, + 'bullets_hit': 645369797775, + 'time_played': 1047433682627, + 'deaths': 2564546790, + 'revives': 2, + 'friendlies': 361359530, + 'mission_success_rate': 90.0, + 'accuracy': 100, + 'player_count': 111316 + } + } + + ``` + +=== "With rich" + + ```py + from helldivepy import ApiClient + from rich import print + + client = ApiClient( + user_agent="Hello-World", + user_contact="example@example.com | discord:exampleuser123", + ) + + print(client.get_war_info()) + >>> WarInfo( + started=datetime.datetime(2024, 1, 23, 20, 5, 13, tzinfo=TzInfo(UTC)), + ended=datetime.datetime(2028, 2, 8, 20, 4, 55, tzinfo=TzInfo(UTC)), + now=datetime.datetime(1970, 11, 6, 14, 24, 40, tzinfo=TzInfo(UTC)), + client_version='0.3.0', + factions=['Humans', 'Terminids', 'Automaton', 'Illuminate'], + impact_multiplier=0.03595309, + statistics=Statistics( + missions_won=370353637, + missions_lost=37219878, + mission_time=1047300170684, + terminid_kills=79904593412, + automaton_kills=31551843355, + illuminate_kills=3687632552, + bullets_fired=570972530827, + bullets_hit=645273266867, + time_played=1047300170684, + deaths=2564288334, + revives=2, + friendlies=361317130, + mission_success_rate=90.0, + accuracy=100, + player_count=102995 + ) + ) + ``` diff --git a/docs/links.md b/docs/links.md new file mode 100644 index 0000000..250b7d8 --- /dev/null +++ b/docs/links.md @@ -0,0 +1,13 @@ +--- +icon: material/link +--- + +# 🔗 Links + +A list of links that may come in handy when using this lib or other parts of the community API. + +- [PyPi project](https://pypi.org/project/helldivepy/) +- [DiveHarder](https://github.com/helldivers-2/diveharder_api.py) +- [Community API](https://github.com/helldivers-2/api) +- [Comuunity Github](https://github.com/helldivers-2/) +- [API discussion Discord](https://discord.gg/MThYGMCqgp) diff --git a/mkdocs.yml b/mkdocs.yml index 63edd4e..d94cb01 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -14,7 +14,15 @@ theme: language: en features: + - navigation.indexes + - navigation.instant + - navigation.instant.prefetch + - navigation.instant.progress - navigation.sections + - navigation.tracking + - navigation.path + - navigation.top + - navigation.footer - navigation.tabs - content.code.copy - content.code.select @@ -36,12 +44,23 @@ extra: analytics: provider: google property: G-YS5CTZLJFE - + social: + - icon: fontawesome/brands/github + link: https://github.com/ajxd2 + - icon: fontawesome/brands/youtube + link: https://youtube.com/@ajxd2 + - icon: fontawesome/brands/docker + link: https://hub.docker.com/u/ajxd2 + - icon: fontawesome/brands/python + link: https://pypi.org/project/helldivepy/ markdown_extensions: - pymdownx.highlight: anchor_linenums: true line_spans: __span pygments_lang_class: true + - pymdownx.emoji: + emoji_index: !!python/name:material.extensions.emoji.twemoji + emoji_generator: !!python/name:material.extensions.emoji.to_svg - admonition - footnotes - codehilite @@ -49,8 +68,10 @@ markdown_extensions: - pymdownx.inlinehilite - pymdownx.details - pymdownx.superfences - - + - attr_list + - md_in_html + - pymdownx.tabbed: + alternate_style: true plugins: - search @@ -82,7 +103,7 @@ nav: - Home: - Introduction: index.md - Installation: installation.md - + - Links: links.md - API Reference: - Overview: api/index.md - Helldive.py: