Skip to content

Commit

Permalink
feat: setup monorepo tools
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Jan 14, 2025
1 parent 79e803f commit c630087
Show file tree
Hide file tree
Showing 14 changed files with 916 additions and 1,260 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

[*.{py,ini}]
indent_style = space
indent_size = 4

[*.{yaml,yml,tf}]
indent_style = space
indent_size = 2
27 changes: 19 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
venv/
build/
venv
build
*.charm
.tox/
.tox
.coverage
__pycache__/
*.py[cod]
.idea
.vscode/
requirements.txt
.vscode
version
cover

# Managed by repository.py
.charmhub.secret
_build
external

# Ignore libs except the filesystem_client
# Managed by Charmcraft
**/lib/charms/*

lib/charms/*
!lib/charms/filesystem_client/
# Managed by uv
.venv
.ruff_cache
.pytest_cache
requirements.txt
dev-requirements.txt
1 change: 0 additions & 1 deletion .jujuignore

This file was deleted.

File renamed without changes.
75 changes: 0 additions & 75 deletions charmcraft.yaml

This file was deleted.

63 changes: 5 additions & 58 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,74 +1,21 @@
uv := `which uv`
charmcraft := `which charmcraft`

project_dir := justfile_directory()

src := project_dir / "src"
tests := project_dir / "tests"
lib := project_dir / "lib/charms/filesystem_client"
all := src + " " + tests + " " + lib

export PYTHONPATH := project_dir + ":" + project_dir / "lib" + ":" + src
export PY_COLORS := "1"
export PYTHONBREAKPOINT := "pdb.set_trace"

uv_run := "uv run --frozen --extra dev"

# Regenerate uv.lock.
lock:
uv lock --no-cache

# Fetch the required charm libraries.
fetch-libs:
charmcraft fetch-libs
uv lock

# Create a development environment.
env: lock fetch-libs
env: lock
uv sync --extra dev

# Upgrade uv.lock with the latest deps
upgrade:
uv lock --upgrade --no-cache

# Generate requirements.txt from pyproject.toml
requirements: lock
uv export --frozen --no-hashes --format=requirements-txt -o requirements.txt

# Apply coding style standards to code
fmt: lock
{{uv_run}} ruff format {{all}}
{{uv_run}} ruff check --fix {{all}}

# Check code against coding style standards
lint: lock fetch-libs
{{uv_run}} codespell {{lib}}
{{uv_run}} codespell {{project_dir}}
{{uv_run}} ruff check {{all}}
{{uv_run}} ruff format --check --diff {{all}}

# Run static type checks
typecheck *args: lock fetch-libs
{{uv_run}} pyright {{args}}

# Run unit tests
unit *args: lock fetch-libs
{{uv_run}} coverage run \
--source={{src}} \
--source={{lib}} \
-m pytest \
--tb native \
-v \
-s \
{{args}} \
{{tests}}/unit
{{uv_run}} coverage report
uv lock --upgrade

# Run integration tests
integration *args: lock fetch-libs
{{uv_run}} pytest \
-v \
-s \
--tb native \
--log-cli-level=INFO \
{{args}} \
{{tests}}/integration
repository *args: lock
{{uv_run}} repository.py {{args}}
Loading

0 comments on commit c630087

Please sign in to comment.