Create ncwriter package#18
Conversation
|
@lwgordonimos What am I missing? As far as I understand, I should be able to create a new virtualenv and then simply |
| # 'jsonschema==2.6.0', | ||
| # 'numpy>=1.13.0', | ||
| # 'netCDF4' | ||
| # ] |
There was a problem hiding this comment.
I also tried specifying the required packages here, and then setting requirements.txt exactly as in aodncore, but then I couldn't run pip install -r requirements.txt
There was a problem hiding this comment.
It's a chicken and egg scenario... it is because it's trying to import the module in setup.py which depends on netCDF4, which hasn't been installed yet.
Importing ncwriter.version implicitly imports ncwriter, which in turn is importing from it's submodules.
Obtaining file:///home/lwgordon/git/aodn/aodn-netcdf-tools
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/lwgordon/git/aodn/aodn-netcdf-tools/setup.py", line 3, in <module>
from ncwriter.version import __version__
File "ncwriter/__init__.py", line 1, in <module>
from .template import DatasetTemplate
File "ncwriter/template.py", line 17, in <module>
import netCDF4
ImportError: No module named netCDF4
----------------------------------------
This works in pipeline because the top level module has an empty __init__.py, so doesn't start a chain of imports...
Interesting that most options don't advocate importing the module to source the version, which kind of makes sense to avoid this exact issue.
https://packaging.python.org/guides/single-sourcing-package-version/
Maybe we need to choose a standard mechanism for all packaging, one that doesn't import the package, and reads the file directly to avoid this popping up all the time.
I think I prefer option 3 using exec actually, because it still must be a string Python file, but doesn't involve any imports.
Also, it's good enough for the requests module, which is generally a very good place to look for "how to do things right": https://github.com/requests/requests/blob/master/setup.py#L67
| - "2.7" | ||
|
|
||
| install: | ||
| - pip install -r requirements.txt |
There was a problem hiding this comment.
This exact call is implicit in Travis Python containers, so you can omit this unless it is customised somehow
|
@lwgordonimos Should be good to go now! |
WIP
Fixes #15