py-opensdbrussels2026 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py_opensdbrussels2026-0.1.0/PKG-INFO +66 -0
- py_opensdbrussels2026-0.1.0/README.md +54 -0
- py_opensdbrussels2026-0.1.0/pyproject.toml +35 -0
- py_opensdbrussels2026-0.1.0/setup.cfg +4 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026/__init__.py +6 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026/data/__init__.py +2 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026/data/participants.csv +5 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026/participants.py +29 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026.egg-info/PKG-INFO +66 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026.egg-info/SOURCES.txt +12 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026.egg-info/dependency_links.txt +1 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026.egg-info/requires.txt +4 -0
- py_opensdbrussels2026-0.1.0/src/py_opensdbrussels2026.egg-info/top_level.txt +1 -0
- py_opensdbrussels2026-0.1.0/tests/test_participants.py +35 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py_opensdbrussels2026
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A tiny demo Python package for the OpenSD 2026 Brussels summer school
|
|
5
|
+
Author: OpenSD 2026 Brussels workshop contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pycountry>=24.6.1; extra == "dev"
|
|
11
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
+
|
|
13
|
+
# py_opensdbrussels2026
|
|
14
|
+
|
|
15
|
+
`py_opensdbrussels2026` is a tiny example package for the OpenSD 2026 Brussels summer school. It is intentionally small so it can be used to demonstrate how a Git repository is structured and how open source contributions work.
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
|
|
19
|
+
The package ships with a small CSV file of participants and exposes one public function:
|
|
20
|
+
|
|
21
|
+
- `attendee_was_present(first_name, family_name) -> bool`
|
|
22
|
+
|
|
23
|
+
It returns `True` when the provided participant name exists in the packaged CSV file and `False` otherwise.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install py_opensdbrussels2026
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For local development:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e .[dev]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from py_opensdbrussels2026 import attendee_was_present
|
|
41
|
+
|
|
42
|
+
attendee_was_present("Ada", "Lovelace")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Tests
|
|
46
|
+
|
|
47
|
+
The test suite contains:
|
|
48
|
+
|
|
49
|
+
- a normal boolean check for an invalid attendee name
|
|
50
|
+
- a positive check for a known attendee
|
|
51
|
+
- a joke test that reads the packaged CSV, validates countries via `pycountry`, and confirms that `Belgium` is the only intentionally invalid country
|
|
52
|
+
|
|
53
|
+
Run the tests with:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pytest
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## GitHub Actions
|
|
60
|
+
|
|
61
|
+
Two workflows are included:
|
|
62
|
+
|
|
63
|
+
- CI workflow for running `pytest` on pushes and pull requests
|
|
64
|
+
- Publish workflow for building and publishing the package to PyPI when a GitHub release is published
|
|
65
|
+
|
|
66
|
+
To use the publish workflow, configure PyPI trusted publishing for this repository.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# py_opensdbrussels2026
|
|
2
|
+
|
|
3
|
+
`py_opensdbrussels2026` is a tiny example package for the OpenSD 2026 Brussels summer school. It is intentionally small so it can be used to demonstrate how a Git repository is structured and how open source contributions work.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
The package ships with a small CSV file of participants and exposes one public function:
|
|
8
|
+
|
|
9
|
+
- `attendee_was_present(first_name, family_name) -> bool`
|
|
10
|
+
|
|
11
|
+
It returns `True` when the provided participant name exists in the packaged CSV file and `False` otherwise.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install py_opensdbrussels2026
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
For local development:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install -e .[dev]
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from py_opensdbrussels2026 import attendee_was_present
|
|
29
|
+
|
|
30
|
+
attendee_was_present("Ada", "Lovelace")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Tests
|
|
34
|
+
|
|
35
|
+
The test suite contains:
|
|
36
|
+
|
|
37
|
+
- a normal boolean check for an invalid attendee name
|
|
38
|
+
- a positive check for a known attendee
|
|
39
|
+
- a joke test that reads the packaged CSV, validates countries via `pycountry`, and confirms that `Belgium` is the only intentionally invalid country
|
|
40
|
+
|
|
41
|
+
Run the tests with:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pytest
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## GitHub Actions
|
|
48
|
+
|
|
49
|
+
Two workflows are included:
|
|
50
|
+
|
|
51
|
+
- CI workflow for running `pytest` on pushes and pull requests
|
|
52
|
+
- Publish workflow for building and publishing the package to PyPI when a GitHub release is published
|
|
53
|
+
|
|
54
|
+
To use the publish workflow, configure PyPI trusted publishing for this repository.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "py_opensdbrussels2026"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A tiny demo Python package for the OpenSD 2026 Brussels summer school"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "OpenSD 2026 Brussels workshop contributors" }
|
|
14
|
+
]
|
|
15
|
+
dependencies = []
|
|
16
|
+
|
|
17
|
+
[project.optional-dependencies]
|
|
18
|
+
dev = [
|
|
19
|
+
"pycountry>=24.6.1",
|
|
20
|
+
"pytest>=8.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[tool.setuptools]
|
|
24
|
+
package-dir = { "" = "src" }
|
|
25
|
+
include-package-data = true
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.packages.find]
|
|
28
|
+
where = ["src"]
|
|
29
|
+
|
|
30
|
+
[tool.setuptools.package-data]
|
|
31
|
+
"py_opensdbrussels2026.data" = ["participants.csv"]
|
|
32
|
+
|
|
33
|
+
[tool.pytest.ini_options]
|
|
34
|
+
addopts = "-ra"
|
|
35
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Participant lookup helpers."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import csv
|
|
6
|
+
from functools import lru_cache
|
|
7
|
+
from importlib.resources import files
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def _normalize(value: str) -> str:
|
|
11
|
+
return value.strip().casefold()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@lru_cache(maxsize=1)
|
|
15
|
+
def _participant_names() -> frozenset[tuple[str, str]]:
|
|
16
|
+
csv_path = files("py_opensdbrussels2026.data").joinpath("participants.csv")
|
|
17
|
+
with csv_path.open("r", encoding="utf-8", newline="") as handle:
|
|
18
|
+
reader = csv.DictReader(handle)
|
|
19
|
+
return frozenset(
|
|
20
|
+
(_normalize(row["first_name"]), _normalize(row["family_name"]))
|
|
21
|
+
for row in reader
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def attendee_was_present(first_name: str, family_name: str) -> bool:
|
|
26
|
+
"""Return whether a participant appears in the packaged attendee list."""
|
|
27
|
+
|
|
28
|
+
return (_normalize(first_name), _normalize(family_name)) in _participant_names()
|
|
29
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: py_opensdbrussels2026
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A tiny demo Python package for the OpenSD 2026 Brussels summer school
|
|
5
|
+
Author: OpenSD 2026 Brussels workshop contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
Provides-Extra: dev
|
|
10
|
+
Requires-Dist: pycountry>=24.6.1; extra == "dev"
|
|
11
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
12
|
+
|
|
13
|
+
# py_opensdbrussels2026
|
|
14
|
+
|
|
15
|
+
`py_opensdbrussels2026` is a tiny example package for the OpenSD 2026 Brussels summer school. It is intentionally small so it can be used to demonstrate how a Git repository is structured and how open source contributions work.
|
|
16
|
+
|
|
17
|
+
## What it does
|
|
18
|
+
|
|
19
|
+
The package ships with a small CSV file of participants and exposes one public function:
|
|
20
|
+
|
|
21
|
+
- `attendee_was_present(first_name, family_name) -> bool`
|
|
22
|
+
|
|
23
|
+
It returns `True` when the provided participant name exists in the packaged CSV file and `False` otherwise.
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
pip install py_opensdbrussels2026
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
For local development:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e .[dev]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```python
|
|
40
|
+
from py_opensdbrussels2026 import attendee_was_present
|
|
41
|
+
|
|
42
|
+
attendee_was_present("Ada", "Lovelace")
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Tests
|
|
46
|
+
|
|
47
|
+
The test suite contains:
|
|
48
|
+
|
|
49
|
+
- a normal boolean check for an invalid attendee name
|
|
50
|
+
- a positive check for a known attendee
|
|
51
|
+
- a joke test that reads the packaged CSV, validates countries via `pycountry`, and confirms that `Belgium` is the only intentionally invalid country
|
|
52
|
+
|
|
53
|
+
Run the tests with:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pytest
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## GitHub Actions
|
|
60
|
+
|
|
61
|
+
Two workflows are included:
|
|
62
|
+
|
|
63
|
+
- CI workflow for running `pytest` on pushes and pull requests
|
|
64
|
+
- Publish workflow for building and publishing the package to PyPI when a GitHub release is published
|
|
65
|
+
|
|
66
|
+
To use the publish workflow, configure PyPI trusted publishing for this repository.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/py_opensdbrussels2026/__init__.py
|
|
4
|
+
src/py_opensdbrussels2026/participants.py
|
|
5
|
+
src/py_opensdbrussels2026.egg-info/PKG-INFO
|
|
6
|
+
src/py_opensdbrussels2026.egg-info/SOURCES.txt
|
|
7
|
+
src/py_opensdbrussels2026.egg-info/dependency_links.txt
|
|
8
|
+
src/py_opensdbrussels2026.egg-info/requires.txt
|
|
9
|
+
src/py_opensdbrussels2026.egg-info/top_level.txt
|
|
10
|
+
src/py_opensdbrussels2026/data/__init__.py
|
|
11
|
+
src/py_opensdbrussels2026/data/participants.csv
|
|
12
|
+
tests/test_participants.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
py_opensdbrussels2026
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import csv
|
|
2
|
+
from importlib.resources import files
|
|
3
|
+
|
|
4
|
+
import pycountry
|
|
5
|
+
|
|
6
|
+
from py_opensdbrussels2026 import attendee_was_present
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_invalid_name_returns_false() -> None:
|
|
10
|
+
assert attendee_was_present("Grace", "Hopper") is False
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_known_name_returns_true() -> None:
|
|
14
|
+
assert attendee_was_present("Ada", "Lovelace") is True
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_participant_countries_are_real() -> None:
|
|
18
|
+
csv_path = files("py_opensdbrussels2026.data").joinpath("participants.csv")
|
|
19
|
+
with csv_path.open("r", encoding="utf-8", newline="") as handle:
|
|
20
|
+
reader = csv.DictReader(handle)
|
|
21
|
+
countries = {row["country"] for row in reader}
|
|
22
|
+
|
|
23
|
+
recognized_countries = {
|
|
24
|
+
country_name
|
|
25
|
+
for country in pycountry.countries
|
|
26
|
+
for country_name in {
|
|
27
|
+
country.name,
|
|
28
|
+
getattr(country, "common_name", country.name),
|
|
29
|
+
getattr(country, "official_name", country.name),
|
|
30
|
+
}
|
|
31
|
+
if country.name != "Belgium"
|
|
32
|
+
}
|
|
33
|
+
invalid_countries = countries - recognized_countries
|
|
34
|
+
|
|
35
|
+
assert invalid_countries == set()
|