Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python typing capability to the library. #15

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
62 changes: 62 additions & 0 deletions .github/workflows/coverage_and_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Type Coverage and Linting

on:
push:
branches:
- master
pull_request:
branches:
- master
types:
- opened
- synchronize

jobs:
job:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]

name: "Type Coverage and Linting @ ${{ matrix.python-version }}"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: "Setup Python @ ${{ matrix.python-version }}"
uses: actions/setup-python@v3
with:
python-version: "${{ matrix.python-version }}"

- name: "Install Python deps @ ${{ matrix.python-version }}"
env:
PY_VER: "${{ matrix.python-version }}"
run: |
pip install -U -r requirements.txt
pip install -U .

- uses: actions/setup-node@v3
with:
node-version: "17"
- run: npm install --location=global pyright@latest

- name: "Type Coverage @ ${{ matrix.python-version }}"
run: |
pyright
pyright --ignoreexternal --lib --verifytypes pyxivapi

- name: Lint
if: ${{ github.event_name != 'pull_request' }}
uses: github/super-linter/slim@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEFAULT_BRANCH: master
VALIDATE_ALL_CODEBASE: false
VALIDATE_PYTHON_BLACK: true
VALIDATE_PYTHON_ISORT: true
LINTER_RULES_PATH: /
PYTHON_ISORT_CONFIG_FILE: pyproject.toml
PYTHON_BLACK_CONFIG_FILE: pyproject.toml
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install dependencies
Expand Down
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
include README.md
include LICENSE
include requirements.txt
include pyxivapi/py.typed
31 changes: 31 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[tool.black]
line-length = 125
target-version = ["py37"]

[tool.isort]
profile = "black"
lines_after_imports = 2

[tool.pyright]
include = ["pyxivapi/**/*.py"]
useLibraryCodeForTypes = true
typeCheckingMode = "basic"
pythonVersion = "3.7"
strictListInference = true
strictDictionaryInference = true
strictSetInference = true
strictParameterNoneValue = true
reportMissingImports = "error"
reportUnusedImport = "error"
reportUnusedClass = "error"
reportUnusedFunction = "error"
reportUnusedVariable = "error"
reportUnusedExpression = "error"
reportGeneralTypeIssues = "error"
reportDuplicateImport = "error"
reportUntypedFunctionDecorator = "error"
reportUnnecessaryTypeIgnoreComment = "warning"

[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
51 changes: 31 additions & 20 deletions pyxivapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,32 @@
__title__ = 'pyxivapi'
__author__ = 'Lethys'
__license__ = 'MIT'
__copyright__ = 'Copyright 2019 (c) Lethys'
__version__ = '0.5.1'
"""
MIT License

from .client import XIVAPIClient
from .exceptions import (
XIVAPIForbidden,
XIVAPIBadRequest,
XIVAPINotFound,
XIVAPIServiceUnavailable,
XIVAPIInvalidLanguage,
XIVAPIInvalidIndex,
XIVAPIInvalidColumns,
XIVAPIInvalidFilter,
XIVAPIInvalidWorlds,
XIVAPIInvalidDatacenter,
XIVAPIError,
XIVAPIInvalidAlgo
)
Copyright (c) 2019 Lethys

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"""

__title__ = "pyxivapi"
__author__ = "Lethys"
__license__ = "MIT"
__copyright__ = "Copyright 2019 (c) Lethys"
__version__ = "0.5.1"

from .client import *
from .exceptions import *
Loading