Skip to content

Commit b662528

Browse files
build: Migrate build to hatchling platform (#124)
* hatchling migration * Cleanup of unused files for hatchling * Commentary in version.py changes * Flake8 doesn't work natively with toml files and would require a plugin and additional dependency. Restored .flake8 config file and remove the setup from toml. * flake8 comments * Removed seemingly dead build tool references
1 parent 0d00712 commit b662528

File tree

9 files changed

+104
-87
lines changed

9 files changed

+104
-87
lines changed

.coveragerc

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/python-checks.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ jobs:
2525
- name: Install dependencies
2626
run: |
2727
python -m pip install --upgrade pip
28-
pip install black flake8 coverage .[dev]
28+
pip install build
29+
pip install -e .[dev]
2930
3031
- name: Check formatting with black
3132
run: |
@@ -40,4 +41,8 @@ jobs:
4041
RAYGUN_API_KEY: ${{ secrets.RAYGUN_API_KEY }}
4142
run: |
4243
coverage run --source=python3 -m unittest discover python3/tests
43-
coverage report -m
44+
coverage report -m
45+
46+
- name: Build package
47+
run: |
48+
python -m build

MANIFEST

Lines changed: 0 additions & 6 deletions
This file was deleted.

MANIFEST.in

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
raygun4py
22
=========
33

4-
.. image:: https://travis-ci.org/MindscapeHQ/raygun4py.svg?branch=master
5-
:target: https://travis-ci.org/MindscapeHQ/raygun4py?branch=master
6-
7-
.. image:: https://coveralls.io/repos/MindscapeHQ/raygun4py/badge.svg?branch=master
8-
:target: https://coveralls.io/r/MindscapeHQ/raygun4py?branch=master
9-
10-
114
Official Raygun provider for **Python** and **PyPy**
125

136
**Python 2.7** is supported in versions <= 4.4.0

RELEASING.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ where `x.y.z` is the Major, Minor and Patch release numbers.
2323

2424
### Update version
2525

26-
Update the `version` in the `python3/raygun4py/version.py` file.
26+
Update the `__version__` in the `python3/raygun4py/version.py` file.
2727

2828
### Update CHANGELOG.md
2929

@@ -49,14 +49,14 @@ Once the PR has been approved, you can publish the provider.
4949

5050
### Publish to PyPi
5151

52-
1. Activate the local environment created in the `CONTRIBUTING.md` guideline.
53-
2. Install release tools: `python3 -m pip install setuptools twine`.
54-
3. Run `python setup.py sdist`.
55-
4. Check that the file `dist/raygun4py-x.y.z.tar.gz` has been created.
56-
5. Run `twine check dist/raygun4py-x.y.z.tar.gz` and fix any warnings. Repeat the `sdist` command if necessary.
57-
5. Run `twine upload dist/raygun4py-x.x.x.tar.gz` to upload the package.
58-
6. Provide the API token when asked.
59-
7. Now the package is available for customers.
52+
1. Install build tools: `pip install build`
53+
2. Build the package: `python -m build`
54+
3. Check that the files `dist/raygun4py-x.y.z.tar.gz` and `dist/raygun4py-x.y.z-py3-none-any.whl` have been created.
55+
4. Install twine: `pip install twine`
56+
5. Check the package: `twine check dist/*`
57+
6. Upload to PyPi: `twine upload dist/*`
58+
7. Provide the API token when asked.
59+
8. Now the package is available for customers.
6060

6161
### Merge PR to master
6262

pyproject.toml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "raygun4py"
7+
dynamic = ["version"]
8+
authors = [{ name = "Raygun", email = "hello@raygun.io" }]
9+
description = "Official Raygun provider for Python"
10+
readme = "README.rst"
11+
license = "MIT"
12+
license-files = ["LICENSE"]
13+
requires-python = ">=3.9"
14+
classifiers = [
15+
"Development Status :: 5 - Production/Stable",
16+
"Intended Audience :: Developers",
17+
"License :: OSI Approved :: MIT License",
18+
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3.9",
20+
"Programming Language :: Python :: 3.10",
21+
"Programming Language :: Python :: 3.11",
22+
"Programming Language :: Python :: 3.12",
23+
"Programming Language :: Python :: 3.13",
24+
"Topic :: Communications",
25+
]
26+
dependencies = [
27+
"jsonpickle>=4.0.4",
28+
"blinker>=1.3.0",
29+
"requests>=2.9.1",
30+
]
31+
32+
[project.optional-dependencies]
33+
dev = [
34+
"unittest2>=1.1.0",
35+
"coveralls>=1.5.1",
36+
"mock>=2.0.0",
37+
"django>=1.8.8",
38+
"flask>=0.10",
39+
"WebTest>=2.0.32",
40+
"black",
41+
"flake8",
42+
"coverage",
43+
]
44+
45+
[project.scripts]
46+
raygun4py = "raygun4py.cli:main"
47+
48+
[project.urls]
49+
Homepage = "https://raygun.com"
50+
Documentation = "https://raygun.com/documentation/language-guides/python/crash-reporting/installation/"
51+
Repository = "https://github.com/MindscapeHQ/raygun4py"
52+
Changelog = "https://github.com/MindscapeHQ/raygun4py/blob/master/CHANGELOG.md"
53+
54+
[tool.hatch.version]
55+
path = "python3/raygun4py/version.py"
56+
57+
[tool.hatch.build.targets.sdist]
58+
include = [
59+
"/python3/raygun4py",
60+
"/README.rst",
61+
"/LICENSE",
62+
"/CHANGELOG.md",
63+
]
64+
65+
[tool.hatch.build.targets.wheel]
66+
packages = ["python3/raygun4py"]
67+
68+
[tool.hatch.build.targets.wheel.sources]
69+
"python3/raygun4py" = "raygun4py"
70+
71+
[tool.coverage.report]
72+
omit = [
73+
"*/__init__.py",
74+
"*/site-packages/*",
75+
"*/dist-packages/*",
76+
"*/tests/*",
77+
"/opt/*",
78+
]
79+
exclude_lines = [
80+
"pragma: no cover",
81+
"except Exception as e:",
82+
"except Exception:",
83+
]
84+
85+
[tool.black]
86+
target-version = ["py39", "py310", "py311", "py312", "py313"]

python3/raygun4py/version.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Store the version here so:
22
# 1) we don't load dependencies by storing it in __init__.py
3-
# 2) we can import it in setup.py for the same reason
4-
# 3) we can import it into your module module
3+
# 2) hatchling can read it for dynamic versioning (pyproject.toml)
4+
# 3) we can import it into your module
55
__version__ = "6.0.1"

setup.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)