Skip to content
Merged
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
1 change: 1 addition & 0 deletions kernel/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.14
7 changes: 7 additions & 0 deletions kernel/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
task1:
uv run python src/task1.py

task2:
uv run python src/task2.py
main:
uv run python main.py
27 changes: 27 additions & 0 deletions kernel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Kernel

The purpose of `kernel` directory is that this accumulates frequently used libraries list and also few gists, as written below. It helps me to just install dependencies in single directory and when working with notebook files, I just select the *this directories virtual environment so its single yet powerful directory that fuel my development process and helps me to avoid installation for each directory separately.

Think like its a backbone of repo or a centralized directory dedicated for working with notebook files and conduct any tests.


# Gists

### Run files using poethepoet

> First you need to install the poethepoet dependency using `uv add --dev poethepoet` to make the following commands to work properly.

```bash
uv run poe task1
uv run poe task2
```

### Run files using Justfile

> Note: You need to install the just first. On Linux/Ubuntu run `sudo apt update && sudo apt install just` to install the just.

Make a [Justfile](./Justfile) and run these commands

```bash
just task1
```
49 changes: 49 additions & 0 deletions kernel/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import tomllib
from pathlib import Path

curr_file_path = Path(__file__).resolve()
pyproject_file_path = (curr_file_path.parent / "pyproject.toml").resolve()


# read dependencies
def get_dependencies():
if not pyproject_file_path.exists():
raise FileNotFoundError("Unable to find pyproject.toml file")

# read file
with open(pyproject_file_path, "rb") as file:
config = tomllib.load(file)

project_table = config.get("project", {})
deps = project_table.get("dependencies", [])
dep_groups = config.get("dependency-groups", {})

return {"dependencies": deps, "dependency-groups": dep_groups}


def main():
try:
print("--- kernel ---")
print("A centralized directory to manage dependencies for everyday workflow.")

# current dependencies
all_deps = get_dependencies()

# core dependencies
print("--- Core Dependencies ---")
for dep in all_deps["dependencies"]:
print(f"- {dep}")

# dev dependencies
print("--- Dev Dependencies ---")
for group_name, group_deps in all_deps["dependency-groups"].items():
print(f"[{group_name}]")
for dep in group_deps:
print(f" - {dep}")

except FileNotFoundError as e:
print(e)


if __name__ == "__main__":
main()
23 changes: 23 additions & 0 deletions kernel/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[project]
name = "kernel"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
{ name = "Saqib Bedar", email = "124094939+saqibbedar@users.noreply.github.com" }
]
requires-python = ">=3.14"
dependencies = [
"numpy>=2.5.3",
"pandas>=3.0.6",
]

[dependency-groups]
dev = [
"poethepoet",
]

[tool.poe.tasks]
main = "python main.py"
task1 = "python src/task1.py"
task2 = "python src/task2.py"
1 change: 1 addition & 0 deletions kernel/src/task1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("--- task1 ---")
1 change: 1 addition & 0 deletions kernel/src/task2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("--- task2 ---")
205 changes: 205 additions & 0 deletions kernel/uv.lock

Large diffs are not rendered by default.

Loading