Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[run]
branch = True
source = easy_profile
5 changes: 0 additions & 5 deletions setup.cfg → .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ import-order-style = google
inline-quotes = double
docstring-quotes = double
application-import-names = easy_profile

[coverage:run]
branch = True
source = easy_profile
omit = setup.py
23 changes: 19 additions & 4 deletions .github/workflows/python-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,24 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.10", "3.11"]
python-version: ["3.9"]
steps:
- name: Check Py${{ matrix.python-version }}
uses: collective/tox-action@main
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }}

- name: Install Poetry
run: pip install poetry

- name: Install dependencies
run: poetry install --with dev

- name: Run lint
run: poetry run flake8

- name: Run coverage
run: poetry run coverage run -m unittest && poetry run coverage report
38 changes: 20 additions & 18 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ on:

jobs:
deploy:

runs-on: ubuntu-latest

strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install Poetry
run: pip install poetry

- name: Build package
run: poetry build

- name: Publish package
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --no-interaction --username __token__ --password $PYPI_TOKEN
26 changes: 22 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# SQLAlchemy Easy Profile

[![Build Status](https://travis-ci.com/dmvass/sqlalchemy-easy-profile.svg?branch=master)](https://travis-ci.com/dmvass/sqlalchemy-easy-profile)
[![image](https://img.shields.io/pypi/v/sqlalchemy-easy-profile.svg)](https://pypi.python.org/pypi/sqlalchemy-easy-profile)
[![codecov](https://codecov.io/gh/dmvass/sqlalchemy-easy-profile/branch/master/graph/badge.svg)](https://codecov.io/gh/dmvass/sqlalchemy-easy-profile)
Expand All @@ -12,12 +13,14 @@ queries.
![report example](https://raw.githubusercontent.com/dmvass/sqlalchemy-easy-profile/master/images/report-example.png?raw=true)

## Installation

Install the package with pip:
```
pip install sqlalchemy-easy-profile
```

## Session profiler

The profiling session hooks into SQLAlchemy and captures query statements, duration information,
and query parameters. You also may have multiple profiling sessions active at the same
time on the same or different Engines. If multiple profiling sessions are active on the
Expand Down Expand Up @@ -67,6 +70,7 @@ If it was not defined by default will be used a base streaming reporter. Decorat
also accept `name` and `name_callback` optional parameters.

## WSGI integration

Easy Profiler provides a specified middleware which can prints the number of database
queries for each HTTP request and can be applied as a WSGI server middleware. So you
can easily integrate Easy Profiler into any WSGI application.
Expand Down Expand Up @@ -120,21 +124,35 @@ class CustomReporter(Reporter):

```

## Testing
To run the tests:
## Development

To ensure code quality and correctness, use [Poetry](https://python-poetry.org/) for managing dependencies and running tasks.

**Install development dependencies:**
```bash
poetry install --with dev
```
python setup.py test

**Run tests:**
```bash
poetry run python -m unittest
```

Or use `tox` for running in all tests environments.
**Check code style:**
```bash
poetry run flake8
```

## License

This code is distributed under the terms of the MIT license.

## Changes

A full changelog is maintained in the [CHANGELOG](https://github.com/dmvass/sqlalchemy-easy-profile/blob/master/CHANGELOG.md) file.

## Contributing

**sqlalchemy-easy-profile** is an open source project and contributions are
welcome! Check out the [Issues](https://github.com/dmvass/sqlalchemy-easy-profile/issues)
page to see if your idea for a contribution has already been mentioned, and feel
Expand Down
Loading