8000 Python 3.13 by alexmojaki · Pull Request #106 · alexmojaki/birdseye · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Python 3.13 #106

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ 3.8, 3.9, '3.10', 3.11, 3.12, 3.13 ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Set up Node
uses: actions/setup-node@v4
- name: Install chromedriver
uses: nanasess/setup-chromedriver@master
- name: run tests
run: |
pip install --upgrade pip
pip install .[tests]
./misc/test.sh
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

6 changes: 2 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
|logo| birdseye
===============

|Build Status| |Supports Python versions 2.7 and 3.5+|
|Supports Python versions 3.8+|

birdseye is a Python debugger which records the values of expressions in a
function call and lets you easily view them after the function exits.
Expand Down Expand Up @@ -43,9 +43,7 @@ ordered by time, letting you see what happens at a glance:
:alt: List of function calls

.. |logo| image:: https://i.imgur.com/i7uaJDO.png
.. |Build Status| image:: https://travis-ci.com/alexmojaki/birdseye.svg?branch=master
:target: https://travis-ci.com/alexmojaki/birdseye
.. |Supports Python versions 2.7 and 3.5+| image:: https://img.shields.io/pypi/pyversions/birdseye.svg
.. |Supports Python versions 3.8+| image:: https://img.shields.io/pypi/pyversions/birdseye.svg
:target: https://pypi.python.org/pypi/birdseye

.. inclusion-end-marker
Expand Down
18 changes: 11 additions & 7 deletions birdseye/bird.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ast
import builtins
import hashlib
import inspect
import json
Expand Down Expand Up @@ -1130,6 +1131,11 @@ def _sample_indices(length, max_length):
length))


@try_register_repr('numpy', 'int64')
def _repr_numpy_int(x, _helper):
return repr(int(x))


@try_register_repr('pandas', 'Series')
def _repr_series_one_line(x, helper):
n = len(x)
Expand All @@ -1154,20 +1160,18 @@ def is_interesting_expression(node):
return True. Put differently, return False if this is just a literal.
"""
return (isinstance(node, ast.expr) and
not (isinstance(node, (ast.Num, ast.Str, getattr(ast, 'NameConstant', ()))) or
not (isinstance(node, ast.Constant) or
isinstance(getattr(node, 'ctx', None),
(ast.Store, ast.Del)) or
(isinstance(node, ast.UnaryOp) and
isinstance(node.op, (ast.UAdd, ast.USub)) and
isinstance(node.operand, ast.Num)) or
isinstance(node.operand, ast.Constant) and
isinstance(node.operand.value, (int, float, complex))) or
(isinstance(node, (ast.List, ast.Tuple, ast.Dict)) and
not any(is_interesting_expression(n) for n in ast.iter_child_nodes(node)))))


# noinspection PyUnresolvedReferences
builtins_dict = __builtins__
if not isinstance(builtins_dict, dict):
builtins_dict = builtins_dict.__dict__
builtins_dict: dict = builtins.__dict__ # type: ignore


def is_obvious_builtin(node, value):
Expand All @@ -1179,4 +1183,4 @@ def is_obvious_builtin(node, value):
return ((isinstance(node, ast.Name) and
node.id in builtins_dict and
builtins_dict[node.id] is value) or
isinstance(node, getattr(ast, 'NameConstant', ())))
isinstance(node, ast.Constant) and node.value is value)
13 changes: 7 additions & 6 deletions birdseye/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import sys
from contextlib import contextmanager
from typing import List

from humanize import naturaltime
from littleutils import select_attrs, retry
Expand All @@ -11,23 +12,23 @@
Index
from sqlalchemy.dialects.mysql import LONGTEXT
from sqlalchemy.exc import OperationalError, InterfaceError, InternalError, ProgrammingError, ArgumentError
from sqlalchemy.ext.declarative import declarative_base, declared_attr
from sqlalchemy.ext.declarative import declared_attr
from sqlalchemy.orm import backref, relationship, sessionmaker

from birdseye.utils import IPYTHON_FILE_PATH, is_ipython_cell

# noinspection PyUnreachableCode
if False:
from typing import List


try:
from sqlalchemy.dialects.mysql.base import RESERVED_WORDS
except ImportError:
pass
else:
RESERVED_WORDS.add('function')

try:
from sqlalchemy.orm import declarative_base
except ImportError:
f F438 rom sqlalchemy.ext.declarative import declarative_base


DB_VERSION = 1

Expand Down
9 changes: 0 additions & 9 deletions birdseye/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,6 @@ def ipython_iframe_view(call_id):
call_id=call_id)


@app.route('/kill', methods=['POST'])
def kill():
func = request.environ.get('werkzeug.server.shutdown')
if func is None:
raise RuntimeError('Not running with the Werkzeug Server')
func()
return 'Server shutting down...'


@app.route('/api/call/<call_id>')
@db.provide_session
def api_call_view(session, call_id):
Expand Down
2 changes: 1 addition & 1 deletion birdseye/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ def _create_simple_marker_call(self, node, func):
"""
return ast.Call(
func=ast.Name(id=self.traced_file.trace_methods[func], ctx=ast.Load()),
args=[ast.Num(node._tree_index)],
args=[ast.Constant(node._tree_index)],
keywords=[],
)

Expand Down
9 changes: 6 additions & 3 deletions birdseye/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def format_pandas_index(index):
Supports different versions of pandas
"""
try:
return index.format(sparsify=False)
except TypeError:
return index.format()
return index.astype(str)
except Exception:
try:
return index.format(sparsify=False)
except TypeError:
return index.format()
18 changes: 5 additions & 13 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,19 +127,14 @@ When a function runs
Testing
-------

Run ``python setup.py test`` to install test requirements and run all
Run ``./misc/test.sh`` to install test requirements and run all
tests with a single Python interpreter. You will need to have
`phantomjs`_ installed, e.g. via::

npm install --global phantomjs
`chromedriver` installed.

Run `tox`_ (``pip install tox``) to run tests on all supported
versions of Python: 2.7, 3.5, and 3.6. You must install the interpreters
versions of Python. You must install the interpreters
separately yourself.

Pushes to GitHub will trigger a build on Travis to run tests
automatically. This will run ``misc/travis_test.sh``.

``test_against_files``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -159,13 +154,10 @@ interpreters, so tox is recommended.
Browser screenshots for test failures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``test_interface.py`` runs a test using selenium and phantomjs. If it
``test_interface.py`` runs a test using selenium and headless Chrome. If it
fails, it produces a file ``error_screenshot.png`` which is helpful for
debugging the failure locally. If the test only fails on travis, you can
use the ``misc/travis_screenshot.py`` script to obtain the screenshot. See
the module docstring for details.
debugging the failure locally.

.. _phantomjs: http://phantomjs.org/download.html
.. _tox: https://tox.readthedocs.io/en/latest/


Expand Down
11 changes: 5 additions & 6 deletions misc/travis_test.sh → misc/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

set -eux

sudo cp node_modules/chromedriver/lib/chromedriver/chromedriver /usr/local/bin/chromedriver

pip install -e .
which python
python --version
python -m gunicorn --version

export DB=${DB:-sqlite}

Expand All @@ -24,12 +24,11 @@ else
exit 1
fi

export BIRDSEYE_SERVER_RUNNING=true
gunicorn -b 127.0.0.1:7777 birdseye.server:app &
python -m gunicorn -b 127.0.0.1:7777 birdseye.server:app &

set +e

pytest -vv
python -m pytest -vv
result=$?
kill $(ps aux | grep birdseye.server:app | grep -v grep | awk '{print $2}')
exit ${result}
57 changes: 0 additions & 57 deletions misc/travis_screenshot.py

This file was deleted.

27 changes: 9 additions & 18 deletions setup.cfg
879E
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ long_description_content_type = text/x-rst
classifiers =
Intended Audience :: Developers
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Topic :: Software Development :: Debuggers
Expand All @@ -33,32 +32,24 @@ install_requires =
cheap_repr
outdated
cached_property
backports.functools_lru_cache; python_version == "2.7"

setup_requires = setuptools>=44; wheel; setuptools_scm[toml]>=3.4.3
python_requires = >=3.8
include_package_data = True
tests_require =
bs4
selenium
requests
pytest
numpy>=1.16.5
pandas

test_suite = tests

[options.extras_require]
tests =
bs4
selenium
requests
pytest
numpy>=1.16.5
numpy
pandas
gunicorn
twine
build

[options.entry_points]
console_scripts =
birdseye = birdseye.server:main

[bdist_wheel]
universal=1
Loading
0