Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
joasode committed Oct 2, 2024
1 parent 9e66472 commit f755646
Show file tree
Hide file tree
Showing 8 changed files with 1,073 additions and 43 deletions.
46 changes: 46 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Stage 1: General ubuntu environment
# FROM ubuntu:latest AS linux-base
FROM ubuntu:latest AS linux-base

ENV LC_CTYPE=C.utf8
ENV UV_PYTHON_INSTALL_DIR="/python"
ENV UV_COMPILE_BYTECODE=1
ENV UV_PROJECT_ENVIRONMENT="/home/cotainr/venv"
ENV UV_PYTHON=python3.12
ENV PATH="$UV_PROJECT_ENVIRONMENT/bin:$PATH"

ENV PYTHONFAULTHANDLER=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONBREAKPOINT=ipdb.set_trace

# Update ubuntu
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install --no-install-recommends -y tzdata build-essential gettext
RUN apt-get install adduser
RUN passwd --delete root
RUN adduser cotainr --disabled-password --gecos "" # gecos ==> non-interactive

# Most Linux systems these days have a UID and GID of 1000 for the primary
# user, so it's usually fine to live with the defualt here, but if you've got a
# different value (run `id -u` and `id -g` in your shell respectively) you can
# set this value to make sure that the project will operate with the same UID,
# creating files in *your* name rather than root.
#ARG UID=1000
#ARG GID=1000
#RUN adduser --system --uid=${UID} --ingroup=cotainr --shell=/bin/bash --home=/home/cotainr cotainr

# Stage 2: Python environment
FROM linux-base AS python-base

COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
COPY pyproject.toml ./
COPY uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project

# Stage 3: Building environment
FROM python-base AS builder-base

WORKDIR /home/cotainr
COPY . /home/cotainr
USER cotainr
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
build:
docker build -t test .

build-nocache:
docker build --no-cache -t test .

shell:
docker run --name container-main -i -t test bash

tests:
docker run -t test python3 -m pytest cotainr/tests/cli
5 changes: 0 additions & 5 deletions docs-requirements.txt

This file was deleted.

137 changes: 137 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
[build-system]
requires = ["setuptools >= 61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "cotainr"
version = "2023.11.0"
dependencies = []
requires-python = ">=3.9"
authors = [
{name = "Christian Schou Oxvig"},
{name = "René Løwe Jacobsen"},
{name = "Eske Christiansen"},
]
maintainers = [
{name = "Christian Schou Oxvig", email = "[email protected]"},
{name = "Joachim Sødequist", email = "[email protected]"},
{name = "Tor Skovsgaard", email = "[email protected]"},
]
description = "A user space Apptainer/Singularity container builder"
readme = "README.md"
license = {file = "LICENSE"}
keywords = ["hpc", "container", "singularity", "apptainer"]
classifiers = [
"Development Status :: 5 - Stable",
"Intended Audience :: Users",
"Topic :: Software Development :: HPC Tools",
"License :: EUPL-1.2",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]

[project.optional-dependencies]
test = [
"pytest>=6.0",
"pytest-cov>=2.10",
]
docs = [
"numpydoc>=1.5.0",
"pydata-sphinx-theme>=0.13.3",
"sphinx>=7.2.5",
"sphinx-design>=0.5.0",
"myst-parser>=2.0.0",
]
dev-env = [
"uv",
"ruff~=0.6",
"coverage~=7.6",
]

[project.scripts]
cotainr = "cotainr.cli:main"

[project.urls]
Documentation = "https://cotainr.readthedocs.io/en/stable/"
Repository = "https://github.com/DeiC-HPC/cotainr.git"
"Bug Tracker" = "https://github.com/DeiC-HPC/cotainr/issues"
Changelog = "https://cotainr.readthedocs.io/en/stable/release_notes/index.html"

[tool.ruff]
cache-dir = ".cache/ruff"
line-length = 88
lint.extend-select = [
"B", # flake8-bugbear
"E", # pycodestyle errors
"F", # Pyflakes
"W", # pycodestyle warnings
]
lint.ignore = [
"E501", # Automatic conversion of .format() to f-strings
]
lint.exclude = [
"examples/**/*.ipynb"
]
preview = true

[tool.ruff.extend-per-file-ignores]
"cotainr/tests/**/test_*.py" = [
# The non-standard way to import py.test fixtures in
# tests means we will need to ignore "imported but not used"
# as well as argument shadowing tests in test modules.
"F401",
"F811",
]
"cotainr/tests/**.py" = [
"S101", # assertions are OK in tests
]

[tool.ruff.lint.pydocstyle]
convention = "numpy"

[tool.ruff.format]
exclude = [
"examples/**/*.ipynb",
]

[tool.ruff.lint.isort]
case-sensitive = true
lines-after-imports = 2
lines-between-types = 1
combine-as-imports = true
split-on-trailing-comma = true

# Not following pep8
[tool.ruff.lint.pycodestyle]
max-line-length = 88
max-doc-length = 88


[tool.coverage.run]
branch = true
data_file = "/home/usr/.cache/coverage/data"

[tool.coverage.report]
ignore_errors = true
fail_under = 100
show_missing = true
skip_covered = true
omit = [
"*/tests/*",
"demo/settings.py",
"manage.py",
".venv/*"
]
exclude_lines = [
"pragma: no cover",
"raise NotImplementedError"
]


# Coverage reports get written to `.cache`, which is ignored by git thanks to
# .gitignore
[tool.coverage.html]
directory = "/home/usr/.cache/coverage/report"
104 changes: 104 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml --all-extras -o requirements-dev.txt
accessible-pygments==0.0.5
# via pydata-sphinx-theme
alabaster==1.0.0
# via sphinx
babel==2.16.0
# via
# pydata-sphinx-theme
# sphinx
beautifulsoup4==4.12.3
# via pydata-sphinx-theme
certifi==2024.8.30
# via requests
charset-normalizer==3.3.2
# via requests
coverage==7.6.1
# via pytest-cov
docutils==0.21.2
# via
# myst-parser
# pydata-sphinx-theme
# sphinx
idna==3.10
# via requests
imagesize==1.4.1
# via sphinx
iniconfig==2.0.0
# via pytest
jinja2==3.1.4
# via
# myst-parser
# sphinx
markdown-it-py==3.0.0
# via
# mdit-py-plugins
# myst-parser
markupsafe==2.1.5
# via jinja2
mdit-py-plugins==0.4.2
# via myst-parser
mdurl==0.1.2
# via markdown-it-py
myst-parser==4.0.0
# via cotainr (pyproject.toml)
numpydoc==1.8.0
# via cotainr (pyproject.toml)
packaging==24.1
# via
# pydata-sphinx-theme
# pytest
# sphinx
pluggy==1.5.0
# via pytest
pydata-sphinx-theme==0.15.4
# via cotainr (pyproject.toml)
pygments==2.18.0
# via
# accessible-pygments
# pydata-sphinx-theme
# sphinx
pytest==8.3.3
# via
# cotainr (pyproject.toml)
# pytest-cov
pytest-cov==5.0.0
# via cotainr (pyproject.toml)
pyyaml==6.0.2
# via myst-parser
requests==2.32.3
# via sphinx
snowballstemmer==2.2.0
# via sphinx
soupsieve==2.6
# via beautifulsoup4
sphinx==8.0.2
# via
# cotainr (pyproject.toml)
# myst-parser
# numpydoc
# pydata-sphinx-theme
# sphinx-design
sphinx-design==0.6.1
# via cotainr (pyproject.toml)
sphinxcontrib-applehelp==2.0.0
# via sphinx
sphinxcontrib-devhelp==2.0.0
# via sphinx
sphinxcontrib-htmlhelp==2.1.0
# via sphinx
sphinxcontrib-jsmath==1.0.1
# via sphinx
sphinxcontrib-qthelp==2.0.0
# via sphinx
sphinxcontrib-serializinghtml==2.0.0
# via sphinx
tabulate==0.9.0
# via numpydoc
typing-extensions==4.12.2
# via pydata-sphinx-theme
urllib3==2.2.3
# via requests
uv==0.4.17
# via cotainr (pyproject.toml)
36 changes: 0 additions & 36 deletions ruff.toml

This file was deleted.

2 changes: 0 additions & 2 deletions test-requirements.txt

This file was deleted.

Loading

0 comments on commit f755646

Please sign in to comment.