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

chore(deps): Update black requirement from ~=22.12 to ~=23.1 in /packages/@jsii/python-runtime #3951

Merged
4 changes: 3 additions & 1 deletion packages/@jsii/python-runtime/build-tools/gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import { copyFileSync, readdirSync, statSync, writeFileSync } from 'fs';
import { resolve } from 'path';
import { TargetName } from 'jsii-pacmak';
import { toReleaseVersion } from 'jsii-pacmak/lib/targets/version-utils';

const EMBEDDED_SOURCE = resolve(__dirname, '..', '..', 'runtime', 'webpack');
const EMBEDDED_INFO = resolve(__dirname, '..', '..', 'runtime', 'package.json');
Expand All @@ -13,7 +15,7 @@ writeFileSync(
resolve(__dirname, '..', 'src', 'jsii', '_metadata.json'),
JSON.stringify(
{
version: data.version,
version: toReleaseVersion(data.version, TargetName.PYTHON),
description: data.description,
license: data.license,
author: data.author.name,
Expand Down
7 changes: 4 additions & 3 deletions packages/@jsii/python-runtime/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
black~=22.12
mypy==0.812
black~=23.1
mypy==1.0.0
pip~=23.0
pytest~=7.2
pytest-mypy~=0.10
setuptools~=65.5.1
setuptools~=67.3.2
types-python-dateutil~=2.8
wheel~=0.38

-e .
2 changes: 0 additions & 2 deletions packages/@jsii/python-runtime/src/jsii/_kernel/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,10 @@ def _callback_till_result(

@attr.s(auto_attribs=True, frozen=True, slots=True)
class Statistics:

object_count: int


class Kernel(metaclass=Singleton):

# This class translates between the Pythonic interface for the kernel, and the
# Kernel Provider interface that maps more directly to the JSII Kernel interface.
# It currently only supports the idea of a process kernel provider, however it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@


class BaseProvider(metaclass=abc.ABCMeta):

# The API provided by this Provider is not very pythonic, however it is done to map
# this API as closely to the JSII runtime as possible. Higher level abstractions
# that layer ontop of the Provider will provide a translation layer that make this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,11 @@

@attr.s(auto_attribs=True, frozen=True, slots=True)
class _HelloResponse:

hello: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class _OkayResponse:

# We could technically mark this as KernelResponse, because we know that
# it is going to be one of those. However, we can't disambiguate the different
# types because some of them have the same keys as each other, so the only way
Expand All @@ -86,21 +84,18 @@ class _OkayResponse:

@attr.s(auto_attribs=True, frozen=True, slots=True)
class _ErrorResponse:

error: str
stack: str
name: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class _CallbackResponse:

callback: Callback


@attr.s(auto_attribs=True, frozen=True, slots=True)
class _CompleteRequest:

complete: CompleteRequest


Expand Down Expand Up @@ -284,7 +279,7 @@ def start(self):

self.handshake()

def stop(self):
def stop(self) -> None:
# This process is closing already, un-registering the hook to not fire twice
atexit.unregister(self.stop)

Expand All @@ -304,7 +299,7 @@ def stop(self):

self._ctx_stack.close()

def handshake(self):
def handshake(self) -> None:
# Get the version of the runtime that we're using.
resp: _HelloResponse = self._serializer.structure(
self._next_message(), _HelloResponse
Expand Down
30 changes: 0 additions & 30 deletions packages/@jsii/python-runtime/src/jsii/_kernel/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,68 +6,59 @@

@attr.s(auto_attribs=True, frozen=True, slots=True)
class ObjRef:

ref: str
interfaces: Optional[List[str]] = None


@attr.s(auto_attribs=True, frozen=True, slots=True)
class EnumRef:

ref: ObjRef
member: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class Override:

method: Optional[str] = None
property: Optional[str] = None
cookie: Optional[str] = None


@attr.s(auto_attribs=True, frozen=True, slots=True)
class LoadRequest:

name: str
version: str
tarball: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class LoadResponse:

assembly: str
types: int


@attr.s(auto_attribs=True, frozen=True, slots=True)
class GetScriptCommandRequest:

assembly: str
script: str
args: List[Any] = attr.Factory(list)


@attr.s(auto_attribs=True, frozen=True, slots=True)
class GetScriptCommandResponse:

command: str
args: List[str] = attr.Factory(list)
env: Dict[str, str] = attr.Factory(dict)


@attr.s(auto_attribs=True, frozen=True, slots=True)
class InvokeScriptRequest:

assembly: str
script: str
args: List[Any] = attr.Factory(list)


@attr.s(auto_attribs=True, frozen=True, slots=True)
class InvokeScriptResponse:

status: int
stdout: str
stderr: str
Expand All @@ -76,7 +67,6 @@ class InvokeScriptResponse:

@attr.s(auto_attribs=True, frozen=True, slots=True)
class CreateRequest:

fqn: str
args: List[Any] = attr.Factory(list)
overrides: List[Override] = attr.Factory(list)
Expand All @@ -90,7 +80,6 @@ class CreateResponse(ObjRef):

@attr.s(auto_attribs=True, frozen=True, slots=True)
class DeleteRequest:

objref: ObjRef


Expand All @@ -101,35 +90,30 @@ class DeleteResponse:

@attr.s(auto_attribs=True, frozen=True, slots=True)
class GetRequest:

objref: ObjRef
property: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class StaticGetRequest:

fqn: str
property: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class GetResponse:

value: Any = None


@attr.s(auto_attribs=True, frozen=True, slots=True)
class StaticSetRequest:

fqn: str
property: str
value: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class SetRequest:

objref: ObjRef
property: str
value: Any
Expand All @@ -142,55 +126,47 @@ class SetResponse:

@attr.s(auto_attribs=True, frozen=True, slots=True)
class StaticInvokeRequest:

fqn: str
method: str
args: Optional[List[Any]] = attr.Factory(list)


@attr.s(auto_attribs=True, frozen=True, slots=True)
class InvokeRequest:

objref: ObjRef
method: str
args: Optional[List[Any]] = attr.Factory(list)


@attr.s(auto_attribs=True, frozen=True, slots=True)
class InvokeResponse:

result: Any = None


@attr.s(auto_attribs=True, frozen=True, slots=True)
class BeginRequest:

objref: ObjRef
method: str
args: Optional[List[Any]] = attr.Factory(list)


@attr.s(auto_attribs=True, frozen=True, slots=True)
class BeginResponse:

promiseid: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class EndRequest:

promiseid: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class EndResponse:

result: Optional[Any] = None


@attr.s(auto_attribs=True, frozen=True, slots=True)
class Callback:

cbid: str
cookie: str
invoke: Optional[InvokeRequest] = None
Expand All @@ -205,33 +181,28 @@ class CallbacksRequest:

@attr.s(auto_attribs=True, frozen=True, slots=True)
class CallbacksResponse:

callbacks: List[Callback]


@attr.s(auto_attribs=True, frozen=True, slots=True)
class CompleteRequest:

cbid: str
err: Optional[str] = None
result: Optional[Any] = None


@attr.s(auto_attribs=True, frozen=True, slots=True)
class CompleteResponse:

cbid: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class NamingRequest:

assembly: str


@attr.s(auto_attribs=True, frozen=True, slots=True)
class NamingResponse:

naming: Mapping[str, Mapping[str, Optional[Any]]]


Expand All @@ -242,7 +213,6 @@ class StatsRequest:

@attr.s(auto_attribs=True, frozen=True, slots=True)
class StatsResponse:

objectCount: int


Expand Down
1 change: 0 additions & 1 deletion packages/@jsii/python-runtime/src/jsii/_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@attr.s(auto_attribs=True, frozen=True, slots=True)
class JSIIAssembly:

name: str
version: str
module: str
Expand Down
1 change: 0 additions & 1 deletion packages/@jsii/python-runtime/src/jsii/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Singleton(type):

_instances: MutableMapping[Type[Any], Any] = {}

def __call__(cls, *args, **kwargs):
Expand Down
5 changes: 1 addition & 4 deletions packages/@jsii/python-runtime/tests/test_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ def override_me_too(self):


class SyncOverrides(SyncVirtualMethods):

multiplier = 1
return_super = False
call_async = False
Expand Down Expand Up @@ -648,7 +647,6 @@ def the_property(self, value):
def test_propertyOverrides_interfaces():
@jsii.implements(IInterfaceWithProperties)
class TInterfaceWithProperties:

x = None

@property
Expand All @@ -673,7 +671,6 @@ def read_write_string(self, value):
def test_interfaceBuilder():
@jsii.implements(IInterfaceWithProperties)
class TInterfaceWithProperties:

x = "READ_WRITE"

@property
Expand Down Expand Up @@ -729,7 +726,7 @@ def test_fail_syncOverrides_callsDoubleAsync_propertySetter():
obj.caller_is_property = 12


def test_testInterfaces():
def test_testInterfaces() -> None:
friendly: IFriendly
friendlier: IFriendlier
random_number_generator: IRandomNumberGenerator
Expand Down
5 changes: 4 additions & 1 deletion packages/jsii-pacmak/lib/targets/python.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,10 @@ class Package {
code.closeFile('README.md');

// Strip " (build abcdef)" from the jsii version
const jsiiVersionSimple = this.metadata.jsiiVersion.replace(/ .*$/, '');
const jsiiVersionSimple = toReleaseVersion(
this.metadata.jsiiVersion.replace(/ .*$/, ''),
TargetName.PYTHON,
);

const setupKwargs = {
name: this.name,
Expand Down
4 changes: 2 additions & 2 deletions packages/jsii-pacmak/lib/targets/python/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# be installed in the virtual environment used for building the distribution
# package (wheel, sdist), but not declared as build-system dependencies.

setuptools~=65.5.1 # build-system
wheel~=0.38.4 # build-system
setuptools~=67.3.2 # build-system
wheel~=0.38 # build-system

twine~=4.0.2
Loading