I have been trying for months to work out how to correctly package my python application for use with pip.
I can upload the application to pypi without problems:
> python3 setup.py sdist bdist_wheel
> twine check dist/*
> twine upload dist/*
I can install from pip without obvious problems:
> sudo apt install python3-pip
> sudo pip3 install tartube
But the application will not run. There are two issues: firstly, the main script (in /usr/local/bin) can't see any other python modules, even though they have been correctly installed to /usr/local/lib/python3.6/dist-packages.
Secondly, a folder full of icons doesn't seem to be installed at all.
I've read about a billion "how to package your python apps" tutorials, none of which provide any clues. Presumably the setup.py file is at fault; can anyone see any obvious problems with it?
Can't find the edit post button. Here is the actual error message generated:
I can upload the application to pypi without problems:
> python3 setup.py sdist bdist_wheel
> twine check dist/*
> twine upload dist/*
I can install from pip without obvious problems:
> sudo apt install python3-pip
> sudo pip3 install tartube
But the application will not run. There are two issues: firstly, the main script (in /usr/local/bin) can't see any other python modules, even though they have been correctly installed to /usr/local/lib/python3.6/dist-packages.
Secondly, a folder full of icons doesn't seem to be installed at all.
I've read about a billion "how to package your python apps" tutorials, none of which provide any clues. Presumably the setup.py file is at fault; can anyone see any obvious problems with it?
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Import modules
import os
import setuptools
import sys
# For the Debian distribution, use an environment variable. When specified,
# the 'tartube_debian' file is the executable, rather than the 'tartube'
# file
# When the 'tartube_debian' file is the executable, youtube-dl updates are
# disabled, and Tartube's config file is stored at $XDG_CONFIG_HOME
# The package maintainer should use
# TARTUBE_NO_UPDATES=1 python3 setup.py build
env_var_name = 'TARTUBE_NO_UPDATES'
env_var_value = os.environ.get( env_var_name, None )
script_exec = os.path.join('tartube', 'tartube')
if env_var_value is not None:
if env_var_value == '1':
script_exec = os.path.join('tartube', 'tartube_debian')
sys.stderr.write('youtube-dl updates are disabled in this version')
else:
sys.stderr.write(
"Unrecognised '%s=%s' environment variable!\n" % (
env_var_name,
env_var_value,
),
)
# Setup
setuptools.setup(
name='tartube',
version='1.3.077',
description='GUI front-end for youtube-dl',
long_description="""Tartube is a GUI front-end for youtube-dl, partly based
on youtube-dl-gui and written in Python 3 / Gtk 3""",
long_description_content_type='text/markdown',
url='https://tartube.sourceforge.io',
author='A S Lewis',
author_email='[email protected]',
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
'Topic :: Multimedia :: Video',
'License :: OSI Approved' \
+ ' :: GNU General Public License v3 or later (GPLv3+)',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
keywords='tartube video download youtube',
packages=setuptools.find_packages(
exclude=('docs', 'icons', 'nsis', 'tests'),
),
include_package_data=True,
python_requires='>=3.0, <4',
install_requires=['requests', 'xdg'],
scripts=[script_exec],
project_urls={
'Bug Reports': 'https://github.com/axcore/tartube/issues',
'Source': 'https://github.com/axcore/tartube',
},
)Can't find the edit post button. Here is the actual error message generated:
Output:Traceback (most recent call last):
File "/usr/local/bin/tartube", line 33, in <module>
import mainapp
ModuleNotFoundError: No module named 'mainapp'
