Habiticalib 0.1.0a0__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 (33) hide show
  1. habiticalib-0.1.0a0/.cruft.json +27 -0
  2. habiticalib-0.1.0a0/.editorconfig +11 -0
  3. habiticalib-0.1.0a0/.github/FUNDING.yml +3 -0
  4. habiticalib-0.1.0a0/.github/dependabot.yml +10 -0
  5. habiticalib-0.1.0a0/.github/labels.yml +66 -0
  6. habiticalib-0.1.0a0/.github/release-drafter.yml +39 -0
  7. habiticalib-0.1.0a0/.github/workflows/build.yml +86 -0
  8. habiticalib-0.1.0a0/.github/workflows/documentation.yml +56 -0
  9. habiticalib-0.1.0a0/.github/workflows/draft.yml +19 -0
  10. habiticalib-0.1.0a0/.github/workflows/labeler.yml +25 -0
  11. habiticalib-0.1.0a0/.gitignore +113 -0
  12. habiticalib-0.1.0a0/.pre-commit-config.yaml +34 -0
  13. habiticalib-0.1.0a0/.vscode/settings.json +22 -0
  14. habiticalib-0.1.0a0/LICENSE +22 -0
  15. habiticalib-0.1.0a0/PKG-INFO +92 -0
  16. habiticalib-0.1.0a0/README.md +73 -0
  17. habiticalib-0.1.0a0/docs/index.md +1 -0
  18. habiticalib-0.1.0a0/docs/reference/habiticalib.md +6 -0
  19. habiticalib-0.1.0a0/mkdocs.yml +67 -0
  20. habiticalib-0.1.0a0/pyproject.toml +133 -0
  21. habiticalib-0.1.0a0/src/habiticalib/__init__.py +12 -0
  22. habiticalib-0.1.0a0/src/habiticalib/const.py +14 -0
  23. habiticalib-0.1.0a0/src/habiticalib/exceptions.py +27 -0
  24. habiticalib-0.1.0a0/src/habiticalib/helpers.py +115 -0
  25. habiticalib-0.1.0a0/src/habiticalib/lib.py +1538 -0
  26. habiticalib-0.1.0a0/src/habiticalib/py.typed +0 -0
  27. habiticalib-0.1.0a0/src/habiticalib/types.py +1202 -0
  28. habiticalib-0.1.0a0/tests/__init__.py +1 -0
  29. habiticalib-0.1.0a0/tests/__snapshots__/test_user.ambr +4 -0
  30. habiticalib-0.1.0a0/tests/conftest.py +27 -0
  31. habiticalib-0.1.0a0/tests/fixtures/user.json +460 -0
  32. habiticalib-0.1.0a0/tests/test_init.py +16 -0
  33. habiticalib-0.1.0a0/tests/test_user.py +20 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "template": "https://github.com/tr4nt0r/cookiecutter-hatch",
3
+ "commit": "8d08540791a735c0668f08b8025719728c7677f9",
4
+ "checkout": null,
5
+ "context": {
6
+ "cookiecutter": {
7
+ "full_name": "Manfred Dennerlein Rodelo",
8
+ "email": "manfred@dennerlein.name",
9
+ "github_username": "tr4nt0r",
10
+ "project_name": "Habiticalib",
11
+ "dist_name": "habiticalib",
12
+ "package_name": "habiticalib",
13
+ "project_short_description": "Modern asynchronous Python client library for the Habitica API",
14
+ "repository_name": "tr4nt0r/habiticalib",
15
+ "repository_url": "https://github.com/tr4nt0r/habiticalib",
16
+ "docs_url": "https://tr4nt0r.github.io/habiticalib/",
17
+ "open_source_license": "MIT license",
18
+ "python_version": "3.12",
19
+ "asyncio": "Y",
20
+ "docs_icon": "material/library",
21
+ "docs_color_primary": "deep purple",
22
+ "docs_color_accent": "purple",
23
+ "_template": "https://github.com/tr4nt0r/cookiecutter-hatch"
24
+ }
25
+ },
26
+ "directory": null
27
+ }
@@ -0,0 +1,11 @@
1
+ # http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 4
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ charset = utf-8
11
+ end_of_line = lf
@@ -0,0 +1,3 @@
1
+ github: [tr4nt0r]
2
+ buy_me_a_coffee: tr4nt0r
3
+
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,66 @@
1
+ ---
2
+ # Labels names are important as they are used by Release Drafter to decide
3
+ # regarding where to record them in changelog or if to skip them.
4
+ #
5
+ # The repository labels will be automatically configured using this file and
6
+ # the GitHub Action https://github.com/marketplace/actions/github-labeler.
7
+ - name: breaking
8
+ description: Breaking Changes
9
+ color: bfd4f2
10
+ - name: bug
11
+ description: Something isn't working
12
+ color: d73a4a
13
+ - name: build
14
+ description: Build System and Dependencies
15
+ color: bfdadc
16
+ - name: ci
17
+ description: Continuous Integration
18
+ color: 4a97d6
19
+ - name: dependencies
20
+ description: Pull requests that update a dependency file
21
+ color: 0366d6
22
+ - name: documentation
23
+ description: Improvements or additions to documentation
24
+ color: 0075ca
25
+ - name: duplicate
26
+ description: This issue or pull request already exists
27
+ color: cfd3d7
28
+ - name: enhancement
29
+ description: New feature or request
30
+ color: a2eeef
31
+ - name: github_actions
32
+ description: Pull requests that update Github_actions code
33
+ color: "000000"
34
+ - name: good first issue
35
+ description: Good for newcomers
36
+ color: 7057ff
37
+ - name: help wanted
38
+ description: Extra attention is needed
39
+ color: 008672
40
+ - name: invalid
41
+ description: This doesn't seem right
42
+ color: e4e669
43
+ - name: performance
44
+ description: Performance
45
+ color: "016175"
46
+ - name: python
47
+ description: Pull requests that update Python code
48
+ color: 2b67c6
49
+ - name: question
50
+ description: Further information is requested
51
+ color: d876e3
52
+ - name: refactoring
53
+ description: Refactoring
54
+ color: ef67c4
55
+ - name: removal
56
+ description: Removals and Deprecations
57
+ color: 9ae7ea
58
+ - name: style
59
+ description: Style
60
+ color: c120e5
61
+ - name: testing
62
+ description: Testing
63
+ color: b1fc6f
64
+ - name: wontfix
65
+ description: This will not be worked on
66
+ color: ffffff
@@ -0,0 +1,39 @@
1
+ name-template: '$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+
4
+ categories:
5
+ - title: '🚀 Features'
6
+ labels:
7
+ - 'feat'
8
+ - title: '🐛 Bug Fixes'
9
+ labels:
10
+ - 'fix'
11
+ - title: 'Other updates'
12
+ labels:
13
+ - 'refactor'
14
+ - 'chore'
15
+ - 'docs'
16
+ - 'perf'
17
+ - 'test'
18
+
19
+ change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
20
+ change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
21
+
22
+ version-resolver:
23
+ major:
24
+ labels:
25
+ - 'major'
26
+ minor:
27
+ labels:
28
+ - 'minor'
29
+ patch:
30
+ labels:
31
+ - 'patch'
32
+ default: patch
33
+
34
+ template: |
35
+ ## Changes
36
+
37
+ $CHANGES
38
+
39
+ Special thanks to: $CONTRIBUTORS
@@ -0,0 +1,86 @@
1
+ name: Build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ python_version: ['3.12']
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python_version }}
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install hatch
23
+ hatch env create
24
+ - name: Lint and typecheck
25
+ run: |
26
+ hatch run lint-check
27
+ - name: Test
28
+ run: |
29
+ hatch run test-cov-xml
30
+ - uses: codecov/codecov-action@v4
31
+ with:
32
+ token: ${{ secrets.CODECOV_TOKEN }}
33
+ fail_ci_if_error: true
34
+ verbose: true
35
+
36
+ release:
37
+ runs-on: ubuntu-latest
38
+ environment: release
39
+ needs: test
40
+ if: startsWith(github.ref, 'refs/tags/')
41
+ permissions:
42
+ contents: write
43
+ id-token: write
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - name: Set up Python
48
+ uses: actions/setup-python@v5
49
+ with:
50
+ python-version: '3.12'
51
+ - name: Install dependencies
52
+ shell: bash
53
+ run: |
54
+ python -m pip install --upgrade pip
55
+ pip install hatch
56
+ - name: mint API token
57
+ id: mint-token
58
+ run: |
59
+ # retrieve the ambient OIDC token
60
+ resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
61
+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
62
+ oidc_token=$(jq -r '.value' <<< "${resp}")
63
+
64
+ # exchange the OIDC token for an API token
65
+ resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}")
66
+ api_token=$(jq -r '.token' <<< "${resp}")
67
+
68
+ # mask the newly minted API token, so that we don't accidentally leak it
69
+ echo "::add-mask::${api_token}"
70
+
71
+ # see the next step in the workflow for an example of using this step output
72
+ echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
73
+ - name: Build and publish on PyPI
74
+ env:
75
+ HATCH_INDEX_USER: __token__
76
+ HATCH_INDEX_AUTH: ${{ steps.mint-token.outputs.api-token }}
77
+ run: |
78
+ hatch build
79
+ hatch publish
80
+ - name: Create release
81
+ uses: ncipollo/release-action@v1
82
+ with:
83
+ draft: true
84
+ body: ${{ github.event.head_commit.message }}
85
+ artifacts: dist/*.whl,dist/*.tar.gz
86
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,56 @@
1
+ name: Build documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ # Allow one concurrent deployment
15
+ concurrency:
16
+ group: "pages"
17
+ cancel-in-progress: true
18
+
19
+ # Default to bash
20
+ defaults:
21
+ run:
22
+ shell: bash
23
+
24
+ jobs:
25
+ build:
26
+
27
+ runs-on: ubuntu-latest
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - name: Set up Python
32
+ uses: actions/setup-python@v5
33
+ with:
34
+ python-version: '3.12'
35
+ - name: Install dependencies
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install hatch
39
+ hatch env create
40
+ - name: Build
41
+ run: hatch run docs-build
42
+ - name: Upload artifact
43
+ uses: actions/upload-pages-artifact@v3
44
+ with:
45
+ path: ./site
46
+
47
+ deploy:
48
+ environment:
49
+ name: github-pages
50
+ url: ${{ steps.deployment.outputs.page_url }}
51
+ runs-on: ubuntu-latest
52
+ needs: build
53
+ steps:
54
+ - name: Deploy to GitHub Pages
55
+ id: deployment
56
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,19 @@
1
+ name: Release Drafter
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ update-draft:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ steps:
14
+ # Drafts your next Release notes as Pull Requests are merged into "main"
15
+ - uses: release-drafter/release-drafter@v6
16
+ with:
17
+ disable-autolabeler: true
18
+ env:
19
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,25 @@
1
+ name: Labeler
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+
9
+ permissions:
10
+ actions: read
11
+ contents: read
12
+ security-events: write
13
+ pull-requests: write
14
+
15
+ jobs:
16
+ labeler:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Check out the repository
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Run Labeler
23
+ uses: crazy-max/ghaction-github-labeler@v5.0.0
24
+ with:
25
+ skip-delete: true
@@ -0,0 +1,113 @@
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
+ env/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ .hypothesis/
48
+ .pytest_cache/
49
+ junit/
50
+ junit.xml
51
+ test.db
52
+
53
+ # Translations
54
+ *.mo
55
+ *.pot
56
+
57
+ # Django stuff:
58
+ *.log
59
+ local_settings.py
60
+
61
+ # Flask stuff:
62
+ instance/
63
+ .webassets-cache
64
+
65
+ # Scrapy stuff:
66
+ .scrapy
67
+
68
+ # Sphinx documentation
69
+ docs/_build/
70
+
71
+ # PyBuilder
72
+ target/
73
+
74
+ # Jupyter Notebook
75
+ .ipynb_checkpoints
76
+ *.ipynb
77
+
78
+ # pyenv
79
+ .python-version
80
+
81
+ # celery beat schedule file
82
+ celerybeat-schedule
83
+
84
+ # SageMath parsed files
85
+ *.sage.py
86
+
87
+ # dotenv
88
+ .env
89
+
90
+ # virtualenv
91
+ .venv
92
+ venv/
93
+ ENV/
94
+
95
+ # Spyder project settings
96
+ .spyderproject
97
+ .spyproject
98
+
99
+ # Rope project settings
100
+ .ropeproject
101
+
102
+ # mkdocs documentation
103
+ /site
104
+
105
+ # mypy
106
+ .mypy_cache/
107
+
108
+ # OS files
109
+ .DS_Store
110
+
111
+
112
+ # Avatar test image
113
+ avatar.png
@@ -0,0 +1,34 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: check-added-large-files
7
+ - id: check-merge-conflict
8
+ - id: check-shebang-scripts-are-executable
9
+ - id: check-docstring-first
10
+ - id: debug-statements
11
+ - id: check-ast
12
+ - id: check-json
13
+ - id: check-toml
14
+ - id: check-xml
15
+ - id: check-yaml
16
+ args: ['--unsafe'] # needed for !! tags in mkdocs.yml
17
+ - id: end-of-file-fixer
18
+ - id: mixed-line-ending
19
+ args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
20
+
21
+ # Ruff replaces black, flake8, autoflake, isort and more
22
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
23
+ rev: 'v0.7.0' # make sure this is always consistent with hatch configs
24
+ hooks:
25
+ - id: ruff
26
+ - id: ruff-format
27
+ args: [--check, --config, ./pyproject.toml]
28
+
29
+ - repo: https://github.com/pre-commit/mirrors-mypy
30
+ rev: 'v1.12.0' # make sure this is always consistent with hatch configs
31
+ hooks:
32
+ - id: mypy
33
+ args: ["--install-types", "--non-interactive", "--ignore-missing-imports"]
34
+ additional_dependencies: [types-tabulate, types-cachetools]
@@ -0,0 +1,22 @@
1
+ {
2
+ "python.analysis.typeCheckingMode": "basic",
3
+ "python.analysis.autoImportCompletions": true,
4
+ "python.terminal.activateEnvironment": true,
5
+ "python.terminal.activateEnvInCurrentTerminal": true,
6
+ "python.testing.unittestEnabled": false,
7
+ "python.testing.pytestEnabled": true,
8
+ "editor.rulers": [88],
9
+ "python.defaultInterpreterPath": "${workspaceFolder}/.hatch/habitica/bin/python",
10
+ "python.testing.pytestPath": "${workspaceFolder}/.hatch/habitica/bin/pytest",
11
+ "python.testing.cwd": "${workspaceFolder}",
12
+ "python.testing.pytestArgs": ["--no-cov"],
13
+ "[python]": {
14
+ "editor.formatOnSave": true,
15
+ "editor.codeActionsOnSave": {
16
+ "source.fixAll": "explicit",
17
+ "source.organizeImports": "explicit"
18
+ },
19
+ "editor.defaultFormatter": "charliermarsh.ruff"
20
+ },
21
+ "pylint.enabled": false
22
+ }
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024, Manfred Dennerlein Rodelo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,92 @@
1
+ Metadata-Version: 2.3
2
+ Name: Habiticalib
3
+ Version: 0.1.0a0
4
+ Summary: Asynchronous Python client library for the Habitica API
5
+ Project-URL: Documentation, https://tr4nt0r.github.io/habiticalib/
6
+ Project-URL: Source, https://github.com/tr4nt0r/habiticalib
7
+ Author-email: Manfred Dennerlein Rodelo <manfred@dennerlein.name>
8
+ License: MIT License
9
+ License-File: LICENSE
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Requires-Python: >=3.12
14
+ Requires-Dist: aiohttp~=3.9
15
+ Requires-Dist: mashumaro~=3.13
16
+ Requires-Dist: orjson~=3.10
17
+ Requires-Dist: pillow~=10.4
18
+ Description-Content-Type: text/markdown
19
+
20
+ # Habiticalib
21
+
22
+ <p align="center">
23
+ <em>Modern asynchronous Python client library for the Habitica API</em>
24
+ </p>
25
+
26
+ [![build](https://github.com/tr4nt0r/habiticalib/workflows/Build/badge.svg)](https://github.com/tr4nt0r/habiticalib/actions)
27
+ [![codecov](https://codecov.io/gh/tr4nt0r/habiticalib/branch/master/graph/badge.svg)](https://codecov.io/gh/tr4nt0r/habiticalib)
28
+ [![PyPI version](https://badge.fury.io/py/habiticalib.svg)](https://badge.fury.io/py/habiticalib)
29
+
30
+ ---
31
+
32
+ **Documentation**: <a href="https://tr4nt0r.github.io/habiticalib/" target="_blank">https://tr4nt0r.github.io/habiticalib/</a>
33
+
34
+ **Source Code**: <a href="https://github.com/tr4nt0r/habiticalib" target="_blank">https://github.com/tr4nt0r/habiticalib</a>
35
+
36
+ ---
37
+
38
+ ## Development
39
+
40
+ ### Setup environment
41
+
42
+ We use [Hatch](https://hatch.pypa.io/latest/install/) to manage the development environment and production build. Ensure it's installed on your system.
43
+
44
+ ### Run unit tests
45
+
46
+ You can run all the tests with:
47
+
48
+ ```bash
49
+ hatch run test
50
+ ```
51
+
52
+ ### Format the code
53
+
54
+ Execute the following command to apply linting and check typing:
55
+
56
+ ```bash
57
+ hatch run lint
58
+ ```
59
+
60
+ ### Publish a new version
61
+
62
+ You can bump the version, create a commit and associated tag with one command:
63
+
64
+ ```bash
65
+ hatch version patch
66
+ ```
67
+
68
+ ```bash
69
+ hatch version minor
70
+ ```
71
+
72
+ ```bash
73
+ hatch version major
74
+ ```
75
+
76
+ Your default Git text editor will open so you can add information about the release.
77
+
78
+ When you push the tag on GitHub, the workflow will automatically publish it on PyPi and a GitHub release will be created as draft.
79
+
80
+ ## Serve the documentation
81
+
82
+ You can serve the Mkdocs documentation with:
83
+
84
+ ```bash
85
+ hatch run docs-serve
86
+ ```
87
+
88
+ It'll automatically watch for changes in your code.
89
+
90
+ ## License
91
+
92
+ This project is licensed under the terms of the MIT license.