diff --git a/conda-recipe/meta.yaml b/conda-recipe/meta.yaml index 1325568..76d7a5d 100644 --- a/conda-recipe/meta.yaml +++ b/conda-recipe/meta.yaml @@ -1,8 +1,10 @@ -{% set data = load_setup_py_data() %} +{% set version_match = load_file_regex(load_file="pyzebra/__init__.py", regex_pattern='__version__ = "(.+?)"') %} +{% set version = version_match[1] %} +{% set pyproject = load_file_data('pyproject.toml') %} package: - name: pyzebra - version: {{ data['version'] }} + name: {{ pyproject['project']['name'] }} + version: {{ version }} source: path: .. @@ -10,26 +12,25 @@ source: build: script: python -m pip install . noarch: python - number: 0 entry_points: - pyzebra = pyzebra.app.cli:main requirements: - build: + host: - python >=3.8 - - setuptools + - hatchling run: - python >=3.8 - - numpy - - scipy - - h5py - - bokeh =2.4 - - numba - - lmfit >=1.0.2 + {% for dep in pyproject['project']['dependencies'] %} + - {{ dep }} + {% endfor %} about: - home: https://gitlab.psi.ch/zebra/pyzebra - summary: {{ data['description'] }} - license: GNU GPLv3 - license_file: LICENSE + home: {{ pyproject['project']['urls']['Homepage'] }} + summary: {{ pyproject['project']['description'] }} + license: {{ pyproject['project']['license'] }} + license_file: + {% for lf in pyproject['project']['license-files'] %} + - {{ lf }} + {% endfor %} diff --git a/make_release.py b/make_release.py index c8ff0ba..a98aa88 100755 --- a/make_release.py +++ b/make_release.py @@ -22,7 +22,7 @@ def main(): with open(version_filepath) as f: file_content = f.read() - version = re.search(r'__version__ = "(.*?)"', file_content).group(1) + version = re.search(r'__version__ = "(.+?)"', file_content).group(1) major, minor, patch = map(int, version.split(sep=".")) if args.level == "patch": @@ -38,7 +38,7 @@ def main(): new_version = f"{major}.{minor}.{patch}" with open(version_filepath, "w") as f: - f.write(re.sub(r'__version__ = "(.*?)"', f'__version__ = "{new_version}"', file_content)) + f.write(re.sub(r'__version__ = "(.+?)"', f'__version__ = "{new_version}"', file_content)) os.system(f"git commit {version_filepath} -m 'Updating for version {new_version}'") os.system(f"git tag -a {new_version} -m 'Release {new_version}'") diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..c221ba0 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,35 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "pyzebra" +dynamic = ["version"] # version will be read from __init__.py +requires-python = ">=3.8" +dependencies = [ + "numpy", + "scipy", + "h5py", + "bokeh ~=2.4", + "numba", + "lmfit >=1.0.2", +] +authors = [ + {name = "Paul Scherrer Institute"} +] +maintainers = [ + {name = "Ivan Usov", email = "ivan.usov@psi.ch"} +] +description = "An experimental data analysis library for zebra instrument." +readme = "README.md" +license = "GPL-3.0-or-later" +license-files = ["LICENSE"] + +[project.urls] +Homepage = "https://gitea.psi.ch/zebra/pyzebra" + +[tool.hatch.build.targets.wheel] +include = ["pyzebra"] + +[tool.hatch.version] +path = "pyzebra/__init__.py" \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index 74a8451..0000000 --- a/setup.py +++ /dev/null @@ -1,14 +0,0 @@ -import re - -from setuptools import find_packages, setup - -with open("pyzebra/__init__.py") as f: - version = re.search(r'__version__ = "(.*?)"', f.read()).group(1) - -setup( - name="pyzebra", - version=version, - description="An experimental data analysis library for zebra instrument.", - packages=find_packages(), - license="GNU GPLv3", -)