Skip to content

Commit

Permalink
Merge pull request #5 from lmizzoni/ESAEOEPCA-184
Browse files Browse the repository at this point in the history
PEP-518 - Hatching
  • Loading branch information
fabricebrito authored Oct 15, 2024
2 parents 11d2784 + 4c37a3d commit f81423d
Show file tree
Hide file tree
Showing 6 changed files with 215 additions and 17 deletions.
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/
127 changes: 127 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
[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.8"
license = {text = "Apache License (2.0)"}
keywords = []
authors = [
{ name = "Fabrice Brito", email = "[email protected]" }
]
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"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",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]

dependencies = [
"pycalrissian",
"cwl-wrapper",
"cwl-utils==0.14",
"attrs",
"loguru",
"setuptools",
"kubernetes",
"cwltool",
"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==0.14",
"attrs",
"loguru",
"setuptools",
"kubernetes",
"cwltool",
"zoo-framework"
]


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

dependencies = [
"nose2",
"coverage",
"pycalrissian",
"cwl-wrapper",
"cwl-utils==0.14",
"attrs",
"loguru",
"setuptools",
"kubernetes",
"cwltool",
"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.8", "3.9", "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.1"

0 comments on commit f81423d

Please sign in to comment.