Skip to content

Commit e1d8f42

Browse files
committed
scaffold the antares-python project with dev tools
1 parent 674dd61 commit e1d8f42

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+271
-2003
lines changed

.github/workflows/python-ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Antares Python CI
2+
3+
on:
4+
push:
5+
paths:
6+
- 'antares-python/**'
7+
pull_request:
8+
paths:
9+
- 'antares-python/**'
10+
11+
jobs:
12+
test:
13+
name: Run Tests, Lint, Type-check
14+
runs-on: ubuntu-latest
15+
16+
defaults:
17+
run:
18+
working-directory: antares-python
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: '3.13'
27+
28+
- name: Install uv
29+
run: |
30+
curl -Ls https://astral.sh/uv/install.sh | bash
31+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
32+
33+
- name: Create and activate venv
34+
run: |
35+
uv venv
36+
source .venv/bin/activate
37+
uv pip install -U uv
38+
39+
- name: Install dependencies
40+
run: |
41+
uv pip install -r requirements.txt || true
42+
uv pip install -e .
43+
uv pip install pytest mypy ruff
44+
45+
- name: Run linters
46+
run: ruff check .
47+
48+
- name: Run formatters
49+
run: ruff format --check .
50+
51+
- name: Run mypy
52+
run: mypy src/
53+
54+
- name: Run tests with coverage
55+
run: pytest --cov=src --cov-report=term-missing --cov-fail-under=80
56+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish antares-python to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
publish:
10+
name: Build and Publish
11+
runs-on: ubuntu-latest
12+
13+
defaults:
14+
run:
15+
working-directory: antares-python
16+
17+
steps:
18+
- name: Checkout repo
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: "3.13"
25+
26+
- name: Install uv
27+
run: |
28+
curl -Ls https://astral.sh/uv/install.sh | bash
29+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
30+
31+
- name: Build package
32+
run: |
33+
uv venv
34+
source .venv/bin/activate
35+
uv pip install -U build
36+
python -m build
37+
38+
- name: Publish to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1
40+
with:
41+
password: ${{ secrets.PYPI_API_TOKEN }}
42+
packages-dir: antares-python/dist/

antares-python/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
__pycache__/
2+
*.pyc
3+
.venv/
4+
dist/
5+
build/
6+
*.egg-info/
7+
.coverage
8+
.coverage.*
9+
htmlcov/
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.11.5
4+
hooks:
5+
- id: ruff-format
6+
- id: ruff
7+
- repo: https://github.com/pre-commit/mirrors-mypy
8+
rev: v1.15.0
9+
hooks:
10+
- id: mypy
11+
- repo: local
12+
hooks:
13+
- id: check-coverage
14+
name: Check minimum coverage
15+
entry: python antares-python/scripts/check_coverage.py
16+
language: system
17+
types: [python]
18+

antares-python/.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.13

antares-python/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 The Software Design Lab
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

antares-python/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# antares-python
2+
3+
[![CI](https://github.com/ANTARES/antares-python/actions/workflows/python-ci.yml/badge.svg)](https://github.com/ANTARES/antares-python/actions/workflows/python-ci.yml)
4+
[![codecov](https://img.shields.io/badge/coverage-80%25-brightgreen)](https://github.com/ANTARES/antares-python)
5+
[![PyPI version](https://img.shields.io/pypi/v/antares-python.svg)](https://pypi.org/project/antares-python/)
6+
[![Python version](https://img.shields.io/pypi/pyversions/antares-python)](https://pypi.org/project/antares-python/)
7+
[![License](https://img.shields.io/github/license/ANTARES/antares-python)](LICENSE)
8+
9+
> Python interface for the [Antares](https://github.com/ANTARES/antares) simulation software
10+
11+
`antares-python` is a facade library that allows Python developers to interact with the Antares simulation engine via HTTP. It provides a clean, user-friendly API for submitting simulations, retrieving results, and managing scenarios — similar to how `pyspark` interfaces with Apache Spark.
12+
13+
---
14+
15+
## 🚀 Features
16+
17+
- 🔁 Async + sync HTTP client
18+
- 🔒 Typed schema validation (coming soon)
19+
- 📦 Built-in support for data serialization
20+
- 🧪 Fully testable with mocks
21+
- 🛠️ First-class CLI support (planned)
22+
23+
---
24+
25+
## 📦 Installation
26+
27+
```bash
28+
pip install antares-python
29+
```
30+
31+
---
32+
33+
## ⚡ Quickstart
34+
35+
```python
36+
from antares import AntaresClient
37+
38+
client = AntaresClient(base_url="http://localhost:8000")
39+
40+
# Submit a simulation
41+
result = client.run_simulation(config={...})
42+
print(result.metrics)
43+
```
44+
45+
---
46+
47+
## 📚 Documentation
48+
49+
_Work in progress — full API docs coming soon._
50+
51+
---
52+
53+
## 🧪 Development
54+
55+
To set up a local development environment:
56+
57+
```bash
58+
uv venv
59+
source .venv/bin/activate
60+
uv pip install -e .[dev]
61+
task check
62+
```
63+
64+
---
65+
66+
## 🧾 License
67+
68+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

antares-python/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def main():
2+
print("Hello from antares-python!")
3+
4+
5+
if __name__ == "__main__":
6+
main()

antares-python/pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[project]
2+
name = "antares-python"
3+
version = "0.1.0"
4+
description = "Python interface for the Antares simulation software"
5+
authors = [{ name = "Juan Sebastian Urrea-Lopez", email = "[email protected]" }]
6+
readme = "README.md"
7+
requires-python = ">=3.13"
8+
dependencies = []
9+
10+
[build-system]
11+
requires = ["setuptools>=61.0", "wheel"]
12+
build-backend = "setuptools.build_meta"
13+
14+
[tool.ruff]
15+
line-length = 88
16+
lint.select = ["E", "F", "I", "UP", "B", "PL"]
17+
exclude = ["dist", "build"]
18+
19+
[tool.mypy]
20+
strict = true
21+
python_version = "3.13"
22+
files = ["src"]
23+
24+
[tool.pytest.ini_options]
25+
pythonpath = "src"
26+
addopts = "-ra -q -ra -q --cov=src --cov-report=term-missing"
27+
28+
[tool.setuptools.packages.find]
29+
where = ["src"]
30+
31+
[tool.taskipy.tasks]
32+
lint = "ruff check . --fix"
33+
format = "ruff format ."
34+
typecheck = "mypy src/"
35+
test = "pytest"
36+
coverage = "pytest --cov=src --cov-report=term-missing"
37+
build = "python -m build"
38+
publish = "twine upload dist/* --repository antares-python"
39+
check = "task lint && task typecheck && task test"
40+
release = "task check && task build && task publish"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .core import saludar
2+
3+
__all__ = ["saludar"]

0 commit comments

Comments
 (0)