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

Package rename #29

Open
wants to merge 2 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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PIP=pip
PYTHON=python
PYTHON=python3

all: help

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ If you want to connect specific frameworks see [Flask integration](./docs/flask.

### Install module

Install `hawkcatcher` from PyPI.
Install `hawk-python-sdk` from PyPI.

```shell
$ pip install hawkcatcher
$ pip install hawk-python-sdk
```

Import Catcher module to your project.

```python
from hawkcatcher import Hawk
from hawk_python_sdk import Hawk
```

Then enable Hawk Catcher with your token and domain.
Expand Down Expand Up @@ -115,6 +115,6 @@ Repository: <https://github.com/codex-team/hawk.python>

Report a bug: <https://github.com/codex-team/hawk.python/issues>

PyPI Package: <https://pypi.python.org/pypi/hawkcatcher>
PyPI Package: <https://pypi.python.org/pypi/hawk-python-sdk>

CodeX Team: <https://codex.so/>
4 changes: 2 additions & 2 deletions docs/fastapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ This extension adds support for the [FastAPI](https://fastapi.tiangolo.com/) web
## Installation

```bash
pip install hawkcatcher[fastapi]
pip install hawk-python-sdk[fastapi]
```

import Catcher module to your project.

```python
from hawkcatcher.modules.fastapi import HawkFastapi
from hawk_python_sdk.modules.fastapi import HawkFastapi
```

```python
Expand Down
4 changes: 2 additions & 2 deletions docs/flask.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ This extension adds support for the [Flask](http://flask.pocoo.org/) web framewo
## Installation

```bash
pip install hawkcatcher[flask]
pip install hawk-python-sdk[flask]
```

import Catcher module to your project.

```python
from hawkcatcher.modules.flask import HawkFlask
from hawk_python_sdk.modules.flask import HawkFlask
```

```python
Expand Down
2 changes: 1 addition & 1 deletion example/example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
from hawkcatcher import Hawk
from hawk_python_sdk import Hawk
from dotenv import load_dotenv

load_dotenv() # take environment variables from .env.
Expand Down
10 changes: 5 additions & 5 deletions example/example2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import hawkcatcher
import hawk_python_sdk
import os
from dotenv import load_dotenv

Expand All @@ -18,13 +18,13 @@ def test_method(self):
self.divide_by_zero()

def mannual_sending(self):
hawkcatcher.send(ValueError("lol"), {"ping": "pong", "number": 1})
hawk_python_sdk.send(ValueError("lol"), {"ping": "pong", "number": 1})

def send_custom_error(self):
raise InvalidToken()

def send_with_user(self):
hawkcatcher.send(
hawk_python_sdk.send(
ValueError("USER"),
None,
{'id': 1, 'name': 'Alice'}
Expand All @@ -35,9 +35,9 @@ def main():
token = os.getenv('HAWK_TOKEN')

if token is None or token == "":
print('hawkcatcher token not provided. Please provide HAWK_TOKEN variable in .env file')
print('hawk-python-sdk token not provided. Please provide HAWK_TOKEN variable in .env file')
return
hawkcatcher.init(token)
hawk_python_sdk.init(token)
test = Module()
test.mannual_sending()
test.send_with_user()
Expand Down
8 changes: 4 additions & 4 deletions example/fill_events.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import random
import os
import hawkcatcher
import hawk_python_sdk
from faker import Faker

fake = Faker()
Expand Down Expand Up @@ -48,7 +48,7 @@ def random_exception():
]

token = os.getenv('HAWK_TOKEN')
hawkcatcher.init(token)
hawk_python_sdk.init(token)

for _ in range(10):
try:
Expand All @@ -57,12 +57,12 @@ def random_exception():
except Exception as e:
random_username = fake.user_name()
random_email = fake.email()
hawkcatcher.send(e, {'username': random_username, 'value': random_email})
hawk_python_sdk.send(e, {'username': random_username, 'value': random_email})

for _ in range(2):
try:
random_exception()
except Exception as e:
random_username = fake.user_name()
random_email = fake.email()
hawkcatcher.send(e, {'username': random_username, 'value': random_email})
hawk_python_sdk.send(e, {'username': random_username, 'value': random_email})
2 changes: 1 addition & 1 deletion example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
hawkcatcher
hawk-python-sdk
faker
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
dynamic = ["version"]
dependencies = ["requests"]
name = "hawkcatcher"
name = "hawk-python-sdk"
authors = [{ name = "CodeX Team", email = "[email protected]" }]
description = "Python errors Catcher module for Hawk."
readme = "README.md"
Expand All @@ -21,7 +21,7 @@ classifiers = [
flask = ["flask"]
fastapi = ["starlette"]
[tool.hatch.version]
path = "src/hawkcatcher/__init__.py"
path = "src/hawk_python_sdk/__init__.py"
[project.urls]
Homepage = "https://github.com/codex-team/hawk.python"
Issues = "https://github.com/codex-team/hawk.python/issues"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.5.0"
__version__ = "3.5.1"

from .core import Hawk
from .types import HawkCatcherSettings
Expand Down
8 changes: 4 additions & 4 deletions src/hawkcatcher/core.py → src/hawk_python_sdk/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from base64 import b64decode
import json

import hawkcatcher
from hawkcatcher.errors import InvalidHawkToken
from hawkcatcher.types import HawkCatcherSettings, Addons, User
import hawk_python_sdk
from hawk_python_sdk.errors import InvalidHawkToken
from hawk_python_sdk.types import HawkCatcherSettings, Addons, User


class Hawk:
Expand Down Expand Up @@ -89,7 +89,7 @@ def handler(self, exc_cls: type, exc: Exception, tb: traceback, context=None, us
'backtrace': backtrace,
'release': self.params['release'],
'context': context,
'catcherVersion': hawkcatcher.__version__,
'catcherVersion': hawk_python_sdk.__version__,
'user': user,
'addons': addons
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from hawkcatcher.types import HawkCatcherSettings
from hawk_python_sdk.types import HawkCatcherSettings
from ...core import Hawk
from hawkcatcher.modules.fastapi.types import FastapiSettings, FastapiAddons
from hawk_python_sdk.modules.fastapi.types import FastapiSettings, FastapiAddons
from starlette.types import ASGIApp, Receive, Scope, Send
from starlette.requests import Request
from starlette.middleware.base import BaseHTTPMiddleware
from typing import Union
from hawkcatcher.errors import ModuleError
from hawk_python_sdk.errors import ModuleError
import asyncio
from contextvars import ContextVar
from fastapi import Request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hawkcatcher.types import HawkCatcherSettings, User, Addons
from hawk_python_sdk.types import HawkCatcherSettings, User, Addons
from typing import Callable, TypedDict
from starlette.applications import Starlette
from fastapi import Request
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from ...core import Hawk
from typing import Union
from hawkcatcher.modules.flask.types import FlaskSettings, Addons
from hawkcatcher.errors import ModuleError
from hawk_python_sdk.modules.flask.types import FlaskSettings, Addons
from hawk_python_sdk.errors import ModuleError

try:
from flask.signals import got_request_exception
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from hawkcatcher.types import HawkCatcherSettings, User, Addons
from hawk_python_sdk.types import HawkCatcherSettings, User, Addons
from typing import Callable, TypedDict
from flask import Request

Expand Down
File renamed without changes.
9 changes: 5 additions & 4 deletions tests/test_cather.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import pytest

from hawkcatcher import __version__
from hawkcatcher import Hawk
from hawkcatcher.errors import InvalidHawkToken
from hawk_python_sdk import __version__
from hawk_python_sdk import Hawk
from hawk_python_sdk.errors import InvalidHawkToken

sample_token = "eyJpbnRlZ3JhdGlvbklkIjoiZGRjZmY4OTItODMzMy00YjVlLWIyYWQtZWM1MDQ5MDVjMjFlIiwic2VjcmV0IjoiZmJjYzIwMTEtMTY5My00NDIyLThiNDItZDRlMzdlYmI4NWIwIn0="
sample_token_collector_endpoint = "https://ddcff892-8333-4b5e-b2ad-ec504905c21e.k1.hawk.so"
Expand Down Expand Up @@ -40,7 +40,8 @@ def test_settings_parsing():
'token': sample_token,
'collector_endpoint': sample_token_collector_endpoint,
'release': None,
'before_send': None
'before_send': None,
'context': None
}

assert settings == right_settings
Expand Down