Skip to content

Commit

Permalink
Add contributing and development information
Browse files Browse the repository at this point in the history
  • Loading branch information
Kutu committed Jun 2, 2024
1 parent 4811b45 commit 535434c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Publish update to PyPI

on:
workflow_dispatch:
release:
types: publised

Expand Down
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Contributing
Any contribution is welcomed, don't be ashamed to send them!

## Reporting
If you see any undesired behaviour, mismatches with the [OpenSubsonic API Spec](https://opensubsonic.netlify.app/) or any sort of bug, please report them at the [issue tracker](https://github.com/kutu-dev/knuckles/issues).

## Development
### The Toolchain
To start making development contribution you will need the `just` command (installation info at [its manual](https://just.systems/man/en/chapter_4.html)) and Python 3.11.0 (you can set it with [pyenv](https://github.com/pyenv/pyenv)).

Then you should be able to spin up the development environment:
```sh title="Command Line"
just setup
```
You can now run the test suit, check if you will the pass the CI check (and fix everything that can be done automatically) and spin up a docs instance with ease:
```sh title="Command Line"
just test
just check
just docs
```

See more recipes with:
```sh title="Command Line"
just help
```

### The Project
The project works around the [OpenSubsonic API Spec](https://opensubsonic.netlify.app/), with models (at `src/knuckles/_models`) that tries to match the [different responses](https://opensubsonic.netlify.app/docs/responses/) request can make.

The user access the API with the `Subsonic` object inside of it there are objects that acts as categories that roughly resembles the [categories in the spec](https://opensubsonic.netlify.app/categories/).

Everything should be private using the leading underscore convention and exposed the public parts of the package with the `__init__.py` file using the `__all__` variable.

!!! Warning

Making exceptions, methods or extra behaviour to support functionalities or bugs caused by non compliant server is not planned, nonetheless new generic systems to catch and avoid crashing in this situations are welcomed to be contributed.

### Notes
Technical notes about unconventional decisions in the project:

- Some parts of the CI with GitHub Actions uses the `24.04` version of Ubuntu instead of the `latest` tag (currently at `22.04`), this is due to the `just` command only being available in this version onwards. This is also the reason why this jobs uses Python 3.11.9 as it has a more limited range of installable version with the `actions/setup-python` action.
- Unfortunately due to limitations with [`mkdocstrings-python`](https://mkdocstrings.github.io/python/usage/configuration/docstrings/), when documenting the attributes of a class (like with all the models) the times can be determined at runtime and needs to be retyped in the docstring.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ print(ping.version)
```

### Learning More
To start making more complex interactions with the API make use of [the reference](https://kutu-dev.github.io/knuckles/reference/Api/). Enjoy coding and good luck!
To start making more complex interactions with the API make use of [the API reference](https://kutu-dev.github.io/knuckles/reference/Api/). Enjoy coding and good luck!

## Acknowledgements
Created with :heart: by [Jorge "Kutu" Dobón Blanco](https://dobon.dev).
7 changes: 1 addition & 6 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# TODO

- [ ] Document in contributing why attributes are double typed.
- [ ] Add general documentation and tutorials.
- [ ] Explain why CI uses `24.04` and not latest.
- [ ] Write that compat funcions for non standard behaviour servers is not planed.
- [ ] Add `__version__`.
- [ ] Fix POST support.
## **Fix POST support.**
1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--8<-- "CONTRIBUTING.md"
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ theme:

nav:
- Home:
Home: "index.md"
Getting Started: "index.md"
Contributing: "contributing.md"
- Reference: "reference/"

Expand Down Expand Up @@ -68,3 +68,4 @@ markdown_extensions:
- pymdownx.superfences
- pymdownx.snippets
- pymdownx.emoji
- admonition
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[project]
name = "knuckles"
description = "A Subsonic/OpenSubsonic API wrapper for Python."
requires-python = ">=3.11.0"
dependencies = [
"requests>=2.32.3",
Expand Down
4 changes: 4 additions & 0 deletions src/knuckles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@
from .models._system import License, SubsonicResponse
from .models._user import User
from .models._video import AudioTrack, Captions, Video, VideoInfo
from importlib.metadata import version

__version__ = version("knuckles")

__all__ = [
"__version__",
"Subsonic",
"RequestMethod",
"SubtitlesFileFormat",
Expand Down
8 changes: 6 additions & 2 deletions tests/api/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@

import responses
from dateutil import parser
from knuckles import Subsonic
from knuckles import Subsonic, __version__
from responses import Response

from importlib.metadata import version
from tests.conftest import AddResponses


def test_version() -> None:
assert __version__ == version("knuckles")


@responses.activate
def test_ping(
add_responses: AddResponses,
Expand Down

0 comments on commit 535434c

Please sign in to comment.