Migrate to pyproject.toml
This commit is contained in:
@@ -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:
|
package:
|
||||||
name: pyzebra
|
name: {{ pyproject['project']['name'] }}
|
||||||
version: {{ data['version'] }}
|
version: {{ version }}
|
||||||
|
|
||||||
source:
|
source:
|
||||||
path: ..
|
path: ..
|
||||||
@@ -10,26 +12,25 @@ source:
|
|||||||
build:
|
build:
|
||||||
script: python -m pip install .
|
script: python -m pip install .
|
||||||
noarch: python
|
noarch: python
|
||||||
number: 0
|
|
||||||
entry_points:
|
entry_points:
|
||||||
- pyzebra = pyzebra.app.cli:main
|
- pyzebra = pyzebra.app.cli:main
|
||||||
|
|
||||||
requirements:
|
requirements:
|
||||||
build:
|
host:
|
||||||
- python >=3.8
|
- python >=3.8
|
||||||
- setuptools
|
- hatchling
|
||||||
run:
|
run:
|
||||||
- python >=3.8
|
- python >=3.8
|
||||||
- numpy
|
{% for dep in pyproject['project']['dependencies'] %}
|
||||||
- scipy
|
- {{ dep }}
|
||||||
- h5py
|
{% endfor %}
|
||||||
- bokeh =2.4
|
|
||||||
- numba
|
|
||||||
- lmfit >=1.0.2
|
|
||||||
|
|
||||||
|
|
||||||
about:
|
about:
|
||||||
home: https://gitlab.psi.ch/zebra/pyzebra
|
home: {{ pyproject['project']['urls']['Homepage'] }}
|
||||||
summary: {{ data['description'] }}
|
summary: {{ pyproject['project']['description'] }}
|
||||||
license: GNU GPLv3
|
license: {{ pyproject['project']['license'] }}
|
||||||
license_file: LICENSE
|
license_file:
|
||||||
|
{% for lf in pyproject['project']['license-files'] %}
|
||||||
|
- {{ lf }}
|
||||||
|
{% endfor %}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def main():
|
|||||||
with open(version_filepath) as f:
|
with open(version_filepath) as f:
|
||||||
file_content = f.read()
|
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="."))
|
major, minor, patch = map(int, version.split(sep="."))
|
||||||
|
|
||||||
if args.level == "patch":
|
if args.level == "patch":
|
||||||
@@ -38,7 +38,7 @@ def main():
|
|||||||
new_version = f"{major}.{minor}.{patch}"
|
new_version = f"{major}.{minor}.{patch}"
|
||||||
|
|
||||||
with open(version_filepath, "w") as f:
|
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 commit {version_filepath} -m 'Updating for version {new_version}'")
|
||||||
os.system(f"git tag -a {new_version} -m 'Release {new_version}'")
|
os.system(f"git tag -a {new_version} -m 'Release {new_version}'")
|
||||||
|
|||||||
35
pyproject.toml
Normal file
35
pyproject.toml
Normal file
@@ -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"
|
||||||
14
setup.py
14
setup.py
@@ -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",
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user