Skip to content

Commit c0d6db4

Browse files
committed
Created initial structure of the parser example
1 parent 822f66b commit c0d6db4

11 files changed

Lines changed: 420 additions & 52 deletions

File tree

.github/workflows/actions.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Installing and Testing
2+
on: [push]
3+
4+
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
5+
# `contents` is for permission to the contents of the repository.
6+
# `pull-requests` is for permission to pull request
7+
permissions:
8+
contents: write
9+
checks: write
10+
pull-requests: write
11+
12+
env:
13+
UV_SYSTEM_PYTHON: true
14+
15+
jobs:
16+
install-and-test:
17+
runs-on: ubuntu-latest
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
python_version: ["3.10", "3.11", "3.12"]
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 uv
29+
run: |
30+
curl -LsSf https://astral.sh/uv/install.sh | sh
31+
- name: Install dependencies
32+
run: |
33+
pip install --upgrade pip
34+
uv pip install -e '.[dev]'
35+
- name: Test with pytest
36+
run: |
37+
python -m pytest -sv tests
38+
build-and-install:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Set up Python 3.12
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: 3.12
46+
- name: Install uv
47+
run: |
48+
curl -LsSf https://astral.sh/uv/install.sh | sh
49+
- name: Build the package
50+
run: |
51+
uv pip install build
52+
python -m build --sdist
53+
- name: Install the package
54+
run: |
55+
uv pip install dist/*.tar.gz
56+
ruff-linting:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
- uses: chartboost/ruff-action@v1
61+
with:
62+
args: "check ."
63+
ruff-formatting:
64+
runs-on: ubuntu-latest
65+
steps:
66+
- uses: actions/checkout@v4
67+
- uses: chartboost/ruff-action@v1
68+
with:
69+
args: "format . --check --verbose"

.github/workflows/coveralls.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Testing with coveralls Report
2+
on: [push]
3+
4+
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
5+
# `contents` is for permission to the contents of the repository.
6+
# `pull-requests` is for permission to pull request
7+
permissions:
8+
contents: write
9+
checks: write
10+
pull-requests: write
11+
12+
env:
13+
UV_SYSTEM_PYTHON: true
14+
15+
jobs:
16+
coveralls-test:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Set up Python 3.12
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: 3.12
24+
- name: Install uv
25+
run: |
26+
curl -LsSf https://astral.sh/uv/install.sh | sh
27+
- name: Install dependencies
28+
run: |
29+
uv pip install -e '.[dev]'
30+
uv pip install coveralls
31+
- name: Build coverage file
32+
run: |
33+
pytest --cov-config=.coveragerc --junitxml=pytest.xml --cov=src/masterdata_parser_example tests | tee pytest-coverage.txt
34+
- name: Pytest coverage comment
35+
uses: MishaKav/pytest-coverage-comment@main
36+
with:
37+
pytest-coverage-path: pytest-coverage.txt
38+
junitxml-path: pytest.xml
39+
- name: Submit to coveralls
40+
continue-on-error: true
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
coveralls --service=github

.github/workflows/publish.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Build and Publish Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
env:
19+
UV_SYSTEM_PYTHON: true
20+
21+
jobs:
22+
deploy:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
- name: Set up Python 3.12
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: 3.12
30+
- name: Install uv
31+
run: |
32+
curl -LsSf https://astral.sh/uv/install.sh | sh
33+
- name: Install dependencies
34+
run: |
35+
pip install --upgrade pip
36+
uv pip install build
37+
- name: Build package
38+
run: python -m build
39+
- name: Publish package to PyPI
40+
uses: pypa/gh-action-pypi-publish@release/v1
41+
with:
42+
user: __token__
43+
password: ${{ secrets.PYPI_API_TOKEN }}

.gitignore

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Byte-compiled / optimized / DLL files
22
__pycache__/
3-
*.py[codz]
3+
*.py[cod]
44
*$py.class
55

66
# C extensions
@@ -25,6 +25,7 @@ share/python-wheels/
2525
.installed.cfg
2626
*.egg
2727
MANIFEST
28+
_version.py
2829

2930
# PyInstaller
3031
# Usually these files are written by a python script from a template
@@ -45,8 +46,9 @@ htmlcov/
4546
.cache
4647
nosetests.xml
4748
coverage.xml
49+
coverage.txt
4850
*.cover
49-
*.py.cover
51+
*.py,cover
5052
.hypothesis/
5153
.pytest_cache/
5254
cover/
@@ -94,35 +96,20 @@ ipython_config.py
9496
# install all needed dependencies.
9597
#Pipfile.lock
9698

97-
# UV
98-
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99-
# This is especially recommended for binary packages to ensure reproducibility, and is more
100-
# commonly ignored for libraries.
101-
#uv.lock
102-
10399
# poetry
104100
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105101
# This is especially recommended for binary packages to ensure reproducibility, and is more
106102
# commonly ignored for libraries.
107103
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108104
#poetry.lock
109-
#poetry.toml
110105

111106
# pdm
112107
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113-
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114-
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115108
#pdm.lock
116-
#pdm.toml
117-
.pdm-python
118-
.pdm-build/
119-
120-
# pixi
121-
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122-
#pixi.lock
123-
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124-
# in the .venv directory. It is recommended not to include this directory in version control.
125-
.pixi
109+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
110+
# in version control.
111+
# https://pdm.fming.dev/#use-with-ide
112+
.pdm.toml
126113

127114
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128115
__pypackages__/
@@ -136,8 +123,9 @@ celerybeat.pid
136123

137124
# Environments
138125
.env
139-
.envrc
140126
.venv
127+
.pyenv
128+
.testenv
141129
env/
142130
venv/
143131
ENV/
@@ -175,33 +163,17 @@ cython_debug/
175163
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
176164
#.idea/
177165

178-
# Abstra
179-
# Abstra is an AI-powered process automation framework.
180-
# Ignore directories containing user credentials, local state, and settings.
181-
# Learn more at https://abstra.io/docs
182-
.abstra/
183-
184-
# Visual Studio Code
185-
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186-
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187-
# and can be added to the global gitignore or merged into this file. However, if you prefer,
188-
# you could uncomment the following to ignore the entire vscode folder
189-
# .vscode/
190-
191-
# Ruff stuff:
192-
.ruff_cache/
193-
194-
# PyPI configuration file
195-
.pypirc
196-
197-
# Cursor
198-
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199-
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200-
# refer to https://docs.cursor.com/context/ignore-files
201-
.cursorignore
202-
.cursorindexingignore
203-
204-
# Marimo
205-
marimo/_static/
206-
marimo/_lsp/
207-
__marimo__/
166+
# VSCode settings
167+
.vscode/launch.json
168+
169+
# Ruff
170+
.ruff_cache
171+
172+
# pytest coverage
173+
pytest.xml
174+
pytest-coverage.txt
175+
176+
# artifacts
177+
artifacts
178+
# and tmp files
179+
tmp/

.vscode/settings.json

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
3+
"python.terminal.activateEnvInCurrentTerminal": true,
4+
"editor.rulers": [90],
5+
"editor.renderWhitespace": "all",
6+
"editor.tabSize": 4,
7+
"[javascript]": {
8+
"editor.tabSize": 2
9+
},
10+
"files.trimTrailingWhitespace": true,
11+
"files.watcherExclude": {
12+
"${workspaceFolder}/.venv/**": true
13+
},
14+
"files.exclude": {
15+
"\"**/*.pyc\": {\"when\": \"$(basename).py\"}": true,
16+
"**/__pycache__": true,
17+
"**/node_modules": true
18+
},
19+
"python.testing.pytestPath": "pytest",
20+
"python.testing.pytestArgs": ["tests"],
21+
"python.testing.unittestEnabled": false,
22+
"editor.defaultFormatter": "charliermarsh.ruff",
23+
"editor.formatOnSave": true,
24+
"editor.codeActionsOnSave": {
25+
"source.organizeImports.ruff": "always",
26+
"source.fixAll.ruff": "always",
27+
},
28+
"launch": {
29+
"version": "0.2.0",
30+
"configurations": [
31+
{
32+
"name": "parser-example Python",
33+
"type": "debugpy",
34+
"request": "launch",
35+
"console": "integratedTerminal",
36+
"justMyCode": false,
37+
"program": "${workspaceFolder}/src/masterdata_parser_example/parser.py", // path to your entry point Python module
38+
},
39+
{
40+
"name": "parser-example tests",
41+
"type": "debugpy",
42+
"request": "launch",
43+
"console": "integratedTerminal",
44+
"program": "${workspaceFolder}/.venv/bin/pytest", // path to your virtual environment
45+
"justMyCode": false,
46+
"env": {
47+
"_PYTEST_RAISE": "1"
48+
},
49+
"args": [
50+
"-sv",
51+
"${workspaceFolder}/tests/test_parser.py" // path to your testing module
52+
]
53+
},
54+
]
55+
},
56+
}

0 commit comments

Comments
 (0)