Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP-518 Alignement using Hatch #3

Closed
wants to merge 11 commits into from
40 changes: 40 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Build and Test

on:
push:
branches: [ "ESAEOEPCA-184" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
- name: Install dependencies
run: |
# python -m pip install --upgrade pip
pip install hatch
- name: Cache Hatch
id: cache-hatch
uses: actions/cache@v3
with:
path: /home/runner/.local/share/hatch/env/virtual/
key: ${{ runner.os }}-hatch
- name: Build
run: hatch build
- name: Test
run: |
hatch -e test run nose2 --verbose
47 changes: 47 additions & 0 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish to Test PyPI

on:
push:
branches: [ "ESAEOEPCA-184" ]
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

environment: release
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
# python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
# - name: Test package
# run: hatch -e test run nose2 --verbose
- name: Publish package distributions to Test PyPI
if: github.ref != 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://test.pypi.org/legacy/
- name: Publish package distributions to PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
repository-url: https://upload.pypi.org/legacy/
125 changes: 125 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "zoo_calrissian_runner"
dynamic = ["version"]
description = 'Python library for bridging zoo execution context and calrissian'
readme = "README.md"
requires-python = ">=3.10"
license = {text = "Apache License (2.0)"}
keywords = []
authors = [
{ name = "Fabrice Brito", email = "fabrice.brito@terradue.com" }
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

dependencies = [
"pycalrissian",
"cwl-wrapper",
"cwl-utils",
"attrs",
"loguru",
"setuptools==70.0.0",
"kubernetes==28.1.0",
"cwltool==3.1.20240708091337",
"zoo-framework"
]

[project.urls]
Documentation = "https://github.com/EOEPCA/zoo-calrissian-runner#readme"
Issues = "https://github.com/EOEPCA/zoo-calrissian-runner/issues"
Source = "https://github.com/EOEPCA/zoo-calrissian-runner"

[tool.hatch.version]
path = "zoo_calrissian_runner/__about__.py"


[tool.coverage.run]
source_pkgs = ["zoo_calrissian_runner", "tests"]
branch = true
parallel = true
omit = [
"zoo_calrissian_runner/__about__.py",
]

[tool.coverage.paths]
zoo_calrissian_runner = ["zoo_calrissian_runner"]
tests = ["tests"]

[tool.coverage.report]
exclude_lines = [
"no cov",
"if __name__ == .__main__.:",
"if TYPE_CHECKING:",
]

[tool.hatch.envs.default.env-vars]
PIP_EXTRA_INDEX_URL = "https://test.pypi.org/simple/"

[tool.hatch.envs.default]
skip-install = false
dependencies = [
"pycalrissian",
"cwl-wrapper",
"cwl-utils",
"attrs",
"loguru",
"setuptools==70.0.0",
"kubernetes==28.1.0",
"cwltool==3.1.20240708091337",
"zoo-framework"
]


[tool.hatch.envs.test]
skip-install = false

dependencies = [
"nose2",
"coverage",
"pycalrissian",
"cwl-wrapper",
"cwl-utils",
"attrs",
"loguru",
"setuptools==70.0.0",
"kubernetes==28.1.0",
"cwltool==3.1.20240708091337",
"zoo-framework",
"python-dotenv"
]

[tool.hatch.envs.test.env-vars]
PIP_EXTRA_INDEX_URL = "https://test.pypi.org/simple/"
RETRY_ATTEMPTS="0"

[tool.hatch.envs.test.scripts]
test = "hatch run nose2"
testv = "hatch run nose2 --verbose"
cov = ["coverage run --source=zoo_calrissian_runner -m nose2", "coverage report"]

[[tool.hatch.envs.test.matrix]]
python = ["3.10", "3.11", "3.12"]

[tool.hatch.envs.docs]
skip-install = false

dependencies = [
"pdocs",
"mkdocs-material",
"mkdocs-jupyter"
]

[tool.hatch.envs.docs.scripts]
serve = "mkdocs serve"
deploy = "mkdocs gh-deploy --force"
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

14 changes: 0 additions & 14 deletions setup.py

This file was deleted.

1 change: 1 addition & 0 deletions zoo_calrissian_runner/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
version = "0.2.0"
Loading