bss-mcp 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,11 @@
1
+ # Stage — BasicAuth
2
+ BSS_URL=https://basicsupply.your-stage-env.example.com
3
+ BSS_AUTH_TYPE=basic
4
+ BSS_USER=your-username
5
+ BSS_PASSWORD=your-password
6
+
7
+ # Prod — OAuth (fill these instead of USER/PASSWORD)
8
+ # BSS_AUTH_TYPE=oauth
9
+ # BSS_CLIENT_ID=your-client-id
10
+ # BSS_CLIENT_SECRET=your-client-secret
11
+ # BSS_TOKEN_URL=https://your-auth-server/token
@@ -0,0 +1,18 @@
1
+ # To get started with Dependabot version updates, you'll need to specify which
2
+ # package ecosystems to update and where the package manifests are located.
3
+ # Please see the documentation for all configuration options:
4
+ # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5
+
6
+ version: 2
7
+ updates:
8
+ - package-ecosystem: "pip" # See documentation for possible values
9
+ directory: "/" # Location of package manifests
10
+ schedule:
11
+ interval: "weekly"
12
+ reviewers:
13
+ - "@Hochfrequenz/python-developers-review-team"
14
+ # Maintain dependencies for GitHub Actions
15
+ - package-ecosystem: "github-actions"
16
+ directory: "/"
17
+ schedule:
18
+ interval: "weekly"
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [main]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [main]
20
+ schedule:
21
+ - cron: "29 14 * * 6"
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: ["python"]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v6
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v4
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v4
57
+
58
+ # â„šī¸ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v4
@@ -0,0 +1,22 @@
1
+ name: "Coverage"
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request: {}
7
+ jobs:
8
+ coverage:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v6
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v6
14
+ with:
15
+ python-version: 3.14
16
+ - name: Install dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ pip install tox
20
+ - name: Run Tests and Record Coverage
21
+ run: |
22
+ tox -e coverage
@@ -0,0 +1,18 @@
1
+ name: Dependabot auto-approve / -merge
2
+ on: pull_request
3
+
4
+ jobs:
5
+ dependabot:
6
+ permissions:
7
+ contents: write
8
+ pull-requests: write
9
+ runs-on: ubuntu-latest
10
+ env:
11
+ PR_URL: ${{github.event.pull_request.html_url}}
12
+ GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
13
+ if: ${{ github.actor == 'dependabot[bot]' }}
14
+ steps:
15
+ - name: Approve a PR
16
+ run: gh pr review --approve "$PR_URL"
17
+ - name: Enable auto-merge for Dependabot PRs
18
+ run: gh pr merge --auto --squash "$PR_URL"
@@ -0,0 +1,28 @@
1
+ name: "Test Dev Environment"
2
+ # Checks that the dev environment (tox -e dev) can be set up.
3
+ # This might not work, if different linting/testing envs refer to different versions of the same lib (e.g. typing-extensions).
4
+ # Different versions of the same package might work for isolated specific envs (only linting, only testing...) but the dev environment inherits from all of them.
5
+ on:
6
+ push:
7
+ branches: [main]
8
+ pull_request: {}
9
+ jobs:
10
+ check:
11
+ runs-on: ${{ matrix.os }}
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
15
+ os: [ubuntu-latest]
16
+ steps:
17
+ - uses: actions/checkout@v6
18
+ - name: Set up Python ${{ matrix.python-version }}
19
+ uses: actions/setup-python@v6
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+ - name: Install Dependencies
23
+ run: |
24
+ python -m pip install --upgrade pip
25
+ pip install tox
26
+ - name: Create a Dev Environment
27
+ run: |
28
+ tox -e dev
@@ -0,0 +1,25 @@
1
+ name: "Formatting"
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request: {}
7
+ jobs:
8
+ format:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ tool: ["black", "isort"]
13
+ steps:
14
+ - uses: actions/checkout@v6
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v6
17
+ with:
18
+ python-version: 3.14
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install .[formatting]
23
+ - name: ${{ matrix.tool }} Code Formatter
24
+ run: |
25
+ ${{ matrix.tool }} . --check
@@ -0,0 +1,15 @@
1
+ name: Prevent ByteOrderMarks
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request: {}
8
+
9
+ jobs:
10
+ bom-check:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v6
14
+ - uses: arma-actions/bom-check@v1
15
+ name: Check for BOM
@@ -0,0 +1,22 @@
1
+ name: "Packaging Test"
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request: {}
7
+ jobs:
8
+ check_packaging:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v6
12
+ - name: Set up Python
13
+ uses: actions/setup-python@v6
14
+ with:
15
+ python-version: 3.14
16
+ - name: Install dependencies
17
+ run: |
18
+ python -m pip install --upgrade pip
19
+ pip install tox
20
+ - name: Run Packaging Test
21
+ run: |
22
+ tox -e test_packaging
@@ -0,0 +1,65 @@
1
+ # This GitHub workflow is only needed for python package releases which are supposed to be published on pypi.
2
+ # It requires the Github "environments" feature (see instructions below) it might not be available for private free accounts (but works for public or organization repos).
3
+ # After creating the "release" environment in the Github repo settings, you need to enter your Github organization/user name + repo name + "python-publish.yml" workflow file name in the PyPI UI to make this work.
4
+
5
+ # This workflow uploads a Python Package using Twine when a release is created.
6
+ # For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
7
+
8
+ name: Upload Python Package
9
+
10
+ on:
11
+ release:
12
+ types: [created, edited]
13
+
14
+ jobs:
15
+ tests:
16
+ if: startsWith(github.ref, 'refs/tags/v')
17
+ runs-on: ${{ matrix.os }}
18
+ strategy:
19
+ matrix:
20
+ python-version: ["3.14"]
21
+ os: [ubuntu-latest]
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - name: Set up Python ${{ matrix.python-version }}
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: ${{ matrix.python-version }}
28
+ - name: Install tox
29
+ run: |
30
+ python -m pip install --upgrade pip
31
+ pip install tox
32
+ - name: Run tox
33
+ run: |
34
+ tox
35
+
36
+ build-n-publish:
37
+ name: Build and publish Python 🐍 distributions đŸ“Ļ to PyPI and TestPyPI
38
+ runs-on: ${{ matrix.os }}
39
+ strategy:
40
+ matrix:
41
+ python-version: [ "3.14" ]
42
+ os: [ ubuntu-latest ]
43
+ # Specifying a GitHub environment, # Specifying a GitHub environment, which is strongly recommended by PyPI: https://docs.pypi.org/trusted-publishers/adding-a-publisher/
44
+ # you have to create an environment in your repository settings and add the environment name here
45
+ environment: release
46
+ permissions:
47
+ # IMPORTANT: this permission is mandatory for trusted publishing
48
+ id-token: write
49
+ needs: tests
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - name: Set up Python ${{ matrix.python-version }}
53
+ uses: actions/setup-python@v5
54
+ with:
55
+ python-version: ${{ matrix.python-version }}
56
+ - name: Install dependencies
57
+ run: |
58
+ python -m pip install --upgrade pip
59
+ pip install .[packaging]
60
+ - name: Build wheel and source distributions
61
+ run: |
62
+ python -m build
63
+ - name: Publish distribution đŸ“Ļ to PyPI
64
+ if: startsWith(github.ref, 'refs/tags/v')
65
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,26 @@
1
+ name: "Linting"
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request: {}
7
+ jobs:
8
+ pylint:
9
+ name: Python Code Quality and Lint
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ linter-env: ["linting", "type_check", "spell_check"]
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v6
18
+ with:
19
+ python-version: 3.14
20
+ - name: Install Dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install tox
24
+ - name: Run ${{ matrix.linter-env }} via Tox
25
+ run: |
26
+ tox -e ${{ matrix.linter-env }}
@@ -0,0 +1,26 @@
1
+ name: "Unittests"
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request: {}
7
+ jobs:
8
+ pytest:
9
+ runs-on: ${{ matrix.os }}
10
+ strategy:
11
+ matrix:
12
+ python-version: ["3.11", "3.12", "3.13", "3.14"]
13
+ os: [ubuntu-latest]
14
+ steps:
15
+ - uses: actions/checkout@v6
16
+ - name: Set up Python ${{ matrix.python-version }}
17
+ uses: actions/setup-python@v6
18
+ with:
19
+ python-version: ${{ matrix.python-version }}
20
+ - name: Install Dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install tox
24
+ - name: Run the Unit Tests via Tox
25
+ run: |
26
+ tox -e tests
@@ -0,0 +1,139 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
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
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ target/
76
+
77
+ # Jupyter Notebook
78
+ .ipynb_checkpoints
79
+
80
+ # IPython
81
+ profile_default/
82
+ ipython_config.py
83
+
84
+ # pyenv
85
+ .python-version
86
+
87
+ # pipenv
88
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
90
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
91
+ # install all needed dependencies.
92
+ #Pipfile.lock
93
+
94
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95
+ __pypackages__/
96
+
97
+ # Celery stuff
98
+ celerybeat-schedule
99
+ celerybeat.pid
100
+
101
+ # SageMath parsed files
102
+ *.sage.py
103
+
104
+ # Environments
105
+ .env
106
+ .venv
107
+ env/
108
+ venv/
109
+ ENV/
110
+ env.bak/
111
+ venv.bak/
112
+
113
+ # Spyder project settings
114
+ .spyderproject
115
+ .spyproject
116
+
117
+ # Rope project settings
118
+ .ropeproject
119
+
120
+ # mkdocs documentation
121
+ /site
122
+
123
+ # mypy
124
+ .mypy_cache/
125
+ .dmypy.json
126
+ dmypy.json
127
+
128
+ # Pyre type checker
129
+ .pyre/
130
+
131
+ .idea/
132
+
133
+ # vscode settings
134
+ .vscode/
135
+
136
+ # git worktrees
137
+ .worktrees/
138
+
139
+ src/_your_package_version.py
bss_mcp-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,44 @@
1
+ Metadata-Version: 2.4
2
+ Name: bss-mcp
3
+ Version: 0.1.0
4
+ Summary: MCP server for the Basic Supply Service (BSS) — read-only debug tools
5
+ Author-email: Hochfrequenz Unternehmensberatung GmbH <info+pip@hochfrequenz.de>
6
+ License: MIT
7
+ Keywords: basicsupply,bss,mcp
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Programming Language :: Python :: 3.14
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: bssclient>=0.1
21
+ Requires-Dist: fastmcp>=3.0
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: pydantic-settings>=2.7
24
+ Requires-Dist: python-dotenv>=1.0
25
+ Provides-Extra: coverage
26
+ Requires-Dist: coverage>=7; extra == 'coverage'
27
+ Provides-Extra: dev
28
+ Requires-Dist: pip-tools; extra == 'dev'
29
+ Provides-Extra: formatting
30
+ Requires-Dist: black>=25; extra == 'formatting'
31
+ Requires-Dist: isort>=5; extra == 'formatting'
32
+ Provides-Extra: linting
33
+ Requires-Dist: pylint>=4; extra == 'linting'
34
+ Provides-Extra: packaging
35
+ Requires-Dist: build>=1; extra == 'packaging'
36
+ Requires-Dist: twine>=6; extra == 'packaging'
37
+ Provides-Extra: spell-check
38
+ Requires-Dist: codespell>=2; extra == 'spell-check'
39
+ Provides-Extra: tests
40
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'tests'
41
+ Requires-Dist: pytest-mock>=3; extra == 'tests'
42
+ Requires-Dist: pytest>=9; extra == 'tests'
43
+ Provides-Extra: type-check
44
+ Requires-Dist: mypy>=1.10; extra == 'type-check'
@@ -0,0 +1,271 @@
1
+ # Python Template Repository including a `tox.ini`, Unittests&Coverage, Pylint & MyPy Linting Actions and a PyPI Publishing Workflow
2
+
3
+ <!--- you need to replace the `organization/repo_name` in the status badge URLs --->
4
+
5
+ ![Unittests status badge](https://github.com/Hochfrequenz/python_template_repository/workflows/Unittests/badge.svg)
6
+ ![Coverage status badge](https://github.com/Hochfrequenz/python_template_repository/workflows/Coverage/badge.svg)
7
+ ![Linting status badge](https://github.com/Hochfrequenz/python_template_repository/workflows/Linting/badge.svg)
8
+ ![Black status badge](https://github.com/Hochfrequenz/python_template_repository/workflows/Formatting/badge.svg)
9
+
10
+ This is a template repository.
11
+ It doesn't contain any useful code but only a minimal working setup for a Python project including:
12
+
13
+ - a basic **project structure** with
14
+ - tox.ini
15
+ - `pyproject.toml` where the project metadata and dependencies are defined
16
+ - and a requirements.txt derived from it
17
+ - an example class
18
+ - an example unit test (using pytest)
19
+ - ready to use **Github Actions** for
20
+ - [pytest](https://pytest.org)
21
+ - [code coverage measurement](https://coverage.readthedocs.io) (fails below 80% by default)
22
+ - [pylint](https://pylint.org/) (only accepts 10/10 code rating by default)
23
+ - [mypy](https://github.com/python/mypy) (static type checks where possible)
24
+ - [black](https://github.com/psf/black) code formatter check
25
+ - [isort](https://pycqa.github.io/isort/) import order check
26
+ - [codespell](https://github.com/codespell-project/codespell) spell check (including an ignore list)
27
+ - autoresolve dev-dependencies with `tox -e compile_requirements`
28
+ - ready-to-use publishing workflow for pypi (see readme section below)
29
+
30
+ By default, it uses Python version 3.13.
31
+
32
+ This repository uses a [`src`-based layout](https://packaging.python.org/en/latest/discussions/src-layout-vs-flat-layout/).
33
+ This approach has many advantages and basically means for developers, that all business logic lives in the `src` directory.
34
+
35
+ ## How to use this Repository on Your Machine
36
+
37
+ ### Installation of Tox / Creating the tox base venv
38
+ If you ever set up your toxbase virtual environment already, skip this first step and continue with the project-specific setup.
39
+
40
+ <details>
41
+ <summary>
42
+ Creating the toxbase from scratch (windows)
43
+ </summary>
44
+
45
+ You can either follow the [installation instructions](https://tox.readthedocs.io/en/latest/installation.html)) and that a `.toxbase` environment has been created.
46
+ Here we repeat the most important steps.
47
+
48
+ #### Enure you are allowed to execute scripts in powershell (Windows only)
49
+ On new Windows machines it is possible that the execution policy is set to restricted and you are not allowed execute scripts. You can find detailed information [here](https://learn.microsoft.com/de-de/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.3).
50
+
51
+ The quickest way to solve this problem: Open an Administrator Powershell (e.g. Windows PowerShell App, right click: 'Run as Adminstrator')
52
+ ```ps
53
+ Set-ExecutionPolicy -ExecutionPolicy AllSigned
54
+ ```
55
+ Then close the admin powershell and continue in the regular shell.
56
+
57
+ #### Create the `.toxbase` environment
58
+ `.toxbase` is a project independent virtual environment-template for all the tox environments on your machine. If anything is weird during the tox installation or after the installation, try turning your computer off and on again before getting too frustrated.
59
+ Ask your Hochfrequenz colleagues for help.
60
+
61
+ ```ps
62
+ # Change to your user directory, create tools directory if it does not exist
63
+ $ cd C:\Users\YourUserName
64
+ # Create a virtual environment called .toxbase
65
+ $ python -m venv .toxbase
66
+ ```
67
+
68
+ then
69
+ ```ps
70
+ # Windows Powershell
71
+ $ .\.toxbase\Scripts\Activate.ps1
72
+ # XOR Windows default (e.g. cmder)
73
+ Îģ .toxbase\Scripts\activate.bat
74
+ # the virtual environment is active
75
+ # if you see the environment name at the beginning of the line
76
+ (.toxbase) $ python -m pip install --upgrade pip
77
+ (.toxbase) $ pip install tox
78
+ (.toxbase) $ tox --version
79
+ ```
80
+
81
+ #### Add the toxbase interpreter to the Path environment variable
82
+ Finally, we need to make the tox command available in all future terminal sessions.
83
+ There are ways to achieve this goal using only the powershell commands, but we just use the "regular" way:
84
+
85
+ * Type systemvariable in the search field of your windows taskbar.
86
+ * Click on Edit system variables, then on environment variables.
87
+ * In the next window select Path in the upper part (User variables for YourUserName) and click on edit.
88
+ * Add a new path with `C:\Users\YourUserName\.toxbase\Scripts\`
89
+ * âš ī¸ You have to replace YourUserName with your actual username in the path!
90
+ the path up to .toxbase has already been printed to the CLI in the tox --version command above
91
+
92
+ * Save the settings.
93
+ * Now you have to sign out and in again to make the changes work.
94
+
95
+ You should now be able to type the following and get a reasonable answer
96
+ ```
97
+ tox --version
98
+ ```
99
+ in every shell, no matter if you activated the toxbase again.
100
+
101
+ #### Umlaute in Paths
102
+ Tox has an issue if you have an umlaut in your username. [This issue](https://github.com/tox-dev/tox/issues/1550#issuecomment-727824763) is well known.
103
+
104
+ To solve it you have to add another environment variable `PYTHONIOENCODING` with the value `utf-8` ([source](https://github.com/tox-dev/tox/issues/1550#issuecomment-1011952057)).
105
+
106
+ Start a new PowerShell session and try to run tox -e dev in your repository again.
107
+
108
+ </details>
109
+
110
+ <details>
111
+ <summary>
112
+ Creating the toxbase from scratch (unix)
113
+ </summary>
114
+ Open a terminal and execute the following commands
115
+
116
+ ```sh
117
+ # Change to your user directory
118
+ $ cd ~
119
+ # Create a virtual environment called .toxbase
120
+ $ python -m venv .toxbase
121
+ ```
122
+ Now we activate the virtual environment, update pip and install tox:
123
+
124
+ ```
125
+ $ source .toxbase/bin/activate
126
+ # the virtual environment is active
127
+ # if you see the environment name at the beginning of the line
128
+ (.toxbase) $ python -m pip install --upgrade pip
129
+ (.toxbase) $ pip install tox
130
+ (.toxbase) $ tox --version
131
+ ```
132
+ Create a new folder bin in the home directory and add a symbolic link inside
133
+ ```
134
+ cd
135
+ # create a `bin` directory
136
+ mkdir bin
137
+ # set link to ~/bin/tox
138
+ ln -s ~/.toxbase/bin/tox ~/bin/tox
139
+ ```
140
+ Set the PATH variable
141
+
142
+ ```
143
+ cd
144
+ # open the config file .bashrc
145
+ nano .bashrc
146
+ # Go to the bottom of the file and insert
147
+ # make tox accessible in each session from everywhere
148
+ PATH = "${HOME}/bin:${PATH}"
149
+ export PATH
150
+ # save and close the file with CTRL+O and CTRL+X
151
+ ```
152
+ #### fish
153
+ ```
154
+ cd
155
+ # open the config.fish file
156
+ nano ~/.config/fish/config.fish
157
+ # Go to the bottom of the file and insert
158
+ # make tox accessible in each session from everywhere
159
+ set PATH {$HOME}/bin $PATH
160
+ # save and close the file with CTRL+O and CTRL+X
161
+ ```
162
+ Check if everything works by opening a new terminal window and run
163
+ ```bash
164
+ tox --version
165
+ ```
166
+
167
+ </details>
168
+
169
+ ### Creating the project-specific dev environment.
170
+ If tox is set up, you're ready to start:
171
+ 1. clone the repository, you want to work in
172
+ 2. create the `dev` environment on your machine. To do this:
173
+ a) Open a Powershell
174
+ b) change directory to your repository
175
+ and finally type
176
+
177
+ ```bash
178
+ tox -e dev
179
+ ```
180
+
181
+ You have now created the development environment (dev environment). It is the environment which contains both the usual requirements as well as the testing and linting tools.
182
+
183
+ ### How to use with PyCharm
184
+
185
+ 1. You have cloned the repository, you want to work in, and have created the virtual environment, in which the repository should be executed (`your_repo/.tox/dev`). Now, to actually work inside the newly created environment, you need to tell PyCharm (your IDE) that it should use the virtual environment - to be more precise: the interpreter of this dev environment. How to do this:
186
+ a) navigate to: File ➡ Settings (Strg + Alt + S) ➡ Project: your_project ➡ Python Interpreter ➡ Add interpreter ➡ Existing
187
+ b) Choose as interpreter: `your_repo\.tox\dev\Scripts\python.exe` (under windows)
188
+ 2. Set the default test runner of your project to pytest. How to do it:
189
+ a) navigate to Files ➡ Settings ➡ Tools ➡ Python integrated tools ➡ Testing: Default test runner
190
+ b) Change to "pytest"
191
+ If this doesn't work anymore, see [the PyCharm docs](https://www.jetbrains.com/help/pycharm/choosing-your-testing-framework.html)
192
+ 3. Set the `src` directory as sources root. How to do this:
193
+ right click on 'src' ➡ "Mark directory asâ€Ļ" ➡ sources root
194
+ If this doesn't work anymore, see: [PyCharm docs](https://www.jetbrains.com/help/pycharm/content-root.html).
195
+ Setting the `src` directory right, allows PyCharm to effectively suggest import paths.
196
+ If you ever see something like `from src.mypackage.mymodule import ...`, then you probably forgot this step.
197
+ 5. Set the working directory of the unit tests to the project root (instead of the unittest directory). How to do this:
198
+ a) Open any test file whose name starts with `test_` in unit tests/tests
199
+ b) Right click inside the code ➡ More Run/Debug ➡ Modify Run Configuration ➡ expand Environment collapsible ➡ Working directory
200
+ c) Change to `your_repo` instead of `your_repo\unittests`
201
+ By doing so, the import and other file paths in the tests are relative to the repo root.
202
+ If this doesn't work anymore, see: [working directory of the unit tests](https://www.jetbrains.com/help/pycharm/creating-run-debug-configuration-for-tests.html)
203
+
204
+ ### How to use with VS Code
205
+ All paths mentioned in this section are relative to the repository root.
206
+
207
+ 1. Open the folder with VS Code.
208
+ 2. **Select the python interpreter** ([official docs](https://code.visualstudio.com/docs/python/environments#_manually-specify-an-interpreter)) which is created by tox. Open the command pallett with `CTRL + P` and type `Python: Select Interpreter`. Select the interpreter which is placed in `.tox/dev/Scripts/python.exe` under Windows or `.tox/dev/bin/python` under Linux and macOS.
209
+ 3. **Set up pytest and pylint**. Therefore we open the file `.vscode/settings.json` which should be automatically generated during the interpreter setup. If it doesn't exist, create it. Insert the following lines into the settings:
210
+
211
+ ```json
212
+ {
213
+ "python.testing.unittestEnabled": false,
214
+ "python.testing.nosetestsEnabled": false,
215
+ "python.testing.pytestEnabled": true,
216
+ "pythonTestExplorer.testFramework": "pytest",
217
+ "python.testing.pytestArgs": ["unittests"],
218
+ "python.linting.pylintEnabled": true
219
+ }
220
+ ```
221
+
222
+ 4. Create a `.env` file and insert the following line
223
+
224
+ For Windows:
225
+
226
+ ```
227
+ PYTHONPATH=src;${PYTHONPATH}
228
+ ```
229
+
230
+ For Linux and Mac:
231
+
232
+ ```
233
+ PYTHONPATH=src:${PYTHONPATH}
234
+ ```
235
+
236
+ This makes sure, that the imports are working for the unittests.
237
+ At the moment I am not totally sure that it is the best practise, but it's getting the job done.
238
+
239
+ 5. Enjoy 🤗
240
+
241
+ ## Publishing on PyPI
242
+
243
+ This repository contains all necessary CI steps to publish any project created from it on PyPI.
244
+ It uses the trusted publishers workflow as described in the [official Python documentation](https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/).
245
+ It just requires some manual adjustments/settings depending on your project:
246
+
247
+ 1. Fill out the metadata in the [`pyproject.toml`](pyproject.toml); Namely the package name and the dependencies which should be in sync with your `requirements.in`.
248
+ 2. Uncomment the lines in [`.github/workflows/python-publish.yml`](.github/workflows/python-publish.yml)
249
+ 3. Create a [new environment in your GitHub repository](https://github.com/Hochfrequenz/python_template_repository/settings/environments) and call it `release`.
250
+ 4. Set up a new trusted publisher [in your PYPI account](https://pypi.org/manage/account/publishing/).
251
+ 1. PyPI Project Name: The name which you defined in the `pyproject.toml` is the name of the project which you have to enter here.
252
+ 2. Owner: The GitHub organization name or GitHub username that owns the repository
253
+ 3. Repository name: The name of the GitHub repository that contains the publishing workflow
254
+ 4. Workflow name: The filename of the publishing workflow. This file should exist in the .github/workflows/ directory in the repository configured above. Here in our case: `python-publish.yml`
255
+ 5. Environment name: The name of the GitHub Actions environment that the above workflow uses for publishing. Here in our case: `release`
256
+ 5. Now create a release by clicking on "Create new release" in the right Github sidebar (or visit `github.com/your-username/your-reponame/releases/new`). This should trigger the workflow (see the "Actions" tab of your repo).
257
+ 6. Check if the action failed. If it succeeded your PyPI account should now show the new project. It might take some minutes until the package can be installed via `pip install packagename` because the index has to be updated.
258
+ 7. Now create another PyPI token with limited scope and update the Github repository secret accordingly.
259
+
260
+ ## Contribute
261
+
262
+ You are very welcome to contribute to this template repository by opening a pull request against the main branch.
263
+
264
+ ### GitHub Actions
265
+
266
+ - Dependabot auto-approve / -merge:
267
+ - If the actor is the Dependabot bot (i.e. on every commit by Dependabot)
268
+ the pull request is automatically approved and auto merge gets activated
269
+ (using squash merge).
270
+ Note that if you haven't enabled "auto merge" for your repository, the auto merge activation will fail.
271
+ If you want to use a merge type other than "squash merge" you have to edit the workflow.
@@ -0,0 +1 @@
1
+ # contains 1 lower case word per line which are ignored in the spell_check
@@ -0,0 +1,90 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.8.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "bss-mcp"
7
+ version = "0.1.0"
8
+ description = "MCP server for the Basic Supply Service (BSS) — read-only debug tools"
9
+ license = { text = "MIT" }
10
+ requires-python = ">=3.11"
11
+ authors = [{ name = "Hochfrequenz Unternehmensberatung GmbH", email = "info+pip@hochfrequenz.de" }]
12
+ keywords = ["bss", "basicsupply", "mcp"]
13
+ classifiers = [
14
+ "Development Status :: 4 - Beta",
15
+ "Environment :: Console",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ ]
26
+ dependencies = [
27
+ "bssclient>=0.1",
28
+ "fastmcp>=3.0",
29
+ "pydantic-settings>=2.7",
30
+ "httpx>=0.27",
31
+ "python-dotenv>=1.0",
32
+ ]
33
+
34
+ [project.optional-dependencies]
35
+ tests = [
36
+ "pytest>=9",
37
+ "pytest-asyncio>=0.24",
38
+ "pytest-mock>=3",
39
+ ]
40
+ linting = [
41
+ "pylint>=4",
42
+ ]
43
+ type_check = [
44
+ "mypy>=1.10",
45
+ ]
46
+ spell_check = [
47
+ "codespell>=2",
48
+ ]
49
+ coverage = [
50
+ "coverage>=7",
51
+ ]
52
+ formatting = [
53
+ "black>=25",
54
+ "isort>=5",
55
+ ]
56
+ packaging = [
57
+ "build>=1",
58
+ "twine>=6",
59
+ ]
60
+ dev = [
61
+ "pip-tools",
62
+ ]
63
+
64
+ [project.scripts]
65
+ bss-mcp = "bss_mcp.server:main"
66
+
67
+ [tool.hatch.build.targets.wheel]
68
+ only-include = ["src"]
69
+ sources = ["src"]
70
+
71
+ [tool.pytest.ini_options]
72
+ asyncio_mode = "auto"
73
+ testpaths = ["unittests"]
74
+
75
+ [tool.black]
76
+ line-length = 120
77
+ target_version = ["py311", "py312", "py313", "py314"]
78
+
79
+ [tool.isort]
80
+ line_length = 120
81
+ profile = "black"
82
+
83
+ [tool.pylint."MESSAGES CONTROL"]
84
+ max-line-length = 120
85
+
86
+ [mypy]
87
+ truethy-bool = true
88
+
89
+ [tool.mypy]
90
+ disable_error_code = []
@@ -0,0 +1,6 @@
1
+ #
2
+ # This file is autogenerated by pip-compile with Python 3.11
3
+ # by the following command:
4
+ #
5
+ # pip-compile pyproject.toml
6
+ #
File without changes
File without changes
bss_mcp-0.1.0/tox.ini ADDED
@@ -0,0 +1,93 @@
1
+ [tox]
2
+ envlist =
3
+ tests
4
+ linting
5
+ coverage
6
+ type_check
7
+ skip_missing_interpreters = True
8
+ skipsdist = True
9
+
10
+ [testenv]
11
+ commands = python -m pip install --upgrade pip
12
+
13
+ [testenv:tests]
14
+ # the tests environment is called by the Github action that runs the unit tests
15
+ deps =
16
+ -r requirements.txt
17
+ .[tests]
18
+ setenv = PYTHONPATH = {toxinidir}/src
19
+ commands = python -m pytest --basetemp={envtmpdir} {posargs}
20
+
21
+ [testenv:linting]
22
+ # the linting environment is called by the Github Action that runs the linter
23
+ deps =
24
+ {[testenv:tests]deps}
25
+ .[linting]
26
+ # add your fixtures like e.g. pytest_datafiles here
27
+ setenv = PYTHONPATH = {toxinidir}/src
28
+ commands =
29
+ pylint bss_mcp
30
+ pylint unittests --rcfile=unittests/.pylintrc
31
+ # add single files (ending with .py) or packages here
32
+
33
+ [testenv:type_check]
34
+ # the type_check environment checks the type hints using mypy
35
+ setenv = PYTHONPATH = {toxinidir}/src
36
+ deps =
37
+ {[testenv:tests]deps}
38
+ .[type_check]
39
+ commands =
40
+ mypy --show-error-codes src/bss_mcp --strict
41
+ mypy --show-error-codes unittests --strict
42
+ # add single files (ending with .py) or packages here
43
+
44
+ [testenv:spell_check]
45
+ # the spellcheck environment checks the code for typos
46
+ setenv = PYTHONPATH = {toxinidir}/src
47
+ deps =
48
+ -r requirements.txt
49
+ .[spell_check]
50
+ commands =
51
+ codespell --ignore-words=domain-specific-terms.txt src
52
+ codespell --ignore-words=domain-specific-terms.txt README.md
53
+ # add single files (ending with .py) or packages here
54
+
55
+ [testenv:coverage]
56
+ # the coverage environment is called by the Github Action that runs the coverage measurement
57
+ changedir = unittests
58
+ deps =
59
+ {[testenv:tests]deps}
60
+ .[coverage]
61
+ setenv = PYTHONPATH = {toxinidir}/src
62
+ commands =
63
+ coverage run -m pytest --basetemp={envtmpdir} {posargs}
64
+ coverage html --omit .tox/*,unittests/*
65
+ coverage report --fail-under 80 --omit .tox/*,unittests/*
66
+
67
+ [testenv:compile_requirements]
68
+ deps =
69
+ pip-compile-multi
70
+ commands =
71
+ pip-compile-multi -d dev_requirements --autoresolve
72
+
73
+ [testenv:dev]
74
+ # the dev environment contains everything you need to start developing on your local machine.
75
+ deps =
76
+ {[testenv:tests]deps}
77
+ {[testenv:linting]deps}
78
+ {[testenv:type_check]deps}
79
+ {[testenv:coverage]deps}
80
+ {[testenv:spell_check]deps}
81
+ .[formatting]
82
+ .[dev]
83
+ commands =
84
+ python -m pip install --upgrade pip
85
+ pip install -r requirements.txt
86
+
87
+ [testenv:test_packaging]
88
+ skip_install = true
89
+ deps =
90
+ .[packaging]
91
+ commands =
92
+ python -m build
93
+ twine check dist/*
@@ -0,0 +1,11 @@
1
+ [pylint]
2
+ # for the unittests disable some pylint warnings, e.g. we don't want to force devs to write docstrings for every test
3
+ disable =
4
+ C0114, # disable missing-module-docstring
5
+ C0115, # disable missing-class-docstring
6
+ C0116, # disable missing-function-docstring
7
+ R0903, # disable too-few-public-methods
8
+ W0621, # disable redefined-outer-name (this is for the use of pytest fixtures)
9
+ R0801, # disable duplicate-code (we prefer our test to be explicit rather than perfectly redundancy free)
10
+ [pylint."MESSAGES CONTROL"]
11
+ max-line-length = 120
@@ -0,0 +1,4 @@
1
+ """
2
+ This file is here, because this allows for best de-coupling of tests and application/library logic.
3
+ Further reading: https://docs.pytest.org/en/6.2.x/goodpractices.html#tests-outside-application-code
4
+ """
@@ -0,0 +1,5 @@
1
+ import bss_mcp
2
+
3
+
4
+ def test_bss_mcp_is_importable() -> None:
5
+ assert bss_mcp.__name__ == "bss_mcp"