Skip to content

Commit

Permalink
Migrate to Pyproject and hatch (#61)
Browse files Browse the repository at this point in the history
* add pyproject setup

* update actions

* fix whitespace

* update python version, install scripts

* add ray_sync script
  • Loading branch information
esseivaju authored Oct 4, 2024
1 parent 44bb4eb commit 0b55551
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 51 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@ on:
jobs:
tests:
name: tests
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup python version
uses: actions/setup-python@v4
with:
python-version: '3.11.3'
architecture: x64
- name: Restore cached deps
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Hatch
uses: pypa/hatch@a3c83ab3d481fbc2dc91dd0088628817488dd1d5
- name: Install application and deps
run: |
python -m pip install --upgrade pip
Expand All @@ -37,5 +39,4 @@ jobs:
flake8 .
- name: Run tests
run: |
pip install pytest requests six
pytest
hatch run test:pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ core
.vscode
.idea
build
dist
src/raythena/_version.py
66 changes: 66 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "raythena"
dynamic = ["version"]
readme = "README.md"
license = {file = "LICENSE"}
authors = [
{ name = "Julien Esseiva", email = "[email protected]" },
]
requires-python = ">=3.9"
dependencies = [
"aiohttp",
"click",
"protobuf",
"psutil",
"ray",
"setproctitle",
"uvloop",
]

[project.scripts]
raythena = "raythena.scripts.raythena:main"

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

[tool.hatch.build.hooks.vcs]
version-file = "src/raythena/_version.py"

[tool.hatch.envs.test]
dependencies = [
"pytest"
]

[tool.hatch.build.targets.wheel.shared-scripts]
"bin/ray_start_head" = "ray_start_head"
"bin/ray_start_worker" = "ray_start_worker"
"bin/ray_sync" = "ray_sync"

[tool.hatch.build.targets.wheel.shared-data]
"conf/cori.yaml" = "conf/cori.yaml"

[tool.ruff]

line-length = 80
indent-width = 4

[tool.ruff.lint]

select = [
# pycodestyle
"E",
# Pyflakes
"F",
# pyupgrade
"UP",
# flake8-bugbear
"B",
# flake8-simplify
"SIM",
# isort
"I"
]
44 changes: 0 additions & 44 deletions setup.py

This file was deleted.

6 changes: 5 additions & 1 deletion src/raythena/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
__version__ = "1.0.0"
try:
from . import _version
__version__ = _version.__version__
except: # noqa: E722
__version__ = "0.0.0"

0 comments on commit 0b55551

Please sign in to comment.