alpin-api 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.
@@ -0,0 +1,220 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ *.lcov
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ # Pipfile.lock
97
+
98
+ # uv
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ # poetry.lock
110
+ # poetry.toml
111
+
112
+ # pdm
113
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
114
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
115
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
116
+ # pdm.lock
117
+ # pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # pixi
122
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
123
+ # pixi.lock
124
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
125
+ # in the .venv directory. It is recommended not to include this directory in version control.
126
+ .pixi/*
127
+ !.pixi/config.toml
128
+
129
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
130
+ __pypackages__/
131
+
132
+ # Celery stuff
133
+ celerybeat-schedule*
134
+ celerybeat.pid
135
+
136
+ # Redis
137
+ *.rdb
138
+ *.aof
139
+ *.pid
140
+
141
+ # RabbitMQ
142
+ mnesia/
143
+ rabbitmq/
144
+ rabbitmq-data/
145
+
146
+ # ActiveMQ
147
+ activemq-data/
148
+
149
+ # SageMath parsed files
150
+ *.sage.py
151
+
152
+ # Environments
153
+ .env
154
+ .envrc
155
+ .venv
156
+ env/
157
+ venv/
158
+ ENV/
159
+ env.bak/
160
+ venv.bak/
161
+
162
+ # Spyder project settings
163
+ .spyderproject
164
+ .spyproject
165
+
166
+ # Rope project settings
167
+ .ropeproject
168
+
169
+ # mkdocs/Zensical documentation
170
+ /site
171
+
172
+ # mypy
173
+ .mypy_cache/
174
+ .dmypy.json
175
+ dmypy.json
176
+
177
+ # Pyre type checker
178
+ .pyre/
179
+
180
+ # pytype static type analyzer
181
+ .pytype/
182
+
183
+ # Cython debug symbols
184
+ cython_debug/
185
+
186
+ # PyCharm
187
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
188
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
189
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
190
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
191
+ # .idea/
192
+
193
+ # Abstra
194
+ # Abstra is an AI-powered process automation framework.
195
+ # Ignore directories containing user credentials, local state, and settings.
196
+ # Learn more at https://abstra.io/docs
197
+ .abstra/
198
+
199
+ # Visual Studio Code
200
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore that
201
+ # can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
202
+ # and can be added to the global gitignore or merged into this file. However, if you prefer, you
203
+ # could uncomment the following to ignore the entire vscode folder
204
+ # .vscode/
205
+ # Temporary file for partial code execution
206
+ tempCodeRunnerFile.py
207
+
208
+ # Ruff stuff:
209
+ .ruff_cache/
210
+
211
+ # PyPI configuration file
212
+ .pypirc
213
+
214
+ # Marimo
215
+ marimo/_static/
216
+ marimo/_lsp/
217
+ __marimo__/
218
+
219
+ # Streamlit
220
+ .streamlit/secrets.toml
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michael Medek
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.
@@ -0,0 +1,118 @@
1
+ Metadata-Version: 2.5
2
+ Name: alpin-api
3
+ Version: 0.1.0
4
+ Summary: Deterministic forum scraping for Alpine ski-resort updates
5
+ Author: Michael Medek
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Michael Medek
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ License-File: LICENSE
28
+ Classifier: Development Status :: 3 - Alpha
29
+ Classifier: License :: OSI Approved :: MIT License
30
+ Classifier: Programming Language :: Python :: 3
31
+ Classifier: Programming Language :: Python :: 3.11
32
+ Classifier: Programming Language :: Python :: 3.12
33
+ Classifier: Programming Language :: Python :: 3.13
34
+ Requires-Python: >=3.11
35
+ Requires-Dist: beautifulsoup4>=4.12
36
+ Requires-Dist: curl-cffi>=0.13
37
+ Requires-Dist: requests>=2.32
38
+ Requires-Dist: tqdm>=4.67
39
+ Provides-Extra: tracker
40
+ Requires-Dist: groq>=0.31; extra == 'tracker'
41
+ Description-Content-Type: text/markdown
42
+
43
+ # alpin-api
44
+
45
+ Every night, this project turns posts from dedicated Alpine ski-resort forum topics into a public GeoJSON map of the latest construction and infrastructure progress.
46
+
47
+ [View the live GeoJSON map](https://github.com/MichaelMedek/alpin-api/blob/main/map.geojson)
48
+
49
+ ## For developers
50
+
51
+ You can install the `alpin_api` Python package from PyPI: its forum scrapers, `AlpinAPI`, data types, and deterministic resort/topic constants. The installed package reads live forum pages. The repository's Groq analysis, map generation, nightly automation, and file-writing application are not included in the published package.
52
+
53
+ ```shell
54
+ pip install alpin-api
55
+ ```
56
+
57
+ Or add it to a uv project:
58
+
59
+ ```shell
60
+ uv add alpin-api
61
+ ```
62
+
63
+ ## Examples
64
+
65
+ Choose the path that matches what you already know.
66
+
67
+ If you want updates for one registered resort, fetch recent posts from every topic assigned to its marker:
68
+
69
+ ```python
70
+ from alpin_api import AlpinAPI
71
+
72
+ posts_by_resort = AlpinAPI().fetch_posts(
73
+ resort_ids=["hintertuxer_gletscher"], # None fetches all registered resorts
74
+ days_old_max=5,
75
+ )
76
+ hintertux_posts = posts_by_resort["hintertuxer_gletscher"]
77
+ ```
78
+
79
+ If you first want to see what people are discussing on a forum, discover its latest topics:
80
+
81
+ ```python
82
+ from alpin_api import AlpinAPI, Forum
83
+
84
+ api = AlpinAPI()
85
+ latest_topics = api.fetch_latest_topics(
86
+ forum=Forum.ALPINFANS,
87
+ topic_limit=20,
88
+ )
89
+ for topic in latest_topics:
90
+ print(topic.topic_id, topic.title)
91
+ ```
92
+
93
+ Then select an interesting result and fetch its recent posts:
94
+
95
+ ```python
96
+ selected_topic = latest_topics[0]
97
+ topic_posts = api.fetch_topic_posts(
98
+ forum=selected_topic.forum,
99
+ topic_identifier=selected_topic.topic_id,
100
+ days_old_max=5,
101
+ )
102
+ ```
103
+
104
+ ## Retrieval boundaries
105
+
106
+ `days_old_max` is a rolling clock window, so `1` means exactly 24 hours backward. It intentionally reads the newest page and at most the immediately preceding page.
107
+ `topic_limit` applies separately to every discovery listing configured for a forum news and construction topics.
108
+
109
+ ## Development
110
+
111
+ Install the locked development environment and the repository's Git hooks:
112
+
113
+ ```shell
114
+ uv sync --extra tracker
115
+ uv run pre-commit install
116
+ ```
117
+
118
+ Run every configured hook with `uv run pre-commit run --all-files`. Repository-wide coding guidance lives in [`AGENTS.md`](AGENTS.md).
@@ -0,0 +1,76 @@
1
+ # alpin-api
2
+
3
+ Every night, this project turns posts from dedicated Alpine ski-resort forum topics into a public GeoJSON map of the latest construction and infrastructure progress.
4
+
5
+ [View the live GeoJSON map](https://github.com/MichaelMedek/alpin-api/blob/main/map.geojson)
6
+
7
+ ## For developers
8
+
9
+ You can install the `alpin_api` Python package from PyPI: its forum scrapers, `AlpinAPI`, data types, and deterministic resort/topic constants. The installed package reads live forum pages. The repository's Groq analysis, map generation, nightly automation, and file-writing application are not included in the published package.
10
+
11
+ ```shell
12
+ pip install alpin-api
13
+ ```
14
+
15
+ Or add it to a uv project:
16
+
17
+ ```shell
18
+ uv add alpin-api
19
+ ```
20
+
21
+ ## Examples
22
+
23
+ Choose the path that matches what you already know.
24
+
25
+ If you want updates for one registered resort, fetch recent posts from every topic assigned to its marker:
26
+
27
+ ```python
28
+ from alpin_api import AlpinAPI
29
+
30
+ posts_by_resort = AlpinAPI().fetch_posts(
31
+ resort_ids=["hintertuxer_gletscher"], # None fetches all registered resorts
32
+ days_old_max=5,
33
+ )
34
+ hintertux_posts = posts_by_resort["hintertuxer_gletscher"]
35
+ ```
36
+
37
+ If you first want to see what people are discussing on a forum, discover its latest topics:
38
+
39
+ ```python
40
+ from alpin_api import AlpinAPI, Forum
41
+
42
+ api = AlpinAPI()
43
+ latest_topics = api.fetch_latest_topics(
44
+ forum=Forum.ALPINFANS,
45
+ topic_limit=20,
46
+ )
47
+ for topic in latest_topics:
48
+ print(topic.topic_id, topic.title)
49
+ ```
50
+
51
+ Then select an interesting result and fetch its recent posts:
52
+
53
+ ```python
54
+ selected_topic = latest_topics[0]
55
+ topic_posts = api.fetch_topic_posts(
56
+ forum=selected_topic.forum,
57
+ topic_identifier=selected_topic.topic_id,
58
+ days_old_max=5,
59
+ )
60
+ ```
61
+
62
+ ## Retrieval boundaries
63
+
64
+ `days_old_max` is a rolling clock window, so `1` means exactly 24 hours backward. It intentionally reads the newest page and at most the immediately preceding page.
65
+ `topic_limit` applies separately to every discovery listing configured for a forum news and construction topics.
66
+
67
+ ## Development
68
+
69
+ Install the locked development environment and the repository's Git hooks:
70
+
71
+ ```shell
72
+ uv sync --extra tracker
73
+ uv run pre-commit install
74
+ ```
75
+
76
+ Run every configured hook with `uv run pre-commit run --all-files`. Repository-wide coding guidance lives in [`AGENTS.md`](AGENTS.md).
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.27"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "alpin-api"
7
+ version = "0.1.0"
8
+ description = "Deterministic forum scraping for Alpine ski-resort updates"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { file = "LICENSE" }
12
+ authors = [{ name = "Michael Medek" }]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ ]
21
+ dependencies = [
22
+ "beautifulsoup4>=4.12",
23
+ "curl-cffi>=0.13",
24
+ "requests>=2.32",
25
+ "tqdm>=4.67",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ tracker = ["groq>=0.31"]
30
+
31
+ [dependency-groups]
32
+ dev = [
33
+ "build>=1.2",
34
+ "pre-commit>=4.6",
35
+ "pytest>=8.4",
36
+ "pytest-cov>=6.2",
37
+ "ruff>=0.12",
38
+ ]
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/alpin_api"]
42
+
43
+ [tool.hatch.build.targets.sdist]
44
+ include = [
45
+ "/src/alpin_api",
46
+ "/LICENSE",
47
+ "/README.md",
48
+ "/pyproject.toml",
49
+ ]
50
+
51
+ [tool.pytest.ini_options]
52
+ testpaths = ["tests"]
53
+ pythonpath = [".", "src"]
54
+ addopts = "-ra"
55
+
56
+ [tool.ruff]
57
+ line-length = 120
58
+ target-version = "py311"
59
+
60
+ [tool.ruff.lint]
61
+ select = ["E4", "E7", "E9", "F", "B", "C90", "I", "UP"]
62
+
63
+ [tool.ruff.lint.mccabe]
64
+ max-complexity = 10
65
+
66
+ [tool.ruff.lint.per-file-ignores]
67
+ ".claude/hooks/deny-git-mutations.py" = ["C901"]
68
+
69
+ [tool.coverage.run]
70
+ branch = true
71
+ source = ["alpin_api"]
@@ -0,0 +1,17 @@
1
+ """Public package interface for deterministic Alpine forum scraping."""
2
+
3
+ from alpin_api.api import AlpinAPI, PostsByResort
4
+ from alpin_api.constants import Forum, ForumTopic, SkiResort
5
+ from alpin_api.registry import SKI_RESORTS
6
+ from alpin_api.scraper import ImageLink, PostDict
7
+
8
+ __all__ = [
9
+ "AlpinAPI",
10
+ "Forum",
11
+ "ForumTopic",
12
+ "ImageLink",
13
+ "PostDict",
14
+ "PostsByResort",
15
+ "SKI_RESORTS",
16
+ "SkiResort",
17
+ ]