From b9fb87466fe777889dd6e558bc90082b4db02a53 Mon Sep 17 00:00:00 2001 From: vitous Date: Wed, 15 Oct 2025 00:02:51 +0200 Subject: [PATCH 1/2] run on my branch fix? fix? fix? fix? ugly fix bump version of python required to at least 3.9 fix allow 3.9 switch to pyproject.toml tmp readd python3.8 --- .github/workflows/publish-pypi.yml | 22 +++++++++++----- .github/workflows/python-ci.yml | 41 +++++++++++++----------------- pyproject.toml | 34 +++++++++++++++++++++++++ setup.py | 21 --------------- 4 files changed, 66 insertions(+), 52 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index b487dd7..98c0996 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -7,20 +7,28 @@ on: jobs: deploy: runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.8' - - name: Install dependencies + python-version: '3.10' + + - name: Upgrade pip and install build tools run: | python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish + pip install build twine + + - name: Build package + run: | + python -m build # builds both sdist and wheel in dist/ + + - name: Publish to PyPI env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel - twine upload dist/* + python -m twine upload dist/* \ No newline at end of file diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 4f142c6..f2108a9 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,62 +1,55 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: CI on: push: - branches: [ master, dev ] + branches: [ master, dev, fix_tests_clean ] pull_request: branches: [ master ] jobs: build: - runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8] + python-version: ["3.8","3.9","3.10","3.11","3.12","3.13"] steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install pytest - pip install zenodo_get - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + - name: Upgrade pip and build tools + run: python -m pip install --upgrade pip setuptools wheel build - - name: Install brukerapi + - name: Install brukerapi with dev dependencies run: | git clone https://github.com/isi-nmr/brukerapi-python.git cd brukerapi-python - python setup.py build - python setup.py install + pip install pytest zenodo_get + pip install -e .[dev] --use-pep517 - name: Download test data from Zenodo - run: | - cd brukerapi-python/test - zenodo_get 10.5281/zenodo.4522220 + working-directory: brukerapi-python/test + run: python -m zenodo_get 10.5281/zenodo.4522220 - name: Test using the PV5.1 data set + working-directory: brukerapi-python/test run: | - cd brukerapi-python/test unzip 0.2H2.zip python -m pytest . --test_data "0.2H2" --test_suites="test_data" -v - name: Test using the PV6.0.1 data set + working-directory: brukerapi-python/test run: | - cd brukerapi-python/test unzip 20200612_094625_lego_phantom_3_1_2.zip - python -m pytest --test_data "20200612_094625_lego_phantom_3_1_2" --test_suites="test_data" -v + python -m pytest . --test_data "20200612_094625_lego_phantom_3_1_2" --test_suites="test_data" -v - name: Test using the PV7.0.0 data set + working-directory: brukerapi-python/test run: | - cd brukerapi-python/test unzip 20210128_122257_LEGO_PHANTOM_API_TEST_1_1.zip - python -m pytest --test_data "20210128_122257_LEGO_PHANTOM_API_TEST_1_1" --test_suites="test_data" -v \ No newline at end of file + python -m pytest . --test_data "20210128_122257_LEGO_PHANTOM_API_TEST_1_1" --test_suites="test_data" -v \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..783ebfe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,34 @@ +[build-system] +requires = ["setuptools>=64", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "brukerapi" +version = "0.1.9" +description = "Bruker API" +authors = [ + { name="Tomas Psorn", email="tomaspsorn@isibrno.cz" } +] +license = { text="MIT" } +readme = "README.rst" +requires-python = ">=3.8" +dependencies = [ + "numpy<2; python_version<'3.9'", + "numpy>=1.26.0; python_version>='3.9'", + "pyyaml" +] +urls = { "Homepage" = "https://github.com/isi-nmr/brukerapi-python","Download" = "https://github.com/isi-nmr/brukerapi-python/releases/latest"} + +[project.scripts] +bruker = "brukerapi.cli:main" + +[tool.setuptools] +packages = ["brukerapi", "brukerapi.config"] +include-package-data = true +zip-safe = false + +[project.optional-dependencies] +dev = [ + "pytest", + "zenodo_get" +] \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index b06571a..0000000 --- a/setup.py +++ /dev/null @@ -1,21 +0,0 @@ -from setuptools import setup - -setup(name='brukerapi', - version='0.1.9', - description='Bruker API', - author='Tomas Psorn', - author_email='tomaspsorn@isibrno.cz', - url='https://github.com/isi-nmr/brukerapi-python', - download_url='https://github.com/isi-nmr/brukerapi-python/releases/latest', - packages=['brukerapi', 'brukerapi.config'], - install_requires=['numpy','pyyaml'], - entry_points={ - "console_scripts": [ - "bruker=brukerapi.cli:main" - ], - }, - include_package_data=True, - license='MIT', - zip_safe=False - ) - From fe7d433c0df3981e26253858a4cf21ccef077656 Mon Sep 17 00:00:00 2001 From: vitous Date: Wed, 15 Oct 2025 01:10:41 +0200 Subject: [PATCH 2/2] remove test branch from CI --- .github/workflows/python-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index f2108a9..a221da5 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [ master, dev, fix_tests_clean ] + branches: [ master, dev ] pull_request: branches: [ master ]