Skip to content

Fix pip install from tarball - #9

Open
jpic wants to merge 1 commit into
Spredzy:masterfrom
jpic:master
Open

Fix pip install from tarball#9
jpic wants to merge 1 commit into
Spredzy:masterfrom
jpic:master

Conversation

@jpic

@jpicjpic commented Jan 11, 2019

Copy link
Copy Markdown

Currently, this works pip install -e git+https://github.com/Spredzy/python-c14.git#egg=c14

This PR also enables python setup.py upload to produce an uploaded file that will work with pip install c14, which otherwise results in quite some pain:

jpic@mrs-staging:~$ pip install --user c14
Collecting c14
Downloading https://files.pythonhosted.org/packages/c3/e7/555a5a9b49fa703418251a7088fb0ad65a90afb6192725348fb175e870ff/c14-0.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-DLsfHq/c14/setup.py", line 21, in <module>
from c14 import version
File "c14/__init__.py", line 18, in <module>
import slumber
ImportError: No module named slumber
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-DLsfHq/c14/
jpic@mrs-staging:~$ pip install --user slumber
Collecting slumber
Using cached https://files.pythonhosted.org/packages/9c/53/8e2cb7501c17f9367b02a8ce62cb463824f9c5f7884e4fe6c5f13cb79858/slumber-0.7.1-py2-none-any.whl
....
Installing collected packages: urllib3, certifi, chardet, idna, requests, slumber
Successfully installed certifi-2018.11.29 chardet-3.0.4 idna-2.8 requests-2.21.0 slumber-0.7.1 urllib3-1.24.1
jpic@mrs-staging:~$ pip install --user c14
Collecting c14
Using cached https://files.pythonhosted.org/packages/c3/e7/555a5a9b49fa703418251a7088fb0ad65a90afb6192725348fb175e870ff/c14-0.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-MN9k8m/c14/setup.py", line 51, in <module>
install_requires=_get_requirements(),
File "/tmp/pip-build-MN9k8m/c14/setup.py", line 27, in _get_requirements
with open(requirements_path, 'r') as f:
IOError: [Errno 2] No such file or directory: '/tmp/pip-build-MN9k8m/c14/requirements.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-MN9k8m/c14/

The approach taken by this patch is to remove boilerplate and let setupmeta do the work.

Remove boilerplate and let setupmeta do the work
@jpic

jpic commented Jan 11, 2019

Copy link
Copy Markdown
Author

Demonstration, python setup.py explain:

jpic@mrs-staging:~/python-c14$ python setup.py explain
running explain
author: (explicit ) Yanis Guenane
author_email: (explicit ) yanis@guenane.org
bugtrack_url: (auto-fill ) https://github.com/Spredzy/python-c14/issues
classifiers: (explicit ) 6 items: ["Environment :: Console", "Intended Audience :: Developers", "...
description: (README.rst:1 ) C14 Python Wrapper
include_package_data: (explicit ) True
install_requires: (requirements.txt ) ["slumber"]
license: (auto-fill ) Apache 2.0
long_description: (README.rst ) C14 Python Wrapper ================== This module is a python wrapper ar...
long_description_content_type: (README.rst ) text/x-rst
name: (explicit ) c14-jpic-test
packages: (explicit ) ["c14"]
setup_requires: (explicit ) setupmeta
tests_require: (test-requirements.txt) ["flake8", "pep8", "tox"]
url: (explicit ) https://github.com/Spredzy/python-c14
version: (c14/__init__.py:21 ) 0.0.2

Building and uploading work the same. But as a result, pip install works:

jpic@mrs-staging:~/python-c14$ pip install --user c14-jpic-test
Collecting c14-jpic-test
Downloading https://files.pythonhosted.org/packages/c9/b5/9109979be99923ac7b40dc611015830fac1a0852b0dec02fde08ed467a36/c14-jpic-test-0.0.2.tar.gz
Building wheels for collected packages: c14-jpic-test
Running setup.py bdist_wheel for c14-jpic-test ... done
Stored in directory: /home/jpic/.cache/pip/wheels/e6/06/47/162c232b5a6719ec7f78a6e24349bb4e587f6bb16a012a35c8
Successfully built c14-jpic-test
Installing collected packages: c14-jpic-test
Successfully installed c14-jpic-test-0.0.2

The PR will work as-is.

But, if you want to, like me, test with another package namespace then you will need to hardcode packages as such:

jpic@mrs-staging:~/python-c14$ git diff
diff --git a/setup.py b/setup.py
index ca52ef8..37316bd 100644
--- a/setup.py
+++ b/setup.py
@@ -20,7 +20,8 @@ import setuptools
setuptools.setup(
- name='c14',
+ name='c14-jpic-test',
+ packages=['c14'],
setup_requires='setupmeta',
author='Yanis Guenane',
author_email='yanis@guenane.org',

Njoy

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jpic