Skip to content

Commit

Permalink
change to uv
Browse files Browse the repository at this point in the history
  • Loading branch information
FloSch62 committed Jan 12, 2025
1 parent c331a9c commit c8ecd9b
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
venv/*
__pycache__
test/*
launch.json
launch.json

uv.lock
37 changes: 22 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Install build tools
RUN apt-get update && apt-get install -y build-essential python3-dev
# Install build tools and curl
RUN apt-get update && apt-get install -y build-essential python3-dev curl

# Copy the Python scripts and the entrypoint script into the container
COPY drawio2clab.py /app/
COPY clab2drawio.py /app/
COPY requirements.txt /app/
COPY entrypoint.sh /app/
COPY styles/ /app/styles/
COPY core/ /app/core/
COPY cli/ /app/cli/
# Install uv and make it available in PATH
RUN mkdir -p /root/.local/bin && \
curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}"

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# Set up working directory
WORKDIR /app

# Copy the Python scripts and the configuration files into the container
COPY pyproject.toml ./
COPY drawio2clab.py ./
COPY clab2drawio.py ./
COPY entrypoint.sh ./
COPY styles/ ./styles/
COPY core/ ./core/
COPY cli/ ./cli/

# Install dependencies using uv
RUN /root/.local/bin/uv pip sync --system pyproject.toml

# Make the entrypoint script executable
RUN chmod +x /app/entrypoint.sh

# Set the working directory in the container
# Set the working directory for running the application
WORKDIR /data
ENV APP_BASE_DIR=/app

# Use the entrypoint script to handle script execution
ENTRYPOINT ["/app/entrypoint.sh"]
# CMD can be used to specify default arguments or left as it is to pass commands through the docker run command
ENTRYPOINT ["/app/entrypoint.sh"]
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[project]
name = "clab-io-draw"
version = "0.4.0"
description = "Convert between draw.io and containerlab topology files"
requires-python = ">=3.11"
dependencies = [
"n2g==0.3.3",
"prompt-toolkit==3.0.43",
"PyYAML==6.0.1",
"six==1.16.0",
"wcwidth==0.2.13",
"ruamel-yaml==0.18.6",
"textual-dev==1.7.0",
"textual==1.0.0",
]
90 changes: 87 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,91 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml -o requirements.txt
aiohappyeyeballs==2.4.4
# via aiohttp
aiohttp==3.11.11
# via
# aiohttp-jinja2
# textual-dev
# textual-serve
aiohttp-jinja2==1.6
# via textual-serve
aiosignal==1.3.2
# via aiohttp
attrs==24.3.0
# via aiohttp
click==8.1.8
# via textual-dev
frozenlist==1.5.0
# via
# aiohttp
# aiosignal
idna==3.10
# via yarl
jinja2==3.1.5
# via
# aiohttp-jinja2
# textual-serve
linkify-it-py==2.0.3
# via markdown-it-py
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# rich
# textual
markupsafe==3.0.2
# via jinja2
mdit-py-plugins==0.4.2
# via markdown-it-py
mdurl==0.1.2
# via markdown-it-py
msgpack==1.1.0
# via textual-dev
multidict==6.1.0
# via
# aiohttp
# yarl
n2g==0.3.3
# via clab-io-draw (pyproject.toml)
platformdirs==4.3.6
# via textual
prompt-toolkit==3.0.43
PyYAML==6.0.1
# via clab-io-draw (pyproject.toml)
propcache==0.2.1
# via
# aiohttp
# yarl
pygments==2.19.1
# via rich
pyyaml==6.0.1
# via clab-io-draw (pyproject.toml)
rich==13.9.4
# via
# textual
# textual-serve
ruamel-yaml==0.18.6
# via clab-io-draw (pyproject.toml)
ruamel-yaml-clib==0.2.12
# via ruamel-yaml
six==1.16.0
# via clab-io-draw (pyproject.toml)
textual==1.0.0
# via
# clab-io-draw (pyproject.toml)
# textual-dev
# textual-serve
textual-dev==1.7.0
# via clab-io-draw (pyproject.toml)
textual-serve==1.1.1
# via textual-dev
typing-extensions==4.12.2
# via
# textual
# textual-dev
uc-micro-py==1.0.3
# via linkify-it-py
wcwidth==0.2.13
ruamel-yaml==0.18.6
textual-dev
# via
# clab-io-draw (pyproject.toml)
# prompt-toolkit
yarl==1.18.3
# via aiohttp

0 comments on commit c8ecd9b

Please sign in to comment.