-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added files * Added workflows * Added example test * Added janus_web init * Added .gitignore
- Loading branch information
1 parent
ca05625
commit 9002d24
Showing
6 changed files
with
241 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: ci | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
strategy: | ||
matrix: | ||
python-version: ['3.10','3.11','3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v4 | ||
with: | ||
version: "0.5.18" | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: uv sync | ||
|
||
- name: Run test suite | ||
env: | ||
# show timings of tests | ||
PYTEST_ADDOPTS: "--durations=0" | ||
run: uv run pytest --cov janus_web --cov-append . | ||
|
||
- name: Report coverage to Coveralls | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
parallel: true | ||
flag-name: run-${{ matrix.python-version }} | ||
file: coverage.xml | ||
base-path: api | ||
|
||
coverage: | ||
needs: tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Close parallel build | ||
uses: coverallsapp/github-action@v2 | ||
with: | ||
parallel-finished: true | ||
|
||
pre-commit: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install uv | ||
uses: astral-sh/setup-uv@v4 | ||
with: | ||
version: "0.5.18" | ||
python-version: "3.12" | ||
|
||
- name: Install dependencies | ||
run: uv sync | ||
|
||
- name: Run pre-commit | ||
run: | | ||
uv run pre-commit install | ||
uv run pre-commit run --all-files || ( git status --short ; git diff ; exit 1 ) |
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,3 @@ | ||
__pycache__/ | ||
data/* | ||
.venv |
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,21 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- id: check-json | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.7.4 | ||
hooks: | ||
- id: ruff | ||
args: [ --fix ] | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/numpy/numpydoc | ||
rev: v1.6.0 | ||
hooks: | ||
- id: numpydoc-validation | ||
files: ^api/ |
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,7 @@ | ||
"""API for janus-core.""" | ||
|
||
from __future__ import annotations | ||
|
||
from importlib.metadata import version | ||
|
||
__version__ = version("janus-web") |
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,132 @@ | ||
[project] | ||
name = "janus-web" | ||
version = "0.0.1" | ||
description = "API for janus-core" | ||
authors = [ | ||
{ name = "Cameron Ball" }, | ||
] | ||
requires-python = ">=3.10" | ||
classifiers = [ | ||
"Programming Language :: Python", | ||
"Intended Audience :: Science/Research", | ||
"License :: OSI Approved :: BSD License", | ||
"Natural Language :: English", | ||
"Development Status :: 3 - Alpha", | ||
] | ||
readme = "README.md" | ||
|
||
dependencies = [ | ||
"janus-core", | ||
"fastapi<1.0.0,>=0.95.0", | ||
"uvicorn<1.0.0,>=0.22.0", | ||
"python-multipart", | ||
"fastapi-cors" | ||
] | ||
|
||
[project.optional-dependencies] | ||
|
||
[project.scripts] | ||
|
||
[project.urls] | ||
repository = "https://github.com/stfc/janus-web/" | ||
documentation = "https://stfc.github.io/janus-web/" | ||
|
||
[dependency-groups] | ||
dev = [ | ||
"coverage[toml]<8.0.0,>=7.4.1", | ||
"pgtest<2.0.0,>=1.3.2", | ||
"pytest<9.0,>=8.0", | ||
"pytest-cov<5.0.0,>=4.1.0", | ||
"tox-uv<2.0,>=1.16.1", | ||
"wheel<1.0,>=0.42", | ||
] | ||
|
||
docs = [ | ||
"furo<2025.0.0,>=2024.1.29", | ||
"markupsafe<2.1", | ||
"numpydoc<2.0.0,>=1.6.0", | ||
"sphinx<8.0.0,>=7.2.6", | ||
"sphinxcontrib-contentui<1.0.0,>=0.2.5", | ||
"sphinxcontrib-details-directive<1.0,>=0.1", | ||
"sphinx-copybutton<1.0.0,>=0.5.2", | ||
] | ||
|
||
pre-commit = [ | ||
"pre-commit<4.0.0,>=3.6.0", | ||
"ruff<1.0.0,>=0.7.4", | ||
] | ||
|
||
[build-system] | ||
requires = ["pdm-backend"] | ||
build-backend = "pdm.backend" | ||
|
||
[tool.pytest.ini_options] | ||
# Configuration for pytest | ||
python_files = "test_*.py" | ||
addopts = '--cov-report xml' | ||
pythonpath = ["."] | ||
|
||
[tool.coverage.run] | ||
# Configuration of coverage.py | ||
# reporting which lines of your plugin are covered by tests | ||
source=["janus_web"] | ||
|
||
[tool.ruff] | ||
exclude = ["conf.py"] | ||
target-version = "py310" | ||
|
||
[tool.ruff.lint] | ||
# Ignore complexity | ||
ignore = ["C901"] | ||
select = [ | ||
# flake8-bugbear | ||
"B", | ||
# pylint | ||
"C", "R", | ||
# pydocstyle | ||
"D", | ||
# pycodestyle | ||
"E", "W", | ||
# Pyflakes | ||
"F", "FA", | ||
# pyupgrade | ||
"I", | ||
# pep8-naming | ||
"N", | ||
# isort | ||
"UP", | ||
] | ||
|
||
[tool.ruff.lint.isort] | ||
force-sort-within-sections = true | ||
required-imports = ["from __future__ import annotations"] | ||
|
||
[tool.ruff.lint.pydocstyle] | ||
convention = "numpy" | ||
|
||
[tool.ruff.lint.pylint] | ||
max-args = 10 | ||
|
||
[tool.ruff.lint.pyupgrade] | ||
keep-runtime-typing = false | ||
|
||
[tool.numpydoc_validation] | ||
# report on all checks, except the below | ||
checks = [ | ||
"all", | ||
"EX01", | ||
"SA01", | ||
"ES01", | ||
] | ||
# Don't report on objects that match any of these regex | ||
exclude = [ | ||
".__weakref__$", | ||
".__repr__$", | ||
] | ||
|
||
[tool.uv] | ||
default-groups = [ | ||
"dev", | ||
"docs", | ||
"pre-commit", | ||
] |
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,11 @@ | ||
"""Example test.""" | ||
|
||
from __future__ import annotations | ||
|
||
from janus_web import __version__ | ||
|
||
|
||
def test_example(): | ||
"""Example test.""" | ||
print(__version__) | ||
assert 1 == (2 / 2) |