-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Dependencies via pip extras #2476
Conversation
Flask-Admin does not yet support Flask v3+, WTForms v3+, or SQLAlchemy 2+. Let's clearly mark this. And then we also define a set of pip extras, which should let users pull in the supported versions of dependencies for additional features (eg supporting geography, mapping, redis CLI, exporting to lots of formats, etc). And fix our minimum python version from 3.6 to 3.8. This was done a little while ago, but not updated here correctly.
And pin requirements files again now that we don't include any direct project dependencies within the `requirements/*` files.
- Disable `mongoengine` tests. This is the main problem here: `Flask-Mongoengine` is now fairly out-of-date and doesn't support recent Flask 2.x versions, which our tests try to pull in. With the change to how we declare our dependencies (flask), we can't really install a specific version of flask that's lower than what we support across all of Flask-Admin, which we'd need to do. I don't think we want a special case for Flask-Mongoengine. I think we need to accept that Flask-Mongoengine is now unsupported and doesn't work with Flask-Admin, assuming people are using recent versions of Flask etc. We may need to consider deprecating Flask-Mongoengine support altogether, but I'm leaving that for a separate issue. - flask.Markup was removed; use markupsafe instead - Use BytesIO for file uploads rv = client.post('/admin/myfileadmin/upload/', > data=dict(upload=(StringIO(""), 'dummy.txt'))) E TypeError: a bytes-like object is required, not 'str' - Update import path - Ignore deprecation warning from flask.testing - Flask now requires all routes/views to be registered before the first request - Werkzeug 2.3.0+ no longer quotes URL params - Ignore SQLAlchemy2 deprecation warning
19ba3c8
to
033b698
Compare
eb70e67
to
4e45ea9
Compare
4e45ea9
to
299ab42
Compare
299ab42
to
2751c88
Compare
appengine-python-standard is becoming slightly out-of-date; it requires urllib3 < 2.0.0. Our tests dependencies want to install a version above 2.0.0, and with `constrain_package_deps` enabled this then causes tox to be unable to install flask-admin's dependencies because they conflict with the test dependencies. Using a constraints file we can force tox to install urllib3<2 when installing test deps, which then allows flask-admin to be installed with no dependency conflicts.
I'm pleased that you renamed some dependencies. I hated the What about using Hatch 🚀 to manage project environments and dependencies? This way, we would get rid of |
So did I, about 5 minutes after doing it 😂 It does feel better without. I think re: using hatch - there's probably quite a few options at the moment (poetry, hatch, rye, etc) - and I think as part of the pallets ecosystem we probably need to stay in lock-step with what the rest of the projects are doing generally. So I'm not super keen to visit that yet, but maybe worth kicking off a discussion in the discord? |
😆
Did we ever use Hatch with Flask Admin before? Poetry is another great option but it doesn't support independent environments...
Ehem... let's do that 😄. |
I think this will make things a lot clearer for people, and lower maintenance by not individually listing the requirements for each of the examples. I can't say I've had the time to review every line, but go for it - I do see a number of fixes for newer dependencies in here. An alternative |
@cjmayo I believe so, yes - following what flask-sqlalchemy does: https://github.com/pallets-eco/flask-sqlalchemy/blob/main/tox.ini#L15-L17 |
We previously haven't ever had a single place that clearly says what dependencies Flask-Admin expects for the 'optional' features, and what versions of those dependencies are required.
This PR pulls all of this information into
pyproject.toml
and exposes them as extras.All of the examples have been updated to install using these extras, which simplifies their requirements files.
OLD NEWS
temporarily disabled `constrain_package_deps`
**This is now outdated and a recent commit on the PR has re-enabled this by adding a constraints file.**
The controversial change here is that, now, in our 'standard' test runs, we can't get the
flask-mongoengine
tests to pass because that dependency is very out of date and doesn't support the latest versions of Flask that we support. We may need to consider deprecating/removingflask-mongoengine
altogether, but I'm leaving that decision to be had on this thread: #2466. I've added a 'snowflake' tox env for flask-mongoengine that pins required (old) versions of flask/werkzeug/sqlalchemy in the mean time and disabled flask-mongoengine tests in the main suites.I've also had to disable
constrain_package_deps
intox.ini
as we're getting a dependency conflict from google's appengine-python-standard, which requires urllib3<2. I've raised an issue on this here: GoogleCloudPlatform/appengine-python-standard#121Documentation update
fixes: #2452