Skip to content

Get sip.pyi in the Docker build #66

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

Merged
merged 4 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
ARG ARCH_VERSION="20200407"
ARG BUILD_DATE="2020/04/22"

ARG SIP_VERSION="5.2.0"
# Also the major.minor of PyQt5-sip
ARG SIP_ABI_VERSION="12.7"
ARG PYQT_VERSION="5.14.2"
ARG PYQT_3D_VERSION="5.14.0"
ARG PYQT_CHART_VERSION="5.14.0"
Expand All @@ -27,6 +30,8 @@ RUN echo "Server=https://archive.archlinux.org/repos/${BUILD_DATE}/\$repo/os/\$a
RUN pacman --noconfirm -S \
# Build stuff
base-devel wget \
# Python stuff
python-pip \
# PyQt stuff
pyqt-builder python-sip sip5 \
# Used to build other PyQt modules in later build stages
Expand Down Expand Up @@ -95,6 +100,25 @@ RUN sip-install \
WORKDIR /output/
RUN find /upstream/ -name \*.pyi -exec cp {} . \;

################################################################################
# PyQt5-SIP stubs
################################################################################

FROM build-dep AS sip

# Reuse arguments from previous build scope
ARG SIP_VERSION
ARG SIP_ABI_VERSION

# Install SIP including stubs
# TODO: Find way to build only stubs. This takes way too long
WORKDIR /upstream/
RUN pip install --no-deps --target build sip==${SIP_VERSION}
Copy link
Collaborator

@BryceBeagle BryceBeagle Sep 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might want to make this download style consistent with the other build layers.

I think when I wrote the rest of the Dockerfile, I downloaded directly from PyPI's CDN to avoid the python-pip install, but in hindsight that may have been overkill. I'm not opposed to making every layer just use pip.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so now that I look the regular PyQt5 package provides its own .pyi files. Why are we building ourselves? (regardless of how we get the sdist)

Copy link
Collaborator

@BryceBeagle BryceBeagle Sep 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They didn't used to be: #40
We may be able to avoid building at this point

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I vote we don't mix switching away from building into this right now. Maybe? Though I do like consistency. Turns out the .pyi are right in the sdist so I'll switch over to the download/extract/copy structure. We can revisit not-building separately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the update what you were looking for?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar enough with the differences between find -name and find -wholename, but assuming you had a reason to go with the latter, lgtm

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I knew -name was wrong because I had the parent directory in the path but I ran it anyways and it told me to -wholename. At least the present sdist provides two ABIs so we need to pick one over the other.


# Copy all .pyi files to output dir
WORKDIR /output/
RUN find /upstream/ -wholename \*/${SIP_ABI_VERSION}/\*.pyi -exec cp {} . \;

################################################################################
# PyQt3D
################################################################################
Expand Down Expand Up @@ -264,6 +288,7 @@ FROM scratch AS output
# Get all the outputs from the build layers
WORKDIR /output/
COPY --from=pyqt5 /output/* ./
COPY --from=sip /output/* ./
COPY --from=pyqt-3d /output/* ./
COPY --from=pyqt-chart /output/* ./
COPY --from=pyqt-data-visualization /output/* ./
Expand Down
26 changes: 17 additions & 9 deletions PyQt5-stubs/sip.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# This file is the Python type hints stub file for the sip extension module.
#
# Copyright (c) 2016 Riverbank Computing Limited <[email protected]>
#
# This file is part of SIP.
# Copyright (c) 2019, Riverbank Computing Limited
# All rights reserved.
#
# This copy of SIP is licensed for use under the terms of the SIP License
# Agreement. See the file LICENSE for more details.
Expand All @@ -11,8 +8,17 @@
# License v2 or v3 as published by the Free Software Foundation which can be
# found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package.
#
# SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.


from typing import overload, Sequence, Union
Expand All @@ -35,7 +41,7 @@ Buffer = Union['array', 'voidptr', str, bytes, bytearray]


# The array type.
array = Sequence
class array(Sequence): ...


# The voidptr type.
Expand Down Expand Up @@ -70,14 +76,16 @@ class voidptr:

def setsize(self, size: int) -> None: ...

def setwriteable(self, bool: bool) -> None: ...
def setwriteable(self, bool) -> None: ...


# Remaining functions.
def assign(obj: simplewrapper, other: simplewrapper) -> None: ...
def cast(obj: simplewrapper, type: wrappertype) -> simplewrapper: ...
def delete(obj: simplewrapper) -> None: ...
def dump(obj: simplewrapper) -> None: ...
def enableautoconversion(type: wrappertype, enable: bool) -> bool: ...
def enableoverflowchecking(enable: bool) -> bool: ...
def getapi(name: str) -> int: ...
def isdeleted(obj: simplewrapper) -> bool: ...
def ispycreated(obj: simplewrapper) -> bool: ...
Expand Down