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
11 changes: 7 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
version: 2


updates:
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Tests


on:
push:
branches:
- main
pull_request:
branches:
- "*"


jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3

# Use GitHub's Docker registry to cache intermediate layers
- run: echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com
-u $GITHUB_ACTOR --password-stdin
- run: docker pull docker.pkg.github.com/$GITHUB_REPOSITORY/aleph-message-build-cache
|| true

- name: Build the Docker image
run: |
git fetch --tags
docker build . -t aleph-message:${GITHUB_REF##*/} -f Dockerfile --cache-from=docker.pkg.github.com/$GITHUB_REPOSITORY/aleph-message-build-cache

- name: Cache the image on GitHub's repository
run: docker tag aleph-message:${GITHUB_REF##*/} docker.pkg.github.com/$GITHUB_REPOSITORY/aleph-message-build-cache
&& docker push docker.pkg.github.com/$GITHUB_REPOSITORY/aleph-message-build-cache
|| true

- name: Test that aleph_message is correctly installed
run: |-
docker run aleph-message:${GITHUB_REF##*/} python -c "from aleph_message import parse_message"
35 changes: 35 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Tests


on:
push:
branches:
- main
pull_request:
branches:
- "*"


jobs:
code-quality:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.local/share/hatch/env/virtual/
key: ${GITHUB_JOB}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${GITHUB_JOB}

- run: |
python3 -m venv /tmp/venv
/tmp/venv/bin/python -m pip install --upgrade pip hatch coverage

- run: /tmp/venv/bin/hatch run linting:all
45 changes: 45 additions & 0 deletions .github/workflows/pytests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Tests


on:
push:
branches:
- main
pull_request:
branches:
- "*"


jobs:
tests:
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.local/share/hatch/env/virtual/
key: ${{ runner.os }}-${GITHUB_JOB}-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-${GITHUB_JOB}

- run: |
python3 -m venv /tmp/venv
/tmp/venv/bin/python -m pip install --upgrade pip hatch coverage

- run: /tmp/venv/bin/hatch run testing:cov

- uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: aleph-im/aleph-message
42 changes: 0 additions & 42 deletions .github/workflows/tests.yml

This file was deleted.

7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
FROM ubuntu:20.04
FROM python:3.12
RUN apt-get update && apt-get install -y python3-pip

RUN pip install pytest requests types-requests pytest-cov mypy twine typing-extensions
RUN pip install types-requests mypy twine typing-extensions hatch
COPY . /opt/aleph-message
WORKDIR /opt/aleph-message
RUN pip install -e .
RUN pip install mypy ruff black
RUN pip install .
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

164 changes: 164 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
[build-system]
build-backend = "hatchling.build"

requires = [ "hatch-vcs", "hatchling" ]

[project]
name = "aleph-message"
description = "Aleph.im message specification"
readme = "README.md"
license = { file = "LICENSE" }
authors = [
{ name = "Hugo Herter", email = "git@hugoherter.com" },
]
requires-python = ">=3"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: System :: Distributed Computing",
]
dynamic = [ "version" ]
dependencies = [
"pydantic>=1.10.5,<2",
"typing-extensions>=4.5",
]
urls.Documentation = "https://aleph.im/"
urls.Homepage = "https://github.com/aleph-im/aleph-message"

[tool.hatch.metadata]
allow-direct-references = true

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.targets.wheel]
packages = [
"Dockerfile",
"LICENSE",
"pyproject.toml",
"README.md",
"aleph_message",
]

[tool.hatch.build.targets.sdist]
include = [
"Dockerfile",
"LICENSE",
"pyproject.toml",
"README.md",
"aleph_message",
]

[tool.hatch.envs.testing]
dependencies = [
"requests",
"rich",
"pytest==8.0.1",
"pytest-cov==4.1.0",
]

# XXX see https://github.com/aleph-im/pyaleph/blob/main/.github/workflows/pyaleph-ci.yml
[tool.hatch.envs.testing.scripts]
test = "pytest -v {args:.}"
test-cov = "pytest -v --cov {args:.}"
cov-report = [
"- coverage combine",
"coverage report",
]
cov = [
"test-cov",
"cov-report",
]

[tool.hatch.envs.linting]
detached = true
dependencies = [
"black==24.2.0",
"mypy==1.2.0",
"mypy-extensions==1.0.0",
"ruff==0.4.8",
"isort==5.13.2",
"check-sdist==0.1.3",
"yamlfix==1.16.1",
"pyproject-fmt==2.2.1",
"types-requests",
"typing-extensions",
]

[tool.hatch.envs.linting.scripts]
typing = "mypy --config-file=pyproject.toml {args:} ./aleph_message/"
style = [
"ruff check {args:.}",
"black --check --diff {args:} ./aleph_message/",
"isort --check-only --profile black {args:} ./aleph_message/",
"yamlfix --check .",
"pyproject-fmt --check pyproject.toml",
]
sdist = "check-sdist --inject-junk"
fmt = [
"black {args:} ./aleph_message/",
"ruff check --fix {args:.} ./aleph_message/",
"isort --profile black {args:} ./aleph_message/",
"yamlfix .",
"pyproject-fmt pyproject.toml",
"style",
]
all = [
"style",
"typing",
"sdist",
]

[tool.isort]
profile = "black"

[tool.check-sdist]
git-only = [
"tests",
"docs",
"deployment",
".coveragerc",
".dockerignore",
"shell.nix",
]
default-ignore = true

[tool.pytest]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
]

[tool.coverage.run]
branch = true
parallel = true
source = [
"aleph_message/",
]
omit = [
"*/site-packages/*",
]

[tool.coverage.paths]
source = [
"aleph_message/",
]
omit = [
"*/site-packages/*",
]

[tool.mypy]
show_column_numbers = true
install_types = true
ignore_missing_imports = true

[tool.yamlfix]
sequence_style = "keep_style"
preserve_quotes = true
whitelines = 1
section_whitelines = 2
3 changes: 0 additions & 3 deletions pytest.ini

This file was deleted.

Loading
Loading