No date type support
Closed this issue · 8 comments
The fixedwidth_test.py lists one of the fields as date:
SAMPLE_CONFIG = {
...
"date": {
"required": False,
"type": "date",
"default": datetime.datetime.strptime('20170101', '%Y%m%d'),
"start_pos": 101,
"end_pos": 108,
"alignment": "right",
"padding": " ",
"format": '%Y%m%d',
},
However, when attempting to use similar config, I get:
ValueError: Field purchdate has an invalid type (date). Allowed: 'string', 'integer', 'decimal', 'numeric'
Is the test working, if there is no support for it in the module?
That's extremely odd. The code that checks for that explicitly looks for date.
The tests are currently passing. What version of the library are you using?
The one that setuptools automatically selected on my Ubuntu 16.04 LTS, which is
FixedWidth-1.0-py2.7.egg
setuptools 20.7.0 from /usr/lib/python2.7/dist-packages (Python 2.7)
It looks like a bug in your installation then.
FixedWidth-1.0
is the last distributed version (look for example in https://pypi.python.org/pypi/FixedWidth) which does not have support for date
(see the test source file).
On the other hand, the code snippet shown above is from current branch, which does have support for it (although with some remaining quirks.)
We fixed recently (#16) an issue, to allow one to run the test program while developing, without selecting the installed library; perhaps it is the issue you are seeing?
Well, Decimal class precision is not working in released 1.0 version as well; do you happen to have any plans to release the updated branch in a new version directly downloadable from pip without dealing with branches?
pip search FixedWidth
FixedWidth (1.0) - Two-way fixed-width <--> Python dict converter.
INSTALLED: 1.0 (latest)
Hey @gnudiff. Yes, sorry I haven't published it in a while. I don't use it (or even Python much) anymore. Can you confirm that the current master
works well enough to be put out as a new release?
I haven't released it in a while because I always forget the procedure for publishing to PyPi, and they seem to have changed it every time I look. 😔
Dont see new version published in PyPI .. any plans to do that?
@vsafin: Yes, thanks for the reminder. The only reason I haven't done it yet is that it seems like every time I try to do that, the procedure for uploading to PyPi has changed, and the packaging requirements for setup.py
have also changed.
If you feel helpful, would you mind adding a link to the latest PyPi instructions? I'll try it. If it fails due to my setup.py
being dated, then I'll need some help fixing it -- I don't really use Python much anymore.