-
Notifications
You must be signed in to change notification settings - Fork 4
Compatible stubs for Pythonista 3.4+ #5
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Publish | ||
|
|
||
| on: | ||
| release: | ||
| types: [ published ] | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
|
|
||
| publish: | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: pypi | ||
| permissions: | ||
| id-token: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Install the project | ||
| run: uv sync --locked --all-extras --dev | ||
|
|
||
| - name: Build | ||
| run: uv build | ||
|
|
||
| - name: Publish | ||
| if: github.event_name == 'release' | ||
| run: uv publish --trusted-publishing always |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| include pythonista_stubs/*.pyi | ||
|
o-murphy marked this conversation as resolved.
o-murphy marked this conversation as resolved.
|
||
| include VERSION | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.4.0 | ||
|
o-murphy marked this conversation as resolved.
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| [build-system] | ||
| requires = ["setuptools>=80.1.0"] | ||
| build-backend = "setuptools.build_meta" | ||
|
|
||
| [project] | ||
| name = "pythonista-stubs" | ||
| authors = [ | ||
| { name = "Harold Martin" }, | ||
| { name = "Dmytro Yaroshenko" } | ||
| ] | ||
| description = "A collection of Pythonista stub files" | ||
| readme = "README.md" | ||
| requires-python = ">=3.10" | ||
|
o-murphy marked this conversation as resolved.
|
||
| dependencies = [ | ||
| "types-pillow>=10.2.0.20240822", | ||
| "typing-extensions>=4.14.1", | ||
| ] | ||
| license = { file = "LICENSE" } | ||
| keywords = ["pythonista", "stubs", "ios", "ide"] | ||
| classifiers = [ | ||
| "Intended Audience :: Developers", | ||
| "Natural Language :: English", | ||
| "Programming Language :: Python", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3 :: Only", | ||
| "Programming Language :: Python :: 3.10", | ||
| "Programming Language :: Python :: 3.11", | ||
| "Programming Language :: Python :: 3.12", | ||
| "Programming Language :: Python :: 3.13", | ||
| "Programming Language :: Python :: Implementation :: CPython", | ||
| ] | ||
| dynamic = ['version'] | ||
|
|
||
| [project.urls] | ||
| "Homepage" = "https://github.com/hbmartin/pythonista-stubs" | ||
| "Bug Reports" = "https://github.com/hbmartin/pythonista-stubs/issues" | ||
| "Source" = "https://github.com/hbmartin/pythonista-stubs" | ||
|
|
||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "mypy>=1.17.1", | ||
| "ruff>=0.12.8", | ||
| ] | ||
|
|
||
| [tool.setuptools.package-dir] | ||
| "pythonista_stubs" = "stubs" | ||
|
|
||
| [tool.setuptools.packages.find] | ||
| where = ["stubs"] | ||
| include = [ | ||
| "pythonista_stubs*", | ||
| ] | ||
|
|
||
| [tool.setuptools.package-data] | ||
| "*" = ["**/*"] # to include root-places .pyi stubs | ||
|
|
||
| [tool.setuptools.dynamic] | ||
| version = { file = "VERSION" } | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "mypy>=1.17.1", # as a dev dependency, Pythonista does not support mypy | ||
| "ruff>=0.12.8", | ||
| ] | ||
|
o-murphy marked this conversation as resolved.
o-murphy marked this conversation as resolved.
|
||
|
|
||
| [tool.mypy] | ||
| packages = ["stubs"] | ||
| ignore_missing_imports = true | ||
|
|
||
| [tool.ruff] | ||
| include = [ | ||
| "pyproject.toml", | ||
| "stubs/**/*.py", | ||
| "stubs/**/*.pyi", | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,3 @@ | ||
| from setuptools import setup | ||
| from os import path | ||
|
|
||
| here = path.abspath(path.dirname(__file__)) | ||
|
|
||
| with open(path.join(here, "README.md"), encoding="utf-8") as f: | ||
| long_description = f.read() | ||
|
|
||
| packages = ["appex", "clipboard", "console", "editor", "reminders", "sound", "speech", "ui"] | ||
| packages_stubs = [p + "-stubs" for p in packages] | ||
| package_dir = {p + "-stubs": path.join("stubs", p) for p in packages} | ||
| package_data = {ps: ["__init__.pyi"] for ps in packages_stubs} | ||
|
|
||
| setup( | ||
| name="pythonista-stubs", | ||
| version="0.0.3", | ||
| description="A collection of Pythonista stub files", | ||
| long_description=long_description, | ||
| long_description_content_type="text/markdown", | ||
| url="https://github.com/hbmartin/pythonista-stubs", | ||
| package_dir=package_dir, | ||
| packages=packages_stubs, | ||
| package_data=package_data, | ||
| install_requires=["typing_extensions", "mypy", "Pillow"], | ||
| classifiers=[ | ||
| "Development Status :: 3 - Alpha", | ||
| "Intended Audience :: Developers", | ||
| "Intended Audience :: Information Technology", | ||
| "License :: OSI Approved :: Apache Software License", | ||
| "Operating System :: iOS", | ||
| "Programming Language :: Python :: 3", | ||
| "Programming Language :: Python :: 3.6", | ||
| "Topic :: Software Development :: Libraries :: Python Modules", | ||
| "Typing :: Typed", | ||
| ], | ||
| license="Apache License 2.0", | ||
| keywords="pythonista stubs ios ide", | ||
| project_urls={"Bug Reports": "https://github.com/hbmartin/pythonista-stubs/issues"}, | ||
| ) | ||
| setup() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # Created on July, 07 2025 by o-murphy <https://github.com/o-murphy> | ||
| """ | ||
| pythonista `_cb` module type annotations | ||
| according to [pythonista.cb docs](https://omz-software.com/pythonista/docs/ios/cb.html) | ||
| and references to pythonista built-in `_cb` module help | ||
| >>> import _cb | ||
| >>> help(_cb) | ||
| """ | ||
|
|
||
| from typing import Optional, List | ||
|
|
||
| __all__ = ( | ||
| "CM_STATE_UNKNOWN", | ||
| "CM_STATE_RESETTING", | ||
| "CM_STATE_UNSUPPORTED", | ||
| "CM_STATE_UNAUTHORIZED", | ||
| "CM_STATE_POWERED_OFF", | ||
| "CM_STATE_POWERED_ON", | ||
| "CH_PROP_BROADCAST", | ||
| "CH_PROP_READ", | ||
| "CH_PROP_WRITE_WITHOUT_RESPONSE", | ||
| "CH_PROP_WRITE", | ||
| "CH_PROP_NOTIFY", | ||
| "CH_PROP_INDICATE", | ||
| "CH_PROP_AUTHENTICATED_SIGNED_WRITES", | ||
| "CH_PROP_EXTENDED_PROPERTIES", | ||
| "CH_PROP_NOTIFY_ENCRYPTION_REQUIRED", | ||
| "CH_PROP_INDICATE_ENCRYPTION_REQUIRED", | ||
| "Characteristic", | ||
| "Service", | ||
| "Peripheral", | ||
| "CentralManager", | ||
| ) | ||
|
|
||
| CM_STATE_UNKNOWN: int = 0 | ||
| CM_STATE_RESETTING: int = 1 | ||
| CM_STATE_UNSUPPORTED: int = 2 | ||
| CM_STATE_UNAUTHORIZED: int = 3 | ||
| CM_STATE_POWERED_OFF: int = 4 | ||
| CM_STATE_POWERED_ON: int = 5 | ||
|
|
||
| CH_PROP_BROADCAST: int = 1 | ||
| CH_PROP_READ: int = 2 | ||
| CH_PROP_WRITE_WITHOUT_RESPONSE: int = 4 | ||
| CH_PROP_WRITE: int = 8 | ||
| CH_PROP_NOTIFY: int = 16 | ||
| CH_PROP_INDICATE: int = 32 | ||
| CH_PROP_AUTHENTICATED_SIGNED_WRITES: int = 64 | ||
| CH_PROP_EXTENDED_PROPERTIES: int = 128 | ||
| CH_PROP_NOTIFY_ENCRYPTION_REQUIRED: int = 256 | ||
| CH_PROP_INDICATE_ENCRYPTION_REQUIRED: int = 512 | ||
|
|
||
| class Characteristic: | ||
| properties: int | ||
| value: Optional[bytes] | ||
| uuid: str # hex | ||
| notifying: bool | ||
|
|
||
| class Service: | ||
| characteristics: List[Characteristic] | ||
| primary: bool | ||
| uuid: str # hex | ||
|
|
||
| class Peripheral: | ||
| manufacturer_data: bytes | ||
| name: Optional[str] | ||
| uuid: str # hex | ||
| state: int | ||
| services: List[Service] | ||
|
|
||
| def discover_services(self) -> None: ... | ||
| def discover_characteristics(self, service: Service) -> None: ... | ||
| def set_notify_value( | ||
| self, characteristic: Characteristic, flag: bool = True | ||
| ) -> None: ... | ||
| def write_characteristic_value( | ||
| self, characteristic, data, with_response | ||
| ) -> None: ... | ||
| def read_characteristic_value(self, characteristic: Characteristic) -> None: ... | ||
|
|
||
| class CentralManager: | ||
| state: int | ||
|
|
||
| def __init__(self) -> None: ... | ||
| def scan_for_peripherals(self) -> None: ... | ||
| def stop_scan(self) -> None: ... | ||
| def connect_peripheral(self, p: Peripheral) -> None: ... | ||
| def cancel_peripheral_connection(self, p: Peripheral) -> None: ... | ||
| def did_discover_peripheral(self, p: Peripheral) -> None: ... | ||
| def did_connect_peripheral(self, p: Peripheral) -> None: ... | ||
| def did_fail_to_connect_peripheral( | ||
| self, p: Peripheral, error: Optional[str] | ||
| ) -> None: ... | ||
| def did_disconnect_peripheral( | ||
| self, p: Peripheral, error: Optional[str] | ||
| ) -> None: ... | ||
| def did_discover_services(self, p: Peripheral, error: Optional[str]) -> None: ... | ||
| def did_discover_characteristics( | ||
| self, s: Service, error: Optional[str] | ||
| ) -> None: ... | ||
| def did_write_value(self, c: Characteristic, error: Optional[str]) -> None: ... | ||
| def did_update_value(self, c: Characteristic, error: Optional[str]) -> None: ... | ||
| def did_update_state(self) -> None: ... |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.