From 8dcae6d6afed6ab32ce4e5ad892687cec3925790 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Wed, 22 Nov 2023 09:40:34 +0200 Subject: [PATCH] Switch packaging to hatch (#37) --- .github/workflows/pytest.yml | 14 ++++++++- pyproject.toml | 55 ++++++++++++++++++++++++++++++++++++ setup.py | 50 -------------------------------- 3 files changed, 68 insertions(+), 51 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0e4343d..b7aa6ad 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -9,7 +9,7 @@ on: branches: [master] jobs: - build: + test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -34,3 +34,15 @@ jobs: pytest --cov=./ --cov-report=xml -n auto - name: Codecov uses: codecov/codecov-action@v3.1.0 + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: pip install build + - name: Build package + run: python -m build diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..14de95b --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,55 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "miditoolkit" +dynamic = ["version"] +description = "A python package for working with MIDI data files." +readme = "README.md" +license = "MIT" +requires-python = ">=3.7.0" +authors = [ + { name = "wayne391", email = "s101062219@gmail.com" }, +] +keywords = [ + "midi", + "mir", + "music", +] +classifiers = [ + "Intended Audience :: Developers", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Topic :: Multimedia :: Sound/Audio :: MIDI", +] +dependencies = [ + "matplotlib", + "mido >= 1.1.16", + "numpy >= 1.19", +] + +[project.optional-dependencies] +tests = [ + "pytest-cov", + "pytest-xdist[psutil]", + "setuptools", + "tqdm", +] + +[project.urls] +Homepage = "https://github.com/YatingMusic/miditoolkit" + +[tool.hatch.version] +path = "miditoolkit/__init__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/miditoolkit", +] diff --git a/setup.py b/setup.py deleted file mode 100644 index 37e55e1..0000000 --- a/setup.py +++ /dev/null @@ -1,50 +0,0 @@ -from setuptools import find_packages, setup - -extras = { - "tests": [ - "pytest-cov", - "pytest-xdist[psutil]", - "setuptools", - "tqdm", - ] -} - -setup( - name="miditoolkit", - version="1.0.0", - description="A python package for working with MIDI data files.", - author="wayne391", - author_email="s101062219@gmail.com", - url="https://github.com/YatingMusic/miditoolkit", - packages=find_packages(exclude=("tests",)), - package_data={"": ["examples_data/*"]}, - classifiers=[ - "Intended Audience :: Developers", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Operating System :: OS Independent", - "Topic :: Multimedia :: Sound/Audio :: MIDI", - ], - keywords="music midi mir", - long_description=open("README.md").read(), - long_description_content_type="text/markdown", - license="MIT", - extras_require=extras, - python_requires=">=3.7.0", - install_requires=[ - "numpy >= 1.19", - "mido >= 1.1.16", - "matplotlib", - ], -) - - -""" -python setup.py sdist -twine upload dist/* -"""