-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a new project using `hatch new`. Added linting with `black` and `ruff` and typing with `mypy`. Created a placeholder for the AppSignal CLI command.
- Loading branch information
0 parents
commit f7af937
Showing
10 changed files
with
164 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.mypy_cache | ||
/.pytest_cache | ||
/.ruff_cache | ||
__pycache__ | ||
/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python 3.11.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# AppSignal Python | ||
|
||
[](https://pypi.org/project/appsignal-python) | ||
[](https://pypi.org/project/appsignal-python) | ||
|
||
----- | ||
|
||
**Table of Contents** | ||
|
||
- [Installation](#installation) | ||
- [License](#license) | ||
|
||
## Installation | ||
|
||
```console | ||
pip install appsignal | ||
``` | ||
|
||
## Development | ||
|
||
AppSignal for Python uses [Hatch](https://hatch.pypa.io/latest/) to manage dependencies, packaging and development environments. | ||
|
||
```sh | ||
pip install hatch | ||
``` | ||
|
||
### Linting and type checking | ||
|
||
```sh | ||
hatch run lint:all | ||
|
||
hatch run lint:fmt # auto-formatting only | ||
hatch run lint:style # style checking only | ||
hatch run lint:typing # type checking only | ||
``` | ||
|
||
### Running tests | ||
|
||
```sh | ||
hatch run test:pytest | ||
``` | ||
|
||
### Running the CLI command | ||
|
||
```sh | ||
hatch shell | ||
appsignal | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "appsignal" | ||
description = 'The AppSignal integration for the Python programming language' | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
keywords = [] | ||
authors = [ | ||
{ name = "Tom de Bruijn", email = "[email protected]" }, | ||
{ name = "Noemi Lapresta", email = "[email protected]" }, | ||
] | ||
classifiers = [ | ||
# Python versions | ||
"Programming Language :: Python", | ||
"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 :: Implementation :: CPython", | ||
"Programming Language :: Python :: Implementation :: PyPy", | ||
# Application version | ||
"Development Status :: 3 - Alpha", | ||
# Remove this to allow publishing | ||
"Private :: Do Not Upload" | ||
] | ||
dependencies = [] | ||
dynamic = ["version"] | ||
|
||
[project.urls] | ||
Documentation = "https://github.com/appsignal/appsignal-python#readme" | ||
Issues = "https://github.com/appsignal/appsignal-python/issues" | ||
Source = "https://github.com/appsignal/appsignal-python" | ||
|
||
[project.scripts] | ||
appsignal = "appsignal.cli:run" | ||
|
||
[tool.hatch.version] | ||
path = "src/appsignal/__about__.py" | ||
|
||
[tool.hatch.build] | ||
sources = ["src"] | ||
|
||
[tool.hatch.envs.default] | ||
dependencies = [ | ||
"pytest", | ||
"pytest-cov", | ||
] | ||
[tool.hatch.envs.default.scripts] | ||
cov = "pytest --cov-report=term-missing --cov-config=pyproject.toml --cov=src --cov=tests {args}" | ||
no-cov = "cov --no-cov {args}" | ||
|
||
[[tool.hatch.envs.test.matrix]] | ||
python = ["37", "38", "39", "310", "311"] | ||
|
||
[tool.hatch.envs.lint] | ||
detached = true | ||
dependencies = [ | ||
"black>=23.1.0", | ||
"mypy>=1.0.0", | ||
"ruff>=0.0.243", | ||
] | ||
|
||
[tool.hatch.envs.lint.scripts] | ||
typing = "mypy --install-types --non-interactive --check-untyped-defs {args:src tests}" | ||
style = [ | ||
"ruff {args:.}", | ||
"black --check --diff {args:.}", | ||
] | ||
fmt = [ | ||
"black {args:.}", | ||
"ruff --fix {args:.}", | ||
"style", | ||
] | ||
all = [ | ||
"fmt", | ||
"style", | ||
"typing", | ||
] | ||
|
||
[tool.coverage.run] | ||
branch = true | ||
parallel = true | ||
omit = [ | ||
"src/appsignal/__about__.py", | ||
] | ||
|
||
[tool.coverage.report] | ||
exclude_lines = [ | ||
"no cov", | ||
"if __name__ == .__main__.:", | ||
"if TYPE_CHECKING:", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.0.1" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def run(): | ||
print("Hello AppSignal!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def add(a: str, b: str) -> str: | ||
# uncomment the following to trigger a type error | ||
# return a - b | ||
return a + b |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from appsignal.something import add | ||
|
||
|
||
def test_something(): | ||
# uncomment the following to trigger a type error: | ||
# assert add(2, 2) == 4 | ||
assert add("foo", "bar") == "foobar" |