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..a221da5 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -1,6 +1,3 @@ -# 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: @@ -11,52 +8,48 @@ on: 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 - ) -