Bug 221311 - [NEW PORT] databases/influxdb-python: InfluxDB Python client
Summary: [NEW PORT] databases/influxdb-python: InfluxDB Python client
Status: Closed Overcome By Events
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: feature, needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2017-08-07 14:04 UTC by Konstantin Shapkin
Modified: 2018-05-15 08:31 UTC (History)
5 users (show)

See Also:
koobs: maintainer-feedback? (kestel)


Attachments
InfluxDB-Python is a client for interacting with InfluxDB. (1.71 KB, patch)
2017-08-07 14:04 UTC, Konstantin Shapkin
no flags Details | Diff
New version of diff with CHEESESHOP repo and tests (1.77 KB, patch)
2017-08-08 07:16 UTC, Konstantin Shapkin
no flags Details | Diff
Updated Makefile (1.68 KB, patch)
2017-08-08 12:42 UTC, Konstantin Shapkin
no flags Details | Diff
Remove shebangfix, add post-path, add LICENSE_FILE (1.81 KB, patch)
2017-08-15 09:45 UTC, Konstantin Shapkin
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Shapkin 2017-08-07 14:04:05 UTC
Created attachment 185129 [details]
InfluxDB-Python is a client for interacting with InfluxDB.

InfluxDB Python client
InfluxDB-Python is a client for interacting with InfluxDB.
Comment 1 Kubilay Kocak freebsd_committer freebsd_triage 2017-08-07 14:15:42 UTC
Thank you for contributing a new FreeBSD Ports Konstantin.

A few review items:

- Port should be named (/PORTNAME) after its PyPI name (https://pypi.python.org/pypi/influxdb). Directory should be py-PORTNAME

- Use MASTER_SITES=CHEESESHOP (PyPI) unless there is a compelling reason to use an alternate source (Eg: GitHub). Examples include if important (eg: test) files are missing from the PyPI source distribution (sdist)

- Combine RUN_DEPENDS lines using \ as the entry/line separator

- Add TEST_DEPENDS (matching setup.py:tests_requires or test dependencies) and if possible a working do-test: target that runs the test suite (even if it fails)
Comment 2 Kubilay Kocak freebsd_committer freebsd_triage 2017-08-07 14:17:10 UTC
Regarding the test target, I notice that setup.py sets 'test_suite' so the following should just work:

do-test:
    @cd ${WRKSRC} && ${PYTHON_CMD} ${PYDISTUTILS_SETUP} test
Comment 3 Konstantin Shapkin 2017-08-08 07:16:42 UTC
Created attachment 185145 [details]
New version of diff with CHEESESHOP repo and tests

Hello Kubilay, thanks for you reply.

I made some changes in Makefile:
1. change repo type to CHEESESHOP.
2. Add TEST_DEPENDS
3. Add TEST_TARGET and do-test section, but with test make failed. 

Poudriere tells next: 
byte-compiling /wrkdirs/usr/ports/databases/py-influxdb/work/stage/usr/local/lib/python2.7/site-packages/influxdb/chunked_json.py to chunked_json.pyc
writing byte-compilation script '/tmp/tmpYqUDBZ.py'
/usr/local/bin/python2.7 -O /tmp/tmpYqUDBZ.py
removing /tmp/tmpYqUDBZ.py
running install_egg_info
running egg_info
writing requirements to influxdb.egg-info/requires.txt
writing influxdb.egg-info/PKG-INFO
writing top-level names to influxdb.egg-info/top_level.txt
writing dependency_links to influxdb.egg-info/dependency_links.txt
reading manifest file 'influxdb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'influxdb.egg-info/SOURCES.txt'
Copying influxdb.egg-info to /wrkdirs/usr/ports/databases/py-influxdb/work/stage/usr/local/lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info
running install_scripts
writing list of installed files to '/wrkdirs/usr/ports/databases/py-influxdb/work/.PLIST.pymodtmp'
====> Compressing man pages (compress-man)
===========================================================================
====> Running Q/A tests (stage-qa)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for items in pkg-plist which are not in STAGEDIR
===> No pkg-plist issues found (check-plist)
====>> Checking for staging violations... done
=======================<phase: package        >============================
===>  Building package for py27-influxdb-4.1.1
[: =: unexpected operator
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/PKG-INFO:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/PKG-INFO
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/SOURCES.txt:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/SOURCES.txt
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/dependency_links.txt:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/dependency_links.txt
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/requires.txt:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/requires.txt
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/top_level.txt:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb-4.1.1-py2.7.egg-info/top_level.txt
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb/__init__.py:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb/__init__.py
pkg-static: Unable to access file /wrkdirs/usr/ports/databases/py-influxdb/work/stage/lib/python2.7/site-packages/influxdb/__init__.pyc:No such file or directory
pkg-static: DEVELOPER_MODE: Plist error, missing file: lib/python2.7/site-packages/influxdb/__init__.pyc


On manual extract (make extract) and run "python2 setup.py test" I got next error:
Using /usr/ports/databases/py-influxdb/work/influxdb-4.1.1/.eggs/coverage-4.4.1-py2.7-freebsd-11.1-RELEASE-amd64.egg
running egg_info
writing requirements to influxdb.egg-info/requires.txt
writing influxdb.egg-info/PKG-INFO
writing top-level names to influxdb.egg-info/top_level.txt
writing dependency_links to influxdb.egg-info/dependency_links.txt
reading manifest file 'influxdb.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'influxdb.egg-info/SOURCES.txt'
running build_ext
Traceback (most recent call last):
  File "setup.py", line 56, in <module>
    'Topic :: Software Development :: Libraries :: Python Modules',
  File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/test.py", line 211, in run
    self.run_tests()
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/test.py", line 234, in run_tests
    **exit_kwarg
  File "/usr/local/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/local/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/local/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/local/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/local/lib/python2.7/unittest/loader.py", line 91, in loadTestsFromName
    module = __import__('.'.join(parts_copy))
ImportError: No module named tests
Comment 4 Konstantin Shapkin 2017-08-08 07:24:12 UTC
Maybe it happens because python can't find module requests-mock (it is in test-requirements.txt file), but I can't find it in ports tree and don't wrote in Makefile TEST_DEPENDS.
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2017-08-08 10:22:49 UTC
(In reply to Konstantin Shapkin from comment #4)

I don't think so, there's a few issues in the Makefile:

1) ${PYTHON_PKGNAMEPREFIX}nose-cov>0:devel/py-nose-cov \

Has a \ but no line below it. I think this is the cause

2) TEST_TARGET=    do-test

Not needed when defining do-test

3) MAINTAINER has a null value

4) IGNORE_MASTER_SITE_LOCAL=YES not needed

5) PORTREVISION=   0 not needed

6) Use tabs not spaces for alignment: VARIABLE=[tab(s)]<value>

7) What is being shebangfix'd ?

8) pkg-descr: WEB: https://pypi.python.org/pypi/influxdb

WEB -> WWW

Run the port through portlint (-AC) to identify other issues
Comment 6 Kubilay Kocak freebsd_committer freebsd_triage 2017-08-08 10:24:12 UTC
(In reply to Konstantin Shapkin from comment #4)

If something is defined a *_requires but not installed as a port via TEST_DEPENDS, setuptools will install it in the build directory itself.
Comment 7 Kubilay Kocak freebsd_committer freebsd_triage 2017-08-08 10:35:45 UTC
(In reply to Konstantin Shapkin from comment #4)

As far as "ImportError: No module named tests" goes:

a) there is no tests/ directory (module) in the root
b) there *is* an influxdb/tests directory (module)
c) their CI (travis.yml/tox.ini) configuration runs: 'nosetests -v ...' directly
d) (c) means they don't test their "python setup.py test" test entry point

My guess is that tests/ was probably moved to influxdb/tests at some point, and setup.py:test_suite was not updated (to 'influxdb.tests') to match. Since nose has good test discovery, it finds influxdb/tests without being pointed to it.

This all means, you can probably run tests by either:

1) Patching setup.py:test_suite, settings its value to 'influxdb.tests'
2) use ${PYTHON_CMD} -m nose as the test command

Personally, I would do (1), as I prefer to use the canonical 'pythonX.Y setup.py test' command, making it work if I have to (with patches), and submitting the changes/bugfixes upstream so projects know that people care.
Comment 8 Konstantin Shapkin 2017-08-08 12:42:35 UTC
Created attachment 185152 [details]
Updated Makefile

(In reply to Kubilay Kocak from comment #6)
Thank you for help.
I've fix all your notes except manual test package (run python setup.py test after extract), is it high priority problem?

For port portlint now tells "looks fine".
Comment 9 Richard Gallamore freebsd_committer freebsd_triage 2017-08-14 19:53:17 UTC
Added your patch for 1 koobs and it looks like make test works, there is a new error though, not sure what it means.

Traceback (most recent call last):                         
  File "<string>", line 1, in <module>                     
  File "setup.py", line 56, in <module>                    
    'Topic :: Software Development :: Libraries :: Python Modules',                                                    
  File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup                                                
    dist.run_commands()                                    
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands                                         
    self.run_command(cmd)                                  
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command                                          
    cmd_obj.run()                                          
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/test.py", line 211, in run                           
    self.run_tests()                                       
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/test.py", line 234, in run_tests                     
    **exit_kwarg                                           
  File "/usr/local/lib/python2.7/unittest/main.py", line 94, in __init__                                               
    self.parseArgs(argv)                                   
  File "/usr/local/lib/python2.7/unittest/main.py", line 149, in parseArgs                                             
    self.createTests()                                     
  File "/usr/local/lib/python2.7/unittest/main.py", line 158, in createTests                                           
    self.module)                                           
  File "/usr/local/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames                                  
    suites = [self.loadTestsFromName(name, module) for name in names]                                                  
  File "/usr/local/lib/python2.7/unittest/loader.py", line 103, in loadTestsFromName                                   
    return self.loadTestsFromModule(obj)                   
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/test.py", line 43, in loadTestsFromModule            
    tests.append(self.loadTestsFromName(submodule))        
  File "/usr/local/lib/python2.7/unittest/loader.py", line 103, in loadTestsFromName                                   
    return self.loadTestsFromModule(obj)                   
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/test.py", line 43, in loadTestsFromModule            
    tests.append(self.loadTestsFromName(submodule))        
  File "/usr/local/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName                                   
    parent, obj = obj, getattr(obj, part)                  
AttributeError: 'module' object has no attribute 'dataframe_client_test'                                               
*** Error code 1



Also, a few things that should be changed.
* Add LICENSE_FILE, it is in the source
* Shebangfix is not being used, remove it or use it.
NO_ARCH should be after the USES and USE_*.

I added the following to patch the tests...



post-patch:
          ${REINPLACE_CMD} "s/test_suite.*/test_suite='${PORTNAME}.tests\',/" \
                      ${WRKSRC}/setup.py
Comment 10 Konstantin Shapkin 2017-08-15 09:45:39 UTC
Created attachment 185432 [details]
Remove shebangfix, add post-path, add LICENSE_FILE

(In reply to Richard Gallamore from comment #9)

Hello Richard, 
thanks for your comment. I've edited the Makefile and include your comments.

I haven't got this python error and don't know how to reproduce it.
Comment 11 Tobias Kortkamp freebsd_committer freebsd_triage 2018-05-15 08:27:51 UTC
It was added in ports r467161.

https://www.freshports.org/databases/py-influxdb