Skip to content

Commit 4884968

Browse files
committed
Initial commit
1 parent 6a57631 commit 4884968

File tree

9 files changed

+151
-1
lines changed

9 files changed

+151
-1
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,7 @@ cython_debug/
157157
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158158
# and can be added to the global gitignore or merged into this file. For a more nuclear
159159
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
160-
#.idea/
160+
.idea/
161+
162+
# Version file
163+
/src/posit/_version.py

.vscode/launch.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: Current File",
9+
"type": "python",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal",
13+
"justMyCode": true
14+
}
15+
]
16+
}

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"src"
4+
],
5+
"python.testing.unittestEnabled": false,
6+
"python.testing.pytestEnabled": true
7+
}

Justfile

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
PIP := "pip3"
2+
PYTHON := "python3"
3+
4+
OPTIONS := if env("DEBUG", "false") == "true" {
5+
"set -eoux pipefail"
6+
} else {
7+
"set -eou pipefail"
8+
}
9+
10+
default:
11+
#!/usr/bin/env bash
12+
{{ OPTIONS }}
13+
14+
just clean
15+
just deps
16+
just test
17+
just cov
18+
just build
19+
20+
build:
21+
#!/usr/bin/env bash
22+
{{ OPTIONS }}
23+
24+
{{ PYTHON }} -m build
25+
26+
27+
cov *args="report":
28+
#!/usr/bin/env bash
29+
{{ OPTIONS }}
30+
31+
{{ PYTHON }} -m coverage {{ args }}
32+
33+
clean:
34+
#!/usr/bin/env bash
35+
{{ OPTIONS }}
36+
37+
find . -name "*.pyc" -exec rm -f {} +
38+
find . -name "__pycache__" -exec rm -rf {} +
39+
rm -rf\
40+
.coverage\
41+
.pytest_cache\
42+
*.egg-info\
43+
build\
44+
dist\
45+
htmlcov
46+
47+
deps:
48+
#!/usr/bin/env bash
49+
{{ OPTIONS }}
50+
51+
{{ PIP }} install -e '.[test]'
52+
53+
test:
54+
#!/usr/bin/env bash
55+
{{ OPTIONS }}
56+
57+
{{ PYTHON }} -m coverage run --source=src --omit=_version.py -m pytest
58+
59+
version:
60+
#!/usr/bin/env bash
61+
{{ OPTIONS }}
62+
63+
{{ PYTHON }} -m setuptools_scm

pyproject.toml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
[build-system]
2+
requires = ["setuptools>=60", "setuptools-scm>=8.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "posit-sdk"
7+
description = "Posit SDK for Python"
8+
readme = "README.md"
9+
requires-python = ">=3.8"
10+
license = { file = "LICENSE" }
11+
keywords = ["posit", "sdk"]
12+
classifiers = [
13+
"Development Status :: 1 - Planning",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: MIT License",
16+
"Programming Language :: Python :: 3",
17+
"Topic :: Software Development :: Libraries",
18+
"Typing :: Typed",
19+
]
20+
dynamic = ["version"]
21+
dependencies = [
22+
"requests==2.31.0"
23+
]
24+
25+
[project.optional-dependencies]
26+
test = [
27+
"coverage",
28+
"pytest",
29+
"setuptools-scm"
30+
]
31+
32+
[project.urls]
33+
Source = "https://github.com/posit-dev/posit-sdk-py"
34+
Issues = "https://github.com/posit-dev/posit-sdk-py/issues"
35+
36+
[tool.hatch.build.targets.wheel]
37+
packages = ["src/posit"]
38+
39+
[tool.hatch.build.hooks.vcs]
40+
version-file = "src/posit/_version.py"
41+
42+
[tool.hatch.build.targets.sdist]
43+
exclude = [
44+
"/.github",
45+
"/.pytest_cache",
46+
"/.vscode",
47+
]
48+
49+
[tool.setuptools_scm]
50+
version_file = "src/posit/_version.py"

src/posit/__init__.py

Whitespace-only changes.

src/posit/say_hello.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def say_hello(msg: str):
2+
print(f"Hello, {msg}!") # noqa: T201

tests/__init__.py

Whitespace-only changes.

tests/test_say_hello.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from unittest.mock import patch
2+
3+
from posit.say_hello import say_hello
4+
5+
6+
def test_say_hello():
7+
with patch("builtins.print") as mock_print:
8+
say_hello("World")
9+
mock_print.assert_called_once_with("Hello, World!")

0 commit comments

Comments
 (0)