Skip to content

Commit 04c157e

Browse files
initial commit
0 parents  commit 04c157e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1329
-0
lines changed

.env-example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
APP_DEBUG=True
2+
APP_ENV=development
3+
APP_KEY=plyUWY8iZnEH9_8WrVjl-LS3B8aRtHK9UAB35fGAq0M=
4+
DB_CONFIG_PATH=tests/integrations/config/database
5+
DB_CONNECTION=sqlite

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
# Maintain dependencies for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
9+
# Maintain dependencies for cookiecutter repo
10+
- package-ecosystem: "pip"
11+
directory: "/"
12+
schedule:
13+
interval: "weekly"
14+
# Allow up to 10 open pull requests for pip dependencies
15+
open-pull-requests-limit: 10

.github/workflows/pythonapp.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test Application
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
python-version: ["3.7", "3.8", "3.9", "3.10"]
11+
name: Python ${{ matrix.python-version }}
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python ${{ matrix.python-version }}
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: ${{ matrix.python-version }}
18+
- name: Install dependencies
19+
run: |
20+
make init
21+
- name: Test with pytest and Build coverage
22+
run: |
23+
make coverage
24+
- name: Upload coverage
25+
uses: codecov/codecov-action@v2
26+
with:
27+
token: ${{ secrets.CODECOV_TOKEN }}
28+
fail_ci_if_error: false
29+
30+
lint:
31+
runs-on: ubuntu-latest
32+
name: Lint
33+
steps:
34+
- uses: actions/checkout@v2
35+
- name: Set up Python 3.8
36+
uses: actions/setup-python@v2
37+
with:
38+
python-version: 3.8
39+
- name: Intall Flake8
40+
run: |
41+
pip install flake8
42+
- name: Lint
43+
run: make lint
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up Python
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: "3.x"
16+
- name: Install dependencies
17+
run: |
18+
make init
19+
- name: Publish only packages passing test
20+
run: |
21+
make test
22+
- name: Build and publish
23+
env:
24+
TWINE_USERNAME: __token__
25+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
26+
run: |
27+
make publish

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
venv
2+
venv2
3+
.vscode
4+
.idea/
5+
build/
6+
.pypirc
7+
.coverage
8+
coverage.xml
9+
.pytest_*
10+
**/*__pycache__*
11+
**/*.DS_Store*
12+
**.pyc
13+
dist
14+
.env
15+
*.db
16+
src/masonite_sentry.egg-info

CONTRIBUTING.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# Contributing Guide
2+
3+
## Introduction
4+
5+
When contributing to this repository, **please first discuss the change you wish to make via issue, email, or any other method with the owners or contributors of this repository** before making a change 😃 . Thank you !
6+
7+
## Getting Started
8+
9+
### Get the code
10+
11+
First you should configure your local environment to be able to make changes in this package.
12+
13+
1. Fork the `https://github.com/py-package/masonite-sentry` repo.
14+
2. Clone that repo into your computer: `git clone http://github.com/your-username/sentry.git`.
15+
3. Checkout the current release branch \(example: `master`\).
16+
4. Run `git pull origin master` to get the current release version.
17+
18+
### Install the environment
19+
20+
1. You should create a Python virtual environment with `Python >= 3.7`.
21+
2. Then install the dependencies and setup the project, in root directory with:
22+
23+
```
24+
make init
25+
```
26+
27+
**Note:**
28+
29+
- The package will be locally installed in your venv (with `pip install .`). Meaning that you will be
30+
able to import it from the project contained in the package as if you installed it from PyPi.
31+
- When making changes to your packages you will need to uninstall the package and reinstall it with
32+
`pip uninstall sentry && pip install .`
33+
34+
### Contribute
35+
36+
- From there simply create:
37+
- a feature branch `feat/my-new-feature`
38+
- a fix branch `fix/my-new-fix`
39+
- Push to your origin repository:
40+
- `git push origin feat/my-new-feature`
41+
- Open a pull request (PR) and follow the PR process below
42+
43+
1. You should open an issue before making any pull requests. Not all features will be added to the package and some may be better off as another third party package. It wouldn't be good if you worked on a feature for several days and the pull request gets rejected for reasons that could have been discussed in an issue for several minutes.
44+
2. Ensure any changes are well commented and any configuration files that are added have a flagpole comment on the variables it's setting.
45+
3. Update the README.md if installation/configuration or usage has changed.
46+
4. It's better to add unit tests for the changes you made.
47+
5. The PR must pass Github CI checks. The PR can be merged in once you have a successful review from a maintainer.
48+
6. The version will be bumped by the maintainer when merging, so don't edit package version in the PR.
49+
50+
### Testing
51+
52+
- To add unit tests add tests under `tests/` directory, please read about [Masonite
53+
testing](https://docs.masoniteproject.com/useful-features/testing) in the official
54+
documentation
55+
56+
- To test your package locally in a project, a default Masonite project is available
57+
at root. Just run `python craft serve` and navigate to `localhost:8000/` and
58+
you will see `Hello Package World` in your browser.
59+
60+
## Dev Guidelines
61+
62+
### Package development
63+
64+
You should read guidelines on package creation in the [Official Documentation](https://docs.masoniteproject.com/advanced/creating-packages)
65+
66+
### Comments
67+
68+
Comments are a vital part of any repository and should be used where needed. It is important not to overcomment something. If you find you need to constantly add comments, you're code may be too complex. Code should be self documenting \(with clearly defined variable and method names\)
69+
70+
#### Types of comments to use
71+
72+
There are 3 main type of comments you should use when developing for Masonite:
73+
74+
**Module Docstrings**
75+
76+
All modules should have a docstring at the top of every module file and should look something like:
77+
78+
```python
79+
""" This is a module to add support for Billing users """
80+
from masonite.request import Request
81+
...
82+
```
83+
84+
**Method and Function Docstrings**
85+
86+
All methods and functions should also contain a docstring with a brief description of what the module does
87+
88+
For example:
89+
90+
```python
91+
def some_function(self):
92+
"""
93+
This is a function that does x action.
94+
Then give an exmaple of when to use it
95+
"""
96+
... code ...
97+
```
98+
99+
**Code Comments**
100+
101+
If you're code MUST be complex enough that future developers will not understand it, add a `#` comment above it
102+
103+
For normal code this will look something like:
104+
105+
```python
106+
# This code performs a complex task that may not be understood later on
107+
# You can add a second line like this
108+
complex_code = 'value'
109+
110+
perform_some_complex_task()
111+
```
112+
113+
**Flagpole Comments**
114+
115+
Flag pole comments are a fantastic way to give developers an inside to what is really happening and for now should only be reserved for configuration files. A flag pole comment gets its name from how the comment looks
116+
117+
```text
118+
"""
119+
|--------------------------------------------------------------------------
120+
| A Heading of The Setting Being Set
121+
|--------------------------------------------------------------------------
122+
|
123+
| A quick description
124+
|
125+
"""
126+
127+
SETTING = "some value"
128+
```
129+
130+
It's important to note that there should have exactly 75 `-` above and below the header and have a trailing `|` at the bottom of the comment.

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2022, Yubaraj Shrestha
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

MANIFEST.in

Whitespace-only changes.

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<p align="center">
2+
<img src="https://banners.beyondco.de/Masonite%20Sentry.png?theme=light&packageManager=pip+install&packageName=masonite-sentry&pattern=charlieBrown&style=style_2&description=Sentry+sdk+implementation+for+Masonite+Apps.&md=1&showWatermark=1&fontSize=100px&images=adjustments&widths=50&heights=50">
3+
</p>
4+
5+
<p align="center">
6+
<a href="https://docs.masoniteproject.com">
7+
<img alt="Masonite Package" src="https://img.shields.io/static/v1?label=Masonite&message=package&labelColor=grey&color=blue&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAA6gAwAEAAAAAQAAAA4AAAAATspU+QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAAnxJREFUKBVNUl1IVEEUPjPObdd1VdxWM0rMIl3bzbVWLSofVm3th0AhMakHHyqRiNSHEAq5b2HSVvoQRUiEECQUQkkPbRslRGigG8auoon2oPSjpev+3PWeZq7eaC5nDt93vplz5txDQJYpNxX4st4JFiwj9aCqmswUFQNS/A2YskrZJPYefkECC2GhQwAqvLYybwXrwBvq8HSNOXRO92+aH7nW8vc/wS2Z9TqneYt2KHjlf9Iv+43wFJMExzO0YE5OKe60N+AOW6OmE+WJTBrg23jjzWxMBauOlfyycsV24F+cH+zAXYUOGl+DaiDxfl245/W9OnVrSY+O2eqPkyz4sVvHoKp9gOihf5KoAVv3hkQgbj/ihG9fI3RixKcUVx7lJVaEc0vnyf2FFll+ny80ZHZiGhIKowWJBCEAKr+FSuNDLt+lxybSF51lo74arqs113dOZqwsptxNs5bwi7Q3q8npSC2AWmvjTncZf1l61e5DEizNn5mtufpsqk5+CZTuq00sP1wkNPv8jeEikVVlJso+GEwRtNs3QeBt2YP2V2ZI3Tx0e+7T89zK5tNASOLEytJAryGtkLc2PcBM5byyUWYkMQpMioYcDcchC6xN220Iv36Ot8pV0454RHLEwmmD7UWfIdX0zq3GjMPG5NKBtv5qiPEPekK2U51j1451BZoc3i+1ohSQ/UzzG5uYFFn2mwVUnO4O3JblXA91T51l3pB3QweDl7sNXMyEjbguSjrPcQNmwDkNc8CbCvDd0+xCC7RFi9wFulD3mJeXqxQevB4prrqgc0TmQ85NG/K43e2UwnMVAJIEBNfWRYR3HfnvivrIzMyo4Hgy+hfscvLo53jItAAAAABJRU5ErkJggg==">
8+
</a>
9+
<img alt="GitHub Workflow Status (branch)" src="https://img.shields.io/github/workflow/status/py-package/masonite-sentry/Test%20Application">
10+
<img src="https://codecov.io/gh/py-package/masonite-sentry/branch/main/graph/badge.svg?token="/>
11+
<img alt="PyPI" src="https://img.shields.io/pypi/v/masonite-sentry">
12+
<img src="https://img.shields.io/badge/python-3.7+-blue.svg" alt="Python Version">
13+
<img alt="GitHub release (latest by date including pre-releases)" src="https://img.shields.io/github/v/release/py-package/masonite-sentry?include_prereleases">
14+
<img alt="License" src="https://img.shields.io/github/license/py-package/masonite-sentry">
15+
<a href="https://github.com/psf/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
16+
</p>
17+
18+
## Masonite Sentry
19+
20+
Sentry sdk implementation for Masonite.
21+
22+
## Installation
23+
24+
```bash
25+
pip install masonite-sentry
26+
```
27+
28+
## Configuration
29+
30+
Add SentryProvider to your project in `config/providers.py`:
31+
32+
```python
33+
# config/providers.py
34+
# ...
35+
from sentry import SentryProvider
36+
37+
# ...
38+
PROVIDERS = [
39+
# ...
40+
# Third Party Providers
41+
SentryProvider,
42+
# ...
43+
]
44+
```
45+
46+
Then you can publish the package resources (if needed) by doing:
47+
48+
```bash
49+
python craft package:publish sentry
50+
```
51+
52+
## Usage
53+
54+
Setup environment variables in your project's `.env` file:
55+
56+
```bash
57+
SENTRY_DSN=
58+
SENTRY_SAMPLE_RATE=1.0
59+
```
60+
61+
Well that's it, you are done, congrats.
62+
63+
> Note: Sentry captures no any exceptions if you are on debug mode.
64+
65+
## Contributing
66+
67+
Please read the [Contributing Documentation](CONTRIBUTING.md) here.
68+
69+
## Maintainers
70+
71+
- [Yubaraj Shrestha](https://www.github.com/py-package)
72+
73+
## License
74+
75+
76+
sentry is open-sourced software licensed under the [MIT license](LICENSE).
77+

codecov.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
codecov:
2+
require_ci_to_pass: no
3+
4+
github_checks: false
5+
6+
coverage:
7+
precision: 2
8+
round: down
9+
range: "70...100"
10+
11+
parsers:
12+
gcov:
13+
branch_detection:
14+
conditional: yes
15+
loop: yes
16+
method: no
17+
macro: no
18+
19+
comment:
20+
layout: "footer"
21+
behavior: default
22+
require_changes: no

0 commit comments

Comments
 (0)