Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/ci-cd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on: [push, pull_request]
permissions:
contents: read



jobs:
test:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -35,3 +33,21 @@ jobs:
run: configlock init project_info.yaml
- name: check locked file
run: configlock lock project_info.yaml

- name: linting
run: uvx ruff check .
- name: formatting
run: uvx ruff format --check .
- name: type_consitency
run: uv run pyright .
- name: complexity check
run: uvx radon cc -s -a .
- name: tests
run: uv run pytest -v --durations=0 --cov --cov-report=xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}

- name: build
run: uv build
11 changes: 6 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@
</head>
<body>
<h2>ConfigLock Web Portal</h2>
<input type="text" id="user" placeholder="owner (e.g phalberg)">
<input type="text" id="repo" placeholder="repo">
<input type="text" id="branch" placeholder="branch (e.g main)">
<input type="text" id="path" placeholder="path/to/config.yaml">
<input type="text" id="userName" placeholder="owner (e.g phalberg)">
<input type="text" id="repoName" placeholder="repo">
<input type="text" id="branchName" placeholder="branch (e.g main)">
<input type="text" id="pathToFile" placeholder="path/to/config.yaml">
<button onclick="fetchFile()">Fetch Config</button>
<div id="url"></div>

<h3>Result:</h3>
<div id="output">No data yet...</div>

<!-- For webassembly -->
<script src="https://cdn.jsdelivr.net/pyodide/v0.26.1/full/pyodide.js"></script>

<script type="module" src="script.js"></script>
</body>
</html>
20 changes: 15 additions & 5 deletions docs/script.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import YAML from 'https://esm.sh/yaml';

function formInputs(){
const user = document.getElementById('userName').value;
const repo = document.getElementById('repoName').value;
const branch = document.getElementById('branchName').value;
const path = document.getElementById('pathToFile').value;

async function fetchFile() {
const user = document.getElementById('user').value;
const repo = document.getElementById('repo').value;
const branch = document.getElementById('branch').value;
const path = document.getElementById('path').value;
const output = document.getElementById('output');
const urlBox = document.getElementById('url');

return [user, repo, branch, path, output, urlBox];

}


async function fetchFile() {

const [user, repo, branch, path, output, urlBox] = formInputs()


output.innerText = 'Fetching...';
const lockFile = `https://raw.githubusercontent.com/${user}/${repo}/${branch}/${path}`;
const validatorFile = `https://raw.githubusercontent.com/${user}/${repo}/${branch}/src/configlock/validator.py`;
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ build-backend = "uv_build"

[dependency-groups]
dev = [
"pyright>=1.1.410",
"pytest>=9.0.3",
"radon>=6.0.1",
"reloadserver>=1.0.0",
"ruff>=0.15.15",
]

[tool.pytest.ini_options]
Expand Down
8 changes: 4 additions & 4 deletions src/configlock/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def check_file_identicality(file_path:str, config_file_path: str | None = CONFIG
filecmp.clear_cache()
res = filecmp.cmp(file_path, config_file_path, shallow=False)
return res
except Exception as exc:
except Exception:
filecmp.clear_cache()
res = filecmp.cmp(file_path, config_file_path, shallow=False)
return res
Expand All @@ -47,7 +47,7 @@ def read_yaml(file_path: str) -> dict:
except FileNotFoundError:
raise
else:
typer.echo(f"Sucessfully read file")
typer.echo("Sucessfully read file")
return data


Expand All @@ -58,7 +58,7 @@ def read_json(file_path: str) -> dict:
except FileNotFoundError:
raise
else:
typer.echo(f"Sucessfully read file")
typer.echo("Sucessfully read file")
return data

def write_json(data: dict, file_path: str | None = CONFIG_LOG_FILE_PATH) -> None:
Expand All @@ -71,7 +71,7 @@ def write_json(data: dict, file_path: str | None = CONFIG_LOG_FILE_PATH) -> None
except Exception:
raise
else:
typer.echo(f"Sucessfully wrote file")
typer.echo("Sucessfully wrote file")


def check_file_and_read_file(file_path: str) -> dict:
Expand Down
96 changes: 96 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading