-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e1e2f92
commit 473bd8a
Showing
7 changed files
with
241 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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/[email protected] | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: aleph-im/aleph-message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 hatch build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
[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 = "[email protected]" }, | ||
] | ||
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.yamlfix] | ||
sequence_style = "keep_style" | ||
preserve_quotes = true | ||
whitelines = 1 | ||
section_whitelines = 2 |
This file was deleted.
Oops, something went wrong.