415 Commits

Author SHA1 Message Date
David Lord
e529ad95bc Bump werkzeug from 3.0.2 to 3.0.3 in /requirements (#261) 2024-05-06 18:56:10 -07:00
dependabot[bot]
f4702f45fb Bump werkzeug from 3.0.2 to 3.0.3 in /requirements
Bumps [werkzeug](https://github.com/pallets/werkzeug) from 3.0.2 to 3.0.3.
- [Release notes](https://github.com/pallets/werkzeug/releases)
- [Changelog](https://github.com/pallets/werkzeug/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/werkzeug/compare/3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: werkzeug
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-06 19:51:48 +00:00
David Lord
a2a2b1382c remove __version__ (#260) 2024-04-30 15:10:08 -07:00
David Lord
a0ccd43e8f use feature detection for jinja extensions 2024-04-30 15:09:09 -07:00
David Lord
71b7f6f0ce remove __version__ 2024-04-30 15:04:59 -07:00
David Lord
cf69fb7f1e deprecate __version__ 2024-04-30 11:35:01 -07:00
Mac Newbold
1d990e7f52 add static type annotations (#259) 2024-04-30 12:14:19 -06:00
David Lord
cdcf917044 add static type annotations 2024-04-30 10:55:06 -07:00
Mac Newbold
691acc186b apply formatting and linting rules (#258) 2024-04-30 11:53:37 -06:00
David Lord
3573841522 apply formatting and linting rules 2024-04-30 08:28:03 -07:00
David Lord
879918429e fix links 2024-04-30 07:36:57 -07:00
David Lord
4ccb3c9be6 update project files (#257) 2024-04-29 15:38:40 -07:00
David Lord
128bd5af6f update project files
use standard project layout and tool config across all pallets and
pallets-eco projects

* add issue templates
* add dependabot grouped updates for actions and pypi
* add lock inactive closed issues workflow
* add publish workflow with slsa and trusted publishing
* simplify tests workflow matrix
* simplify docs config.py
* show license in docs
* use pip-compile to pin development dependencies
* rename test to tests
* add .editorconfig
* simplify .gitignore
* add pre-commit hooks (will run formatters  in a subsequent PR)
* pin os and python in .readthedocs.yaml
* update license with original commit date and pallets-eco
* use pyproject.toml and flit_core instead of setuptools
* only declare flask dependency
* add config for mypy and pyright (will add typing in a subsequent PR)
* readme is markdown
* add pallets-eco message to readme
* remove install and docs links from readme
* add style, typing, docs tox envs
* use faster wheel building tox config
* add tox command to update dev dependencies
2024-04-29 10:54:08 -07:00
David Lord
dfb101fb18 Bump Flask to >=2.3.0 (#256) 2024-04-29 10:39:12 -07:00
Jeff Widman
9c9f24a2f2 Bump Flask to >=2.3.0
Now that we've dropped support for Python `3.7`,
it probably makes sense to also bump our minimum
version of Flask to `2.3.0`, as that is when Flask
dropped support for Python `3.7`: https://flask.palletsprojects.com/en/3.0.x/changes/#version-2-3-0
2024-04-29 17:31:49 +00:00
David Lord
bfd4d8506f Drop unnecessary Blinker dependency (#248) 2024-04-29 10:28:52 -07:00
Jeff Widman
677bf794aa Drop unnecessary Blinker dependency
Flask requires this, so it's a transitive dep, but it's not directly used within this toolbar at all.

We do directly import the other listed packages, so they should stay.
2024-04-29 11:20:24 -06:00
David Lord
c218bb1084 drop python 3.7 support (#255) 2024-04-29 09:55:17 -07:00
David Lord
ff3ed47d12 drop python 3.7 support 2024-04-29 09:13:37 -07:00
Jeff Widman
4225f7f4ad Bump to 0.15.1 (#254)
Bump to `0.15.1` release so that we can get this minor bugfix live:
* #253
0.15.1
2024-04-27 11:03:27 -07:00
Joel Burton
a63f64051b Fix prob w/using w/o SQLAlchemy (#253) 2024-04-25 14:47:07 -07:00
Mac Newbold
bf21647c4b Bump to 0.15.0 (#251) 0.15.0 2024-04-24 14:38:33 -06:00
Jeff Widman
818e5f2d62 Bump to 0.15.0
We've merged a number of deprecation fixes, let's get them live to our users via a new release.
2024-04-24 07:59:07 -07:00
Jeff Widman
c65c6b94e5 Add .readthedocs.yaml file (#246)
Add `.readthedocs.yaml` file.

This config file is now required by RTD in order to build the docs.
2024-04-24 14:46:37 +00:00
Jeff Widman
0ca1f6b241 Install custom Sphinx theme via extras_require (#250)
Previously the custom theme was vendored in via a `git` submodule...

Now this theme is available via a python package, so install it using `extras_require` instead.

This also unlocks letting other tooling such as ReadTheDocs install the custom theme without having to do custom git incantations.

I also removed the `index_logo` config as Sphinx warns that it's not a supported option by the theme. I grep'd the theme package, and it makes no mention of this option, besides we were leaving it blank already, so there's no point in having it.
2024-04-24 07:40:27 -07:00
Mac Newbold
48de4e4a3c Prevent LookupError when accessing debug_toolbars_var (#245) 2024-04-18 10:59:27 -06:00
Mac Newbold
b139c60a60 Merge branch 'master' into master 2024-04-18 10:58:04 -06:00
Marc Aymerich Gunern
05f23436ac Prevent LookupError when accessing debug_toolbars_var when toolbar is being disabled in the middle of a request 2024-04-18 12:16:43 +01:00
Jeff Widman
7012193220 Replace deprecated pkg_resources with stdlib (#239)
`pkg_resources` has been deprecated by `setuptools` for quite a while: https://setuptools.pypa.io/en/latest/pkg_resources.html

It's got some bugs/warts:

* https://github.com/pypa/setuptools/issues/2531
* https://discuss.python.org/t/will-setuptools-remove-pkg-resource-module-in-the-future/27182

So switch to using `importlib` functions which are part of the Python standard library as of `3.8`.

This is less error-prone, and also removes the need for `setuptools` to be installed in order for this panel to work.

I realize we technically still support `3.7`, but I thought it was fine to change this particular panel to require `3.8`, as `3.7` support is best effort given that it's now EOL'd by the core Python team.

I also removed the relative path location for specific libraries as it was simply blank for me on Python 3.12... I think showing the location of the site packages directory should suffice. If someone later wants to build this out further, they're more than welcome to.

Note that `importlib.metadata.distributions()` does have an outstanding issue that it reports a local editable install twice, but they plan to eventually fix that:
* https://github.com/pypa/setuptools/issues/4170
2024-04-13 13:54:46 +00:00
Jeff Widman
7f3defff7c Fix some jquery deprecation warnings (#242)
Ths is a follow-on PR to
https://github.com/pallets-eco/flask-debugtoolbar/pull/241 in order to fix the deprecation warnings:
* `bind()` replaced by `on()`
* `click(handler)` replaced by `on('click', handler)`

Three deprecation warnings remain, but they are caused by the `jquery.tablesorter.js` plugin, so need to be handled upstream:
* https://github.com/Mottie/tablesorter/issues/1787
* https://github.com/Mottie/tablesorter/pull/1786

Related:
* https://github.com/pallets-eco/flask-debugtoolbar/issues/166
2024-04-13 13:48:56 +00:00
Jeff Widman
969cce532d Bump jquery to 3.7.1 and jquery-migrate to 3.4.1 (#241)
Bump to the latest versions of `jquery` and `jquery-migrate`.

I popped open the browser console and I see five deprecation warnings, but 3 out of the 5 are triggered by `jquery.tablesorter.js` which we vendor, so nothing we can do there.

The other two we should address, but we can do so in a follow-on PR as they are merely deprecations at this point, not fatal errors.

So getting onto the `3.x` series, even with deprecation warnings, is a nice step forward.

Previously we shipped the minified version of `jquery`, and we could
continue to do so, but given this is a dev tool and we still have
warnings we need to fix, I opted for the non-minified version for now.

Additionally, they offer a `slim` varient that is stripped down... we
could probably use that too, but I didn't take the time to investigate.

Fix: https://github.com/pallets-eco/flask-debugtoolbar/issues/166
2024-04-13 13:42:23 +00:00
Jeff Widman
c2804c4917 Bump jquery to 1.12.4 (#236)
This will allow us to migrate to the latest version of jquery 1.x series.

After we're on 1.9.x we can upgrade to the 3.x series.

I bumped this, and then checked the developer console while clicking
through the various panels offered in FDBT... Everything worked as
expected and I got zero warnings from `jquery-migrate`. So I think it's
safe to pull this in.

This is a pre-requesite to upgrading to the latest version of `jquery`,
as per their docs we have to first bump to `1.9+`, then bump the version
of `jquery-migrate`, then can bump to latest `jquery` version.

While I could do this in a single PR, I thought simpler to do it as a
series of PRs for easier reversion if we later run into problems.

Related:
* https://github.com/pallets-eco/flask-debugtoolbar/issues/166
2024-04-13 13:39:41 +00:00
Jeff Widman
56beb35c36 Update jquery.tablesorter.js plugin (#235)
Update to the latest `v2.31.3` version of this `jquery` plugin, which
unblocks upgrading to `jquery` >= `1.9.x`.

Using a fork because:

1. The original repo hasn't been updated in seven years: https://github.com/christianbach/tablesorter
2. The most recent committer to the original repo ☝️  now maintains the fork.
3. The fork was updated just a few months ago.
4. The fork supports the latest versions of `jquery`:
     > Works with jQuery 1.9+ (`$.browser.msie` was removed; needed in the original version)

As far as I can tell, no other changes are needed.

This is a straight copy/paste of the non-minized code from: https://github.com/Mottie/tablesorter

I used non-minimized for simplicity, since this is a dev-only tool, the
perf impacts of minimization don't really matter.

I tested this manually by:

```shell
$ cd flask-debugtoolbar/test
$ flask --app basic_app run --debug
```

Then loading `http://127.0.0.1:5000/` in a recent version of Chrome and
finding a FDBT panel that uses the sorter. In this case, the SQLAlchemy
panel. I visually compared behavior pre/past upgrade and it appeared
identical.

Related:
* https://github.com/pallets-eco/flask-debugtoolbar/issues/166
2024-04-13 06:37:37 -07:00
Jeff Widman
98bf17aa58 Fix trailing whitespace (#237)
I noticed some trailing whitespace has crept into these files. It wasn't caught by `pycodestyle` because that only checks Python files.

Ideally we'd add a linter that catches these, but I didn't want to take the time to configure one right now, I just want my editor to stop flagging these while I'm working on trying to upgrade `jquery` versions.

Long term, we'll probably want a meta-linter like `prettier` or whatever the newest kid on the block is.
2024-04-12 16:27:04 +00:00
Grey Li
716f05d953 Remove deprecated Flask version attribute (#243)
The `flask.__version__` attr is deprecated and will be removed in the Flask 3.1 version. This PR replaced this attr to `importlib.metadata.version`.

We could remove the use of `pkg_resources` when we drop the Python 3.7 support.
2024-04-12 09:20:53 -07:00
Jeff Widman
fb28aa9d61 Fix missing distutils error on Python 3.12 (#238)
Running on Python 3.12 I see:

```shell
[2024-04-11 11:01:12,915] WARNING in toolbar: Disabled flask_debugtoolbar.panels.versions.VersionDebugPanel due to ImportError: import_string() failed for 'flask_debugtoolbar.panels.versions.VersionDebugPanel'. Possible reasons are:

- missing __init__.py in a package;
- package or module path not included in sys.path;
- duplicated package or module name taking precedence in sys.path;
- missing module, class, function or variable;

Debugged import:

- 'flask_debugtoolbar' found in '/Users/jeffwidman/Code/open-source/flask-debugtoolbar/src/flask_debugtoolbar/__init__.py'.
- 'flask_debugtoolbar.panels' found in '/Users/jeffwidman/Code/open-source/flask-debugtoolbar/src/flask_debugtoolbar/panels/__init__.py'.
- 'flask_debugtoolbar.panels.versions' not found.

Original exception:

ModuleNotFoundError: No module named 'distutils'
```

This is because Python 3.12 removed `distutils`.

Fix pulled from https://bugs.python.org/issue41282#msg393018.

This will not work on Python `3.6`, but we've already dropped support for that.

After the fix, the error is gone and the Versions panel re-appears.
2024-04-11 18:18:04 -07:00
Mac Newbold
efe447fb5f Fix SQLAlchemy recording warning for versions >= 3 (#233) 2024-03-20 09:28:47 -06:00
Jonty Wareing
9656a2cf33 Fix SQLAlchemy recording warning for versions >= 3
Since SQLAlchemy 3.0 `SQLALCHEMY_RECORD_QUERIES` is no longer
automatically enabled when Flask is running in debug or testing mode so
the debug toolbar warning will never be shown.

https://flask-sqlalchemy.palletsprojects.com/en/3.0.x/config/#flask_sqlalchemy.config.SQLALCHEMY_RECORD_QUERIES
2024-03-20 14:25:36 +00:00
Mac Newbold
9b63ad1837 Support applications using flask.copy_current_request_context (#231) 2024-01-17 09:40:50 -07:00
Marc Aymerich Gunern
765f22126e Handle cases when debug toolbar has not been installed 2024-01-11 18:06:28 +00:00
Marc Aymerich Gunern
d4a8cc963e Support applications using flask.copy_current_request_context 2024-01-09 13:50:02 +00:00
Mac Newbold
b7f5a725cd Add init_app() method to DebugPanel base class (#95) 2023-12-20 09:35:17 -07:00
Malthe Jørgensen
5bf5e093bb [Add] init_app()-method to DebugPanel base class
Adds a method `DebugPanel.init_app()` that gets called from
`DebugToolbar.init_app()`.

This allows DebugPanels to register their own routes, and do setup work
that should go across requests (as opposed to per-request setup) and
needs access to the Flask `app`-object.
2023-12-15 10:14:33 +01:00
Mac Newbold
719fe02df5 Add option to dump profiler stats (#204) 2023-12-13 10:49:10 -07:00
Dosenpfand
f18bcc708a Remove trailing whitespaces 2023-12-13 10:47:24 -07:00
Dosenpfand
95c2b86bcd Add profile dump stats option 2023-12-13 10:47:24 -07:00
Mac Newbold
b03a2e6fb3 Require Flask >= 2.2.0 (#224) 2023-12-11 11:27:45 -07:00
Jeff Widman
1c39a9ce47 Require Flask >= 2.2.0, Python >= 3.7
Require Flask >= `2.2.0`.

I'm comfortable going up to requiring `3.x`, but when I grep'd for
places we use older Flask constructs, this was all I found.

So for now no need to jump further.

Flask `2.2.0` requires Python >= `3.7`, so also dropped older pythons.
2023-12-11 11:25:52 -07:00
Mac Newbold
8c8b2bb35c Add minimal test without extra deps (#230) 2023-12-10 20:18:10 -07:00
Grey Li
a2e773124f Add minimal test without extra deps
To prevent issues like https://github.com/pallets-eco/flask-debugtoolbar/pull/225,
This PR add a minimal test that no extra deps are involved, it only install
the package, then try to import the extension class.

fixes #226
2023-12-10 12:54:29 +08:00