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

Upload to PyPI #364

Open
JakobDev opened this issue Oct 29, 2020 · 7 comments
Open

Upload to PyPI #364

JakobDev opened this issue Oct 29, 2020 · 7 comments

Comments

@JakobDev
Copy link

It would be nice, if this can be publicised on PyPI. The installation is currently hard for Pytjhon developers who haven't worked with C/C++. And it can be added to the requirements, if it's on PyPI.

@willbelr
Copy link
Contributor

willbelr commented Dec 19, 2020

A PyPi package would certainly be useful as it is the most reliable way to share PyQt apps across Linux distributions. Would also love to see this happen.

@yan12125
Copy link
Member

That sounds a good idea but I have no experience on creating Python packages with C/C++ codes. Do you have an example setup.py?

@willbelr
Copy link
Contributor

My experience is limited to python packages, so I'm not sure how it could be done for a package containing CPP source which require build steps and non-python packages such as lxqt-build-tools. Perhaps it should be compiled before hand?

#!/usr/bin/python3
import setuptools
import setuptools.command.build_py

# Useful resources;
# https://pypi.org/classifiers/
# https://docs.python.org/3.8/distutils/setupscript.html (about package_data and data_files)

VERSION = "0.16.1-2"
CLASSIFIERS = [
    "License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
    "License :: OSI Approved :: BSD License",
    "License :: Public Domain",
    "Operating System :: POSIX :: Linux",
    "Operating System :: POSIX :: BSD",
    "Operating System :: MacOS :: MacOS X",
    "Programming Language :: Python :: 3.6",
]


class Example(setuptools.command.build_py.build_py):
    def run(self):
        """ Add custom build steps during install """
        pass
        setuptools.command.build_py.build_py.run(self)


def setup():
    setuptools.setup(
        name="QTermWidget",
        description="A terminal widget for Qt, used by QTerminal",
        keywords="Terminal, Qt, PyQt",
        url="https://github.com/lxqt/qtermwidget",
        author="LXQt",
        version=VERSION,
        classifiers=CLASSIFIERS,
        install_requires=["pyqt5", "lxqt-build-tools"],  # lxqt-build-tools is not valid PyPi pkg, is it required though?
        cmdclass={"build_py": Example},  # Optionally add custom build steps
        packages=setuptools.find_packages(),
        data_files=[],
        # package_data={"": ["ui/icons/*.svg"]},
        # entry_points={"gui_scripts": [f"{ID}={ID}:main"]},  # No entry point needed as this is not a standalone program
    )


if __name__ == "__main__":
    setup()

@willbelr
Copy link
Contributor

willbelr commented Dec 24, 2020

I believe the good approach would be to create a python wheel, like PyQt5 uses for PyPi.

https://github.com/pypa/wheel

@irgolic
Copy link

irgolic commented Feb 1, 2021

Any workarounds for distributing PyQt applications with QTermWidget?

@JakobDev JakobDev mentioned this issue Oct 27, 2021
@yan12125
Copy link
Member

yan12125 commented Mar 6, 2022

I created a pull request to use SIP 5.x for PyQt bindings at #465. As a bonus, the build script now creates a Python wheel. Although it's not suitable for PyPI yet (it requires libqtermwidget5.so.1 installed beforehand), it's a big step towards it. I hope everyone using PyQt can test the wheel and share the results - either good or bad.

@nado218
Copy link

nado218 commented Aug 22, 2024

Iam new to pyQT and Iam trying to build python bindings for QtermWidget. I could compile and install qtermwidget library but when i try to create a python wheel using sip-wheel --verbose, i get the below error.
What iam I missing here. My library is installed in /usr/local/

cd QTermWidget/ && ( test -e Makefile || /usr/lib/qt5/bin/qmake -o Makefile /tmp/tmp0cyt8_wt/QTermWidget/QTermWidget.pro ) && make -f Makefile
make[1]: Entering directory '/tmp/tmp0cyt8_wt/QTermWidget'
g++ -c -pipe -O2 -fno-exceptions -Wall -Wextra -D_REENTRANT -fPIC -DPy_LIMITED_API=0x03080000 -DSIP_PROTECTED_IS_PUBLIC -Dprotected=public -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_PLUGIN -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I.. -I/usr/include/python3.10 -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o sipQTermWidgetcmodule.o sipQTermWidgetcmodule.cpp
/home/ndokuri/Qualcomm/QT5/qtermwidget/pyqt/sip/qtermwidget.sip:14:10: fatal error: qtermwidget.h: No such file or directory
14 | #include <qtermwidget.h>
| ^~~~~~~~~~~~~~~
compilation terminated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants