Skip to content

Commit 0277e0b

Browse files
authored
Merge pull request #240 from frank1010111/importlib-and-hatch
Modern build system using Importlib and hatch
2 parents facad63 + c14263e commit 0277e0b

File tree

6 files changed

+69
-89
lines changed

6 files changed

+69
-89
lines changed

.github/workflows/run-tests.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
push:
88
branches: [ develop, main ]
99
pull_request:
10-
branches: [ develop ]
10+
branches: [ develop, main ]
1111

1212
jobs:
1313
build:
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
19+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
2020

2121
steps:
2222
- uses: actions/checkout@v3
@@ -29,5 +29,4 @@ jobs:
2929
python -m pip install --upgrade pip
3030
python -m pip install .[test]
3131
- name: Test with pytest
32-
run: |
33-
python run_tests.py
32+
run: pytest

pyproject.toml

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,62 @@
11
[build-system]
2-
requires = [
3-
"setuptools>=48",
4-
"setuptools_scm[toml] >= 4, <6",
5-
"setuptools_scm_git_archive",
6-
"wheel >= 0.29.0",
2+
requires = ["hatchling", "hatch-vcs"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "welly"
7+
dynamic = ["version"]
8+
authors = [{ name = "The Welly Authors", email = "[email protected]" }]
9+
description = "Tools for making and managing well data."
10+
readme = "README.md"
11+
readme-content-type = "text/markdown"
12+
homepage = "https://github.com/agilescientific/welly"
13+
classifiers = [
14+
"Intended Audience :: Science/Research",
15+
"Development Status :: 4 - Beta",
16+
"Natural Language :: English",
17+
"Programming Language :: Python :: 3.6",
18+
"Programming Language :: Python :: 3.7",
19+
"Programming Language :: Python :: 3.8",
20+
"Programming Language :: Python :: 3.9",
21+
"Programming Language :: Python :: 3.10",
22+
"License :: OSI Approved :: Apache Software License",
23+
"Operating System :: OS Independent"
24+
]
25+
dependencies = [
26+
"numpy",
27+
"scipy",
28+
"pandas",
29+
"matplotlib",
30+
"lasio",
31+
"striplog",
32+
"tqdm",
33+
"wellpathpy",
34+
"requests"
35+
]
36+
37+
[project.optional-dependencies]
38+
docs = ["sphinx", "sphinxcontrib-apidoc", "myst_nb", "furo"]
39+
test = ["pytest", "pytest-cov", "pytest-mpl"]
40+
dev = ["build", "pytest", "pytest-cov", "pytest-mpl", "sphinx", "sphinxcontrib-apidoc", "myst_nb", "furo"]
41+
42+
[tool.hatch.metadata]
43+
packages = ["welly"]
44+
45+
[tool.hatch.version]
46+
source = "vcs"
47+
48+
[tool.hatch.build.hooks.vcs]
49+
version-file = "_version.py"
50+
51+
[tool.pytest.ini_options]
52+
minversion = "6.0"
53+
addopts = [
54+
"--cov=welly",
55+
"--cov-config=pyproject.toml",
56+
"--mpl",
57+
"--mpl-baseline-path=tests/baseline",
758
]
8-
build-backend = "setuptools.build_meta"
59+
testpaths = ["tests"]
960

1061
[tool.setuptools_scm]
1162
write_to = "welly/_version.py"

run_tests.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 39 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

welly/__init__.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
welly
44
==================
55
"""
6+
import sys
7+
68
from .project import Project
79
from .well import Well
810
from .header import Header
@@ -67,17 +69,10 @@ def read_df(df, **kwargs):
6769
]
6870

6971

70-
from pkg_resources import get_distribution, DistributionNotFound
71-
72-
try:
73-
VERSION = get_distribution(__name__).version
74-
except DistributionNotFound:
75-
try:
76-
from ._version import version as VERSION
77-
except ImportError:
78-
raise ImportError(
79-
"Failed to find (autogenerated) _version.py. "
80-
"This might be because you are installing from GitHub's tarballs, "
81-
"use the PyPI ones."
82-
)
83-
__version__ = VERSION
72+
if sys.version_info >= (3, 8):
73+
from importlib import metadata
74+
else:
75+
import importlib_metadata as metadata
76+
77+
__version__ = metadata.version(__name__)
78+

0 commit comments

Comments
 (0)