Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from setup.py/setup.cfg to pyproject.toml and drop Python 3.7 support #112

Merged
merged 10 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
python -m pip install sphinx sphinx-intl sphinx_rtd_theme
python setup.py sdist --formats=zip
python -m pip install build sphinx sphinx-intl sphinx_rtd_theme
python -m build --sdist
python -m pip install dist/*

- name: Build documentation
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,10 @@ jobs:
with:
python-version: '3.x'

- name: Install dependencies
- name: Build
run: |
python -m pip install setuptools wheel

- name: Build and publish
run: |
python setup.py sdist bdist_wheel
python -m install build
python -m build
ls -lh dist/

- name: Publish to PyPI
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
max-parallel: 1 # Hinet doesn't allow parallel data request
fail-fast: false
matrix:
python-version: ["3.7", "3.12"]
python-version: ["3.8", "3.12"]
os: [macos-latest, ubuntu-latest]

steps:
Expand All @@ -43,8 +43,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
python -m pip install pytest>=6.0 pytest-cov coverage[toml] codecov setuptools
python setup.py sdist --formats=zip
python -m pip install build pytest>=6.0 pytest-cov coverage[toml] codecov
python -m build --sdist
python -m pip install dist/*

- name: Install win32tools
Expand Down
4 changes: 2 additions & 2 deletions HinetPy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

# pylint: disable=invalid-name

from pkg_resources import get_distribution
from importlib.metadata import version

from .client import Client
from .header import NETWORK

__all__ = ["Client", "NETWORK", "win32"]
# Get semantic version through setuptools-scm
__version__ = f'v{get_distribution("HinetPy").version}' # e.g. v0.1.2.dev3+g0ab3cd78
__version__ = f'v{version("HinetPy")}' # e.g. v0.1.2.dev3+g0ab3cd78
8 changes: 4 additions & 4 deletions HinetPy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import math
import shutil
from datetime import date, datetime
from distutils.version import LooseVersion
from packaging.version import Version

import requests
from pkg_resources import get_distribution
from importlib.metadata import version


def split_integer(number, maxn):
Expand Down Expand Up @@ -253,8 +253,8 @@ def check_package_release():
raise requests.HTTPError("Error in connecting to PyPI.")
latest_release = res.json()["info"]["version"]

current_version = f'{get_distribution("HinetPy").version}'
if LooseVersion(latest_release) > LooseVersion(current_version):
current_version = f'v{version("HinetPy")}'
if Version(latest_release) > Version(current_version):
print(
f"HinetPy v{latest_release} is released. "
+ "See https://pypi.org/project/HinetPy/ for details."
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Changelog

0.7.2 (XXXX-XX-XX)
- Remove the hacking solution for SSL connection issue so it works well with urllib3 v2.x
- Drop support for Python 3.7.

0.7.1 (2022-07-08):
- Fix bugs in `get_event_waveform`
Expand Down
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Prerequisites

To use HinetPy, you need:

- Python >= 3.7
- Python >= 3.8
- win32tools provided by NIED Hi-net (see below for install instructions)
- a Hi-net account (register on Hi-net website to get your user name and password)

Expand All @@ -21,7 +21,7 @@ Or install the **developing/unstable** version::

git clone https://github.com/seisman/HinetPy
cd HinetPy
python setup.py install
python -m pip install .

If you want to uninstall HinetPy, just run::

Expand Down
2 changes: 1 addition & 1 deletion docs/locale/zh_CN/LC_MESSAGES/installation.po
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ msgid "To use HinetPy, you need:"
msgstr "为了使用 HinetPy,你需要:"

#: ../../installation.rst:9
msgid "Python >= 3.7"
msgid "Python >= 3.8"
msgstr ""

#: ../../installation.rst:10
Expand Down
47 changes: 47 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
[build-system]
requires = ["setuptools>=64", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "HinetPy"
description = "A Python package to request and process seismic waveform data from NIED Hi-neta"
readme = "README.rst"
requires-python = ">=3.8"
authors = [{name = "Dongdong Tian", email = "[email protected]"}]
keywords = ["seismology", "NIED", "Hi-net", "waveform"]
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Intended Audience :: Education",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Scientific/Engineering :: Physics",
"Topic :: Utilities",
]
dependencies = ["requests"]
dynamic = ["version"]

[project.urls]
homepage = "https://seisman.github.io/HinetPy/"
documentation = "https://seisman.github.io/HinetPy/"
repository = "https://github.com/seisman/HinetPy"

[tool.setuptools]
license-files = ["LICENSE.txt"]

[tool.setuptools.packages.find]
include = ["HinetPy*"]
exclude = ["docs", "tests"]

[tool.setuptools_scm]
local_scheme = "node-and-date"
fallback_version = "999.999.999+unknown"

[tool.black]
line-length = 88
exclude = '''
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests
packaging
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

61 changes: 0 additions & 61 deletions setup.py

This file was deleted.

Loading