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
Binary file modified .coverage
Binary file not shown.
30 changes: 7 additions & 23 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,19 @@ jobs:
tox:
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.11', '3.12', '3.13' ]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: Setup python
uses: actions/setup-python@v5
- name: Install uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64

- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.3
virtualenvs-create: true
virtualenvs-in-project: true

- name: Cache Poetry virtualenv
uses: actions/cache@v4
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}

- name: Install Dependencies
run: poetry install
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'

- name: Install the project
run: uv sync --locked --all-extras --dev

- name: Run tox
run: poetry run tox
run: uv run tox
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Poetry and Python stuff
# UV and Python stuff
**/*.egg-info/
**/*.pyc
**/*.pyo
**/*.log
**/__pycache__
.venv/
.*_cache/
dist/

# Tox
.tox/
Expand Down
27 changes: 13 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
# Will use this argument eventually to specify the python version so we can test against multiple versions
ARG PYTHON=3.13
FROM python:${PYTHON}-slim-bookworm
ARG PYTHON_VERSION=3.13
FROM python:${PYTHON_VERSION}-slim-bookworm

ENV PATH="/root/.local/bin:$PATH" \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

RUN apt-get update \
&& apt-get install -yq curl \
&& curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3 \
&& poetry config virtualenvs.create false
# Install curl
RUN apt-get update -y && apt-get install -y \
curl \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

COPY pyproject.toml .
COPY poetry.lock .
# Install UV
ARG UV_VERSION=0.7.19
RUN curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh

# Dependencies change more often, so we break this out so the prevous apt-get is cached
RUN poetry install --no-interaction

ARG NAME=jsnac
WORKDIR /${NAME}
WORKDIR /jsnac

# Copy relevant files only (using .dockerignore) then install our project as a package
COPY . .
RUN poetry install --no-interaction
RUN uv sync --locked

CMD ["/bin/bash"]
Binary file removed dist/jsnac-0.1.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/jsnac-0.1.0.tar.gz
Binary file not shown.
Binary file removed dist/jsnac-0.2.0-py3-none-any.whl
Binary file not shown.
Binary file removed dist/jsnac-0.2.0.tar.gz
Binary file not shown.
Binary file removed dist/jsnac-0.2.1-py3-none-any.whl
Binary file not shown.
Binary file removed dist/jsnac-0.2.1.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
project = "JSNAC"
copyright = "2024, Andrew Jones"
author = "Andrew Jones"
release = "0.2.1"
release = "0.3.0"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
4 changes: 2 additions & 2 deletions docs/source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
sphinx==8.1.3
sphinx-rtd-theme==3.0.1
sphinx==8.2.3
sphinx-rtd-theme==3.0.2
2 changes: 1 addition & 1 deletion jsnac/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .core.build import SchemaBuilder

__version__ = "0.2.1"
__version__ = "0.3.0"
__all__ = [
"SchemaBuilder",
]
27 changes: 27 additions & 0 deletions poetry-backup/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Will use this argument eventually to specify the python version so we can test against multiple versions
ARG PYTHON=3.13
FROM python:${PYTHON}-slim-bookworm

ENV PATH="/root/.local/bin:$PATH" \
PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1

RUN apt-get update \
&& apt-get install -yq curl \
&& curl -sSL https://install.python-poetry.org | python3 - --version 1.8.3 \
&& poetry config virtualenvs.create false

COPY pyproject.toml .
COPY poetry.lock .

# Dependencies change more often, so we break this out so the prevous apt-get is cached
RUN poetry install --no-interaction

ARG NAME=jsnac
WORKDIR /${NAME}

# Copy relevant files only (using .dockerignore) then install our project as a package
COPY . .
RUN poetry install --no-interaction

CMD ["/bin/bash"]
3 changes: 3 additions & 0 deletions poetry-backup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# poetry-backup

Just a backup location for my old poetry files while I figure out how to migrate to UV. Will delete eventually.
File renamed without changes.
99 changes: 99 additions & 0 deletions poetry-backup/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
[build-system]
requires = ["poetry-core==1.9.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "jsnac"
version = "0.2.1"
description = "JSON Schema (for) Network as Code: Build JSON schemas from YAML"
authors = ["Andrew Jones <jsnac@commitconfirmed.com>"]
license = "MIT"
readme = "README.md"
repository = "https://github.com/commitconfirmed/jsnac"
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[tool.poetry.dependencies]
python = ">=3.10,<4.0"
pyyaml = ">=6.0.2,<7.0.0"

[tool.poetry.scripts]
jsnac = "jsnac.utils.jsnac_cli:main"

[tool.poetry.group.dev.dependencies]
pytest = ">=8.3.0,<9.0.0"
pytest-cov = ">=5.0.0,<6.0.0"
jsonschema = ">=4.23.0,<5.0.0"
tox = ">=4.21.0,<5.0.0"
mypy = ">=1.12.1,<2.0.0"
types-PyYAML = ">=6.0.12,<7.0.0"
ruff = ">=0.7.0,<1.0.0"

[tool.poetry.group.docs.dependencies]
sphinx = ">=8.1.3,<9.0.0"
sphinx-rtd-theme = ">=3.0.1,<4.0.0"

# Basic mypy configuration until I learn more about it
[tool.mypy]
python_version = "3.10"
warn_return_any = true
warn_unused_configs = true
disallow_untyped_defs = true
exclude = [
"venv.*/",
"data/",
"tests/",
]

# Basic ruff configuration until I learn more about it
[tool.ruff]
line-length = 120
target-version = "py310"

[tool.ruff.lint]
preview = true
select = ["ALL"]
ignore = [
"COM812", # Recommended to be disabled
"CPY001", # Missing copyright notice at top of file
"D100", # Missing docstring in public module
"D205", # One blank line required between summary line and description
"D203", # One blank line before class
"D212", # Multi-line docstring summary should start at the first line
"D401", # First line of docstring should be in imperative mood
"D400", # First line should end with a period
"D415", # First line should end with a period, question mark, or exclamation point
"ISC001", # Recommended to be disabled
]

[tool.ruff.lint.per-file-ignores]
"tests/**" = [
"ANN001", # Type annotations
"CPY001", # Copyright
"S101", # Use of `assert` detected
"S104", # Valid tests against 0.0.0.0
"D100", # Missing docstring in public module
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
]
"**/__init__.py" = [
"D104", # Missing docstring in public package
"F401", # Imported but unused
"F403", # Wildcard imports
]
"docs/**" = [
"A001", # Variable `copyright` is shadowing a Python builtin
"D100", # Missing docstring in public module
"E402", # Module level import not at top of file
"INP001", # Requires __init__.py but docs folder is not a package.
]

[tool.ruff.format]
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
64 changes: 35 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
[build-system]
requires = ["poetry-core==1.9.0"]
build-backend = "poetry.core.masonry.api"
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.poetry]
[project]
name = "jsnac"
version = "0.2.1"
version = "0.3.0"
description = "JSON Schema (for) Network as Code: Build JSON schemas from YAML"
authors = ["Andrew Jones <jsnac@commitconfirmed.com>"]
license = "MIT"
authors = [{ name = "Andrew Jones", email = "jsnac@commitconfirmed.com" }]
requires-python = ">=3.11,<4.0"
readme = "README.md"
repository = "https://github.com/commitconfirmed/jsnac"
license = "MIT"
classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dependencies = ["pyyaml>=6.0.2,<7.0.0"]

[tool.poetry.dependencies]
python = ">=3.10,<4.0"
pyyaml = ">=6.0.2,<7.0.0"
[project.urls]
Repository = "https://github.com/commitconfirmed/jsnac"

[tool.poetry.scripts]
[project.scripts]
jsnac = "jsnac.utils.jsnac_cli:main"

[tool.poetry.group.dev.dependencies]
pytest = ">=8.3.0,<9.0.0"
pytest-cov = ">=5.0.0,<6.0.0"
jsonschema = ">=4.23.0,<5.0.0"
tox = ">=4.21.0,<5.0.0"
mypy = ">=1.12.1,<2.0.0"
types-PyYAML = ">=6.0.12,<7.0.0"
ruff = ">=0.7.0,<1.0.0"
[dependency-groups]
dev = [
"pytest>=8.4.1,<9.0.0",
"pytest-cov>=5.0.0,<6.0.0",
"jsonschema>=4.24.0,<5.0.0",
"tox>=4.27.0,<5.0.0",
"mypy>=1.16.1,<2.0.0",
"types-PyYAML>=6.0.12,<7.0.0",
"ruff>=0.12.0,<1.0.0",
]
docs = [
"sphinx>=8.2.3,<9.0.0",
"sphinx-rtd-theme>=3.0.2,<4.0.0",
]

[tool.poetry.group.docs.dependencies]
sphinx = ">=8.1.3,<9.0.0"
sphinx-rtd-theme = ">=3.0.1,<4.0.0"
[tool.uv]
default-groups = [
"dev",
"docs",
]

# Basic mypy configuration until I learn more about it
[tool.mypy]
python_version = "3.10"
warn_return_any = true
Expand All @@ -49,7 +56,6 @@ exclude = [
"tests/",
]

# Basic ruff configuration until I learn more about it
[tool.ruff]
line-length = 120
target-version = "py310"
Expand Down Expand Up @@ -96,4 +102,4 @@ ignore = [
quote-style = "double"
indent-style = "space"
skip-magic-trailing-comma = false
line-ending = "auto"
line-ending = "auto"
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py3{10,11,12,13}
envlist = py3{11,12,13}
isolated_build = True
skip_missing_interpreters = True

Expand Down
Loading