From 22b27d71806ab0a700a108c04e52fb23146a2c0b Mon Sep 17 00:00:00 2001 From: pmembari Date: Tue, 3 Sep 2024 18:25:24 +0200 Subject: [PATCH] hatching --- .github/workflows/build.yaml | 40 +++++++++++++++++ .github/workflows/package.yml | 39 ++++++++++++++++ pycalrissian/__about__.py | 1 + pyproject.toml | 83 +++++++++++++++++++++++++++++++++++ 4 files changed, 163 insertions(+) create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/package.yml create mode 100644 pycalrissian/__about__.py create mode 100644 pyproject.toml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..03808b5 --- /dev/null +++ b/.github/workflows/build.yaml @@ -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-182" ] + 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 \ No newline at end of file diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..f24d64f --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,39 @@ +name: Publish to PyPI + +on: + push: + branches: [ "ESAEOEPCA-182" ] + 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 PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/pycalrissian/__about__.py b/pycalrissian/__about__.py new file mode 100644 index 0000000..41de39b --- /dev/null +++ b/pycalrissian/__about__.py @@ -0,0 +1 @@ +version = "0.7.1" \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c05884c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,83 @@ +[build-system] +requires = ["hatchling","setuptools", "wheel", "build"] +build-backend = "hatchling.build" + +[project] +name = "pycalrissian" +dynamic = ["version"] +description = "pycalrissian" +readme = "README.md" +requires-python = ">=3.8" +keywords = ["pycalrissian", "kubernetes"] +license = "EUPL-1.0" +authors = [ + { name = "Terradue", email = "fabrice.brito@terradue.com" }, +] + +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 = [] + +[project.urls] +Homepage = "https://github.com/Terradue/pycalrissian" + +[tool.hatch.version] +path = "pycalrissian/__about__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "pycalrissian/*", + "docs/*", + "test/*" +] + +[tool.hatch.envs.types] +extra-dependencies = [ + "loguru", + "typing", + "kubernetes==28.1.0", +] + + +[tool.coverage.run] +source_pkgs = ["pycalrissian", "tests"] +branch = true +parallel = true +omit = [ + "pycalrissian/__about__.py", +] + +[tool.coverage.paths] +pycalrissian = ["pycalrissian"] +tests = ["tests"] + +[tool.hatch.envs.default] +skip-install = false +dependencies = [ + "nose2", + "coverage", + "loguru", + "typing-extensions==4.8.0", + "kubernetes==28.1.0", + "cwltool==3.1.20240708091337", + "setuptools==70.0.0" +] + + +## [project.scripts] +## pycalrissian = "pycalrissian/__init__" + + +[tool.hatch.envs.test.scripts] +test = "hatch run nose2" +testv = "hatch run nose2 --verbose" +cov = ["coverage run --source=pycalrissian -m nose2", "coverage report"] \ No newline at end of file