Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For anyone who needs a Python 3-compatible FormAlchemy that actually works, read here... #71

Open
coredumperror opened this issue Nov 4, 2020 · 24 comments

Comments

@coredumperror
Copy link
Contributor

So if you're like me, and needed to update an ancient webapp that uses FormAlchemy, but were frustrated by the lack of a release that fixes the WebHelpers incompatibility which causes an error related to not being able to use lists/tuples for options, here's how to fix that:

git clone [email protected]:FormAlchemy/formalchemy.git
cd formalchemy
python setup.py sdist
cd dist

You're now in a folder with a file called FormAlchemy-1.6.dev0.tar.gz. Put that file somewhere online (a S3 bucket works great), and then add that URL to your requirements file. You may also need to update from WebHelpers==1.3 to WebHelpers2==2.0, but I'm not 100% certain about that.

@aconrad
Copy link
Contributor

aconrad commented Nov 4, 2020 via email

@coredumperror
Copy link
Contributor Author

Yes, master has a number of changes that did not make it into 1.5.5, including one that makes it compatible with a change in WebHelpers from several years ago, which completely broke FormAlchemy.

Also, something I forgot to mention is that line 7 of setup.py needs to be removed, because the six library is not available during the execution of setup.py while installing FormAlchemy through pip. It does an import that doesn't even get used anyway, so there's no harm in removing it.

@sallner
Copy link
Contributor

sallner commented Nov 4, 2020

@coredumperror Maybe you could add a PR to make that change easier to include in the next release?

@gawel @aconrad @smurfix Do you see a chance to cut a release?

@coredumperror
Copy link
Contributor Author

Sure, I could do that. To be honest, I expected my comment to sit here, unread, for possibly years, until someone like myself came along and tried to update an ancient codebase that used FormAlchemy. If I'd know that not one, but two people would actually come along and see it within a day, I would have made a PR.

So I'll go do that. Though I believe it'll just be that one change to setup.py, as there are no other changes necessary on the master branch to make a working version.

@aconrad
Copy link
Contributor

aconrad commented Nov 4, 2020

Thank you @coredumperror, this is much appreciated. Once it gets merged, I'll see if I have enough permissions to issue a new release.

@sallner
Copy link
Contributor

sallner commented Nov 6, 2020

@coredumperror What do you think, will you need to support your app for a longer period of time? I.e., is it reasonable to keep FormAlchemy in a state that is reliably tested via CI? I did not managed to run a buildout with successful tests afterwards, so there might be some work involved beyond the usual cleanup.

@sallner
Copy link
Contributor

sallner commented Nov 6, 2020

@aconrad Would you cut a release, as I do not have any PyPI rights for this package. There is a guide to create a release in the repo, although I failed with the tests.

@aconrad
Copy link
Contributor

aconrad commented Nov 6, 2020

@sallner thanks for merging the PR. Could you do the release if I gave you the necessary PyPI permissions to publish a new FA release?

@sallner
Copy link
Contributor

sallner commented Nov 6, 2020

@aconrad Yes, I would do that.

@aconrad
Copy link
Contributor

aconrad commented Nov 6, 2020

What is your pypi username?

@sallner
Copy link
Contributor

sallner commented Nov 7, 2020

it is sallner, just like in github.

@sallner
Copy link
Contributor

sallner commented Nov 10, 2020

@aconrad Have you tried to give me permission on PyPI?

@smurfix
Copy link
Contributor

smurfix commented Nov 10, 2020 via email

@sallner
Copy link
Contributor

sallner commented Nov 10, 2020

Thank you, that worked. I will prepare a release.

@aconrad
Copy link
Contributor

aconrad commented Nov 10, 2020 via email

@coredumperror
Copy link
Contributor Author

Glad to hear that a working official release is coming!

@sallner
Copy link
Contributor

sallner commented Nov 12, 2020

@coredumperror I made a release 1.5.6 https://pypi.org/project/FormAlchemy/1.5.6/. But I have to say, that the 1.5.5 already included the fix of the wrong six import in setup.py. The respective code was found without tag on the 1.5 branch. Please give it a try, whether it still works.

Sidenote: Do you plan to use FormAlchemy for a longer time? Do we need to activate a CI? It is rather difficult to clean the repo and make tests working again.

@sallner sallner closed this as completed Nov 12, 2020
@coredumperror
Copy link
Contributor Author

the 1.5.5 already included the fix of the wrong six import in setup.py.

Yes, but it didn't include the other changes made to master since 1.5.5 was released. Those were already working in builds made manually from master. I only did the PR for this fix because it made it possible to make a new, working PyPI release that has those changes.

I don't believe there's any good reason to make any further FormAlchemy releases. At least not for my sake. The only reason I came to this issue queue was because I'm working on updating an ancient app that my team hasn't got time to rewrite from scratch using modern tech. We wanted to update the app to Python 3, which meant we absolutely needed to update our version of FormAlchemy from 1.4.3. But I found that the latest version on PyPI was broken due to a later change made to one of its dependencies. Now that that's fixed, FormAlchemy should be pretty stable.

@aconrad
Copy link
Contributor

aconrad commented Nov 12, 2020

Thanks @sallner for making the release, much appreciated! @coredumperror thanks again for your report and everyone else who chimed in. We're making people's work a little better this way.

@coredumperror
Copy link
Contributor Author

There's still a huge problem, as FormAlchemy 1.5.6 cannot be installed on Python 3, due to an import error in MsgFmt.py. cStringIO doesn't exist in Python 3.

I'm pretty sure the issue is due to the changes in setup.py related to compiling translated messages during setup. I have no idea how to deal with that, though, besides ripping it out entirely (which I tried, and it works).

I tried editing MsgFmt.py to make it Python3 compatible, but I the more editing I did, the more it broke. I eventually gave up. I have no idea what MsgFmt.py is even doing, or why. Maybe there's a better way to do what it's doing in modern Python? It seems very antiquated, from the glimpses I took at the code while fixing the string of new exceptions that kept popping up.

@smurfix
Copy link
Contributor

smurfix commented Nov 13, 2020

It's an ancient replacement for "msgfmt". Just call the system's msgfmt program.

@smurfix smurfix reopened this Nov 13, 2020
@sallner
Copy link
Contributor

sallner commented Nov 13, 2020

So we need tests anyhow. It is never a good idea to run without it and we should enforce it here again.
RDF is another thing that should be removed, as it cannot be tested because there is no way t get the software at all for me. Even with Python 2, there are some tests failing.

@smurfix
Copy link
Contributor

smurfix commented Nov 13, 2020

I pushed a rudimentary "call the system's msgfmt" PR. Could be better but does the job for now.

@shasan-beanfield
Copy link

any updates on this? It's stating to affect us upgrading to latest version of python

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants