From c5f395b8463e2ab5379bbff3add4ee19759a13a8 Mon Sep 17 00:00:00 2001 From: Jakob Lass Date: Fri, 11 Apr 2025 15:32:10 +0200 Subject: [PATCH] Update naming for package on PyPI Add workflow for publishing --- .gitea/workflows/publish.yaml | 64 +++++++++++++++++++++++++++++++++++ README.md | 8 +++++ pyproject.toml | 3 +- release_requirements.txt | 5 +++ source/index.rst | 2 +- 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 .gitea/workflows/publish.yaml create mode 100644 release_requirements.txt diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml new file mode 100644 index 0000000..5ab228e --- /dev/null +++ b/.gitea/workflows/publish.yaml @@ -0,0 +1,64 @@ +name: Release workflow +run-name: Build wheels an upload to PyPI +on: [push] +# release: +# types: [published] + + +jobs: + single_test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.13.3] + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install . + pip install flake8 pytest + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + python -m pytest -vv tests + + + build_wheel: + name: Build wheels for PyPI + needs: [single_test] + runs-on: ubuntu-latest + steps: + - name: Install dependencies + run: | + python -m pip install --upgrade pip + if [ -f release_requirements.txt ]; then pip install -r release_requirements.txt; fi + - name: Build Wheels + run: | + python -m build . + + pypi-publish: + name: Upload release to PyPI + needs: [build_wheel] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/AMBER_ds4ms + permissions: + id-token: ${{secrets.PYPI_TOKEN}} # IMPORTANT: this permission is mandatory for trusted publishing + steps: + # retrieve your distributions here + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + diff --git a/README.md b/README.md index 597dc54..2ea86a5 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,14 @@ AMBER ## Quick Installation +For the latest published version install through + +``` +python -m pip AMBER-ds4ms +``` + +For the latest nighly version + ``` python -m pip install git+https://gitea.psi.ch/lass_j/AMBER.git@main ``` diff --git a/pyproject.toml b/pyproject.toml index 85e10cb..db8c0bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ packages = ["AMBER"] package-dir = {"" = "src"} [project] -name = "AMBER" +name = "AMBER-ds4ms" version = "0.0.2" dependencies = [ "numpy>=2", @@ -43,7 +43,6 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Operating System :: OS Independent", - "" ] [project.urls] diff --git a/release_requirements.txt b/release_requirements.txt new file mode 100644 index 0000000..d8e4af7 --- /dev/null +++ b/release_requirements.txt @@ -0,0 +1,5 @@ +build +setuptools +setuptools_scm +wheel +twine \ No newline at end of file diff --git a/source/index.rst b/source/index.rst index 87b3c9c..97833c4 100644 --- a/source/index.rst +++ b/source/index.rst @@ -32,7 +32,7 @@ Installation can be done through PyPI using .. code-block:: - python -m pip install AMBER + python -m pip install AMBER-ds4ms Alternatively, the newest version can be installed directly from the source repository through