Skip to content
Open
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
5 changes: 5 additions & 0 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
aarch
armv
bindgen
binstall
bkioshn
Expand Down Expand Up @@ -74,6 +75,7 @@ libsqlite
libxkbcommon
libxshmfence
lintfix
manylinux
markdownlint
mattn
mdlint
Expand All @@ -90,6 +92,7 @@ nilnil
nixos
nixpkgs
onsi
outputjson
penwidth
pkeyopt
pkgconf
Expand All @@ -99,6 +102,7 @@ pubout
pubspec
pymdownx
pypackages
pyrightconfig
PYTHONDONTWRITEBYTECODE
pytype
rankdir
Expand Down Expand Up @@ -135,6 +139,7 @@ voteplan
wasi
wasip
wasmtime
watchmedo
webkitallowfullscreen
WORKDIR
xerrors
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Cargo.lock

# Python junk
**/*.pyc
**/typings


### Linux ###
Expand Down
2 changes: 1 addition & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"ignorePaths": [
".config/dictionaries",
".github",
"earthly/docs/poetry.lock",
"earthly/docs/uv.lock",
"actions/*/dist",
"cli/go.sum",
"cli/go.mod",
Expand Down
2 changes: 1 addition & 1 deletion docs/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ src:
COPY --dir postgresql-ci+build/docs src/appendix/examples/built_docs/postgresql

# Build the docs here.
docs:
build-docs:
FROM +src

DO docs-ci+BUILD
Expand Down
16 changes: 8 additions & 8 deletions docs/src/guides/languages/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ builder:
```

The first target `builder` is responsible to prepare an already configured Python environment,
instal all needed tools and dependencies.
Every Python project must be a [poetry](https://python-poetry.org) based project,
so it is mandatory to have `pyproject.toml` and `poetry.lock` files in the root dir of the project.
install all needed tools and dependencies.
Every Python project must be a [uv](https://docs.astral.sh/uv/) based project,
so it is mandatory to have `pyproject.toml` and `uv.lock` files in the root dir of the project.

The fist step of the `builder` target is prepare a Python environment
with poetry via `+python-base` target.
The first step of the `builder` target is to prepare a Python environment
with `uv` via `+python-base` target.
Next step is to copy source code of the project and finally finalize the build
with some poetry project setup which is done with `+BUILDER` Function.
with some `uv` project setup which is done with `+BUILDER` Function.

### Running checks

Expand All @@ -74,12 +74,12 @@ with some poetry project setup which is done with `+BUILDER` Function.
test:
FROM +builder

RUN poetry run pytest
RUN uv run pytest
```

As the final step, after proper setup of the Python project we can run tests,
to do so
inherit from the already discussed `+builder` target and just run `poetry run pytest`
inherit from the already discussed `+builder` target and just run `uv run pytest`
or with any other way which are suitable for your project setup.
And that's it!

Expand Down
2 changes: 1 addition & 1 deletion earthly/cassandra/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ scylladb-base:
RUN apt-get update && apt-get install -y python3 pipx

RUN pipx ensurepath
RUN pipx install poetry
#RUN pipx install poetry

# cql-to-d2 - converts cql files into d2 diagram entity files
cql-to-d2:
Expand Down
4 changes: 2 additions & 2 deletions earthly/docs/Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ deps:
# Install D2
RUN curl -fsSL https://d2lang.com/install.sh | sh -s --

# Install poetry and our python dependencies.
DO python-ci+BUILDER --opts=--no-root
# Install uv and our python dependencies.
DO python-ci+BUILDER

# Copy our run scripts
COPY --dir scripts/* /scripts/
Expand Down
2 changes: 1 addition & 1 deletion earthly/docs/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ earthly -P +check
If a new dependency is added to `pyproject.toml` ensure to run:

```sh
poetry lock
uv lock
```

in the `earthly/docs` directory to update the locked dependencies.
8 changes: 4 additions & 4 deletions earthly/docs/common/macros/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""Doc Macros Init."""

from typing import Any
from mkdocs_macros.plugin import MacrosPlugin

from .include import inc_file


def define_env(env: Any) -> None: # noqa: ANN401
def define_env(env: MacrosPlugin) -> None:
"""Hooks for defining variables, macros and filters."""

@env.macro
def include_file(filename: str, *, start_line: int = 0, end_line: int | None = None, indent: int = 0) -> str:
@env.macro # pyright: ignore[reportUnknownMemberType]
def include_file(filename: str, *, start_line: int = 0, end_line: int | None = None, indent: int = 0) -> str: # pyright: ignore[reportUnusedFunction]
return inc_file(env, filename, start_line=start_line, end_line=end_line, indent=indent)
6 changes: 4 additions & 2 deletions earthly/docs/common/macros/include.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import re
from pathlib import Path

from mkdocs_macros.plugin import MacrosPlugin


def inc_file(
env: any,
env: MacrosPlugin,
filename: str,
*,
start_line: int = 0,
Expand All @@ -24,7 +26,7 @@ def inc_file(
indent = number of spaces to indent every line but the first.
"""
try:
if filename.startswith("."):
if filename.startswith(".") and env.page.file.src_dir is not None:
this_file = Path(env.page.file.src_dir) / env.page.file.src_uri
this_dir = this_file.parent
relative_filename = this_dir / filename
Expand Down
19 changes: 13 additions & 6 deletions earthly/docs/dev/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import subprocess
import sys
import time
import urllib.error
import urllib.request
import webbrowser
from dataclasses import dataclass, field
Expand All @@ -27,7 +28,7 @@ class ImageNotFound(Exception): # noqa: N818
"""Image Not Found."""


def run_command(command: str) -> None:
def run_command(command: str | list[str]) -> None:
"""Run a command and print its output.

Args:
Expand All @@ -48,10 +49,13 @@ def run_command(command: str) -> None:
universal_newlines=True,
)

for line in iter(process.stdout.readline, ""):
print(line, end="")
if process.stdout is not None:
for line in iter(process.stdout.readline, ""):
print(line, end="")

process.stdout.close()
process.stdout.close()
else:
print("stdout can not be read?")

rc = process.wait()

Expand Down Expand Up @@ -175,8 +179,11 @@ def print_logs(self) -> None:
"""Print Logs."""
cmd = f"docker logs --since {self.last_log_time} {self.container_id}"
output = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) # noqa: S602
for line in output.stdout:
print(line.decode().strip())
if output.stdout is not None:
for line in output.stdout:
print(line.decode().strip())
else:
print("stdout can not be read?")
self.last_log_time = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())


Expand Down
Loading
Loading