Skip to content

Commit

Permalink
Merge pull request #240 from frank1010111/importlib-and-hatch
Browse files Browse the repository at this point in the history
Modern build system using Importlib and hatch
  • Loading branch information
frank1010111 authored Dec 7, 2024
2 parents facad63 + c14263e commit 0277e0b
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 89 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop ]
branches: [ develop, main ]

jobs:
build:
Expand All @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- uses: actions/checkout@v3
Expand All @@ -29,5 +29,4 @@ jobs:
python -m pip install --upgrade pip
python -m pip install .[test]
- name: Test with pytest
run: |
python run_tests.py
run: pytest
63 changes: 57 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,62 @@
[build-system]
requires = [
"setuptools>=48",
"setuptools_scm[toml] >= 4, <6",
"setuptools_scm_git_archive",
"wheel >= 0.29.0",
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "welly"
dynamic = ["version"]
authors = [{ name = "The Welly Authors", email = "hello@agilescientific.com" }]
description = "Tools for making and managing well data."
readme = "README.md"
readme-content-type = "text/markdown"
homepage = "https://github.com/agilescientific/welly"
classifiers = [
"Intended Audience :: Science/Research",
"Development Status :: 4 - Beta",
"Natural Language :: English",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent"
]
dependencies = [
"numpy",
"scipy",
"pandas",
"matplotlib",
"lasio",
"striplog",
"tqdm",
"wellpathpy",
"requests"
]

[project.optional-dependencies]
docs = ["sphinx", "sphinxcontrib-apidoc", "myst_nb", "furo"]
test = ["pytest", "pytest-cov", "pytest-mpl"]
dev = ["build", "pytest", "pytest-cov", "pytest-mpl", "sphinx", "sphinxcontrib-apidoc", "myst_nb", "furo"]

[tool.hatch.metadata]
packages = ["welly"]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "_version.py"

[tool.pytest.ini_options]
minversion = "6.0"
addopts = [
"--cov=welly",
"--cov-config=pyproject.toml",
"--mpl",
"--mpl-baseline-path=tests/baseline",
]
build-backend = "setuptools.build_meta"
testpaths = ["tests"]

[tool.setuptools_scm]
write_to = "welly/_version.py"
Expand Down
20 changes: 0 additions & 20 deletions run_tests.py

This file was deleted.

39 changes: 0 additions & 39 deletions setup.cfg

This file was deleted.

6 changes: 0 additions & 6 deletions setup.py

This file was deleted.

23 changes: 9 additions & 14 deletions welly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
welly
==================
"""
import sys

from .project import Project
from .well import Well
from .header import Header
Expand Down Expand Up @@ -67,17 +69,10 @@ def read_df(df, **kwargs):
]


from pkg_resources import get_distribution, DistributionNotFound

try:
VERSION = get_distribution(__name__).version
except DistributionNotFound:
try:
from ._version import version as VERSION
except ImportError:
raise ImportError(
"Failed to find (autogenerated) _version.py. "
"This might be because you are installing from GitHub's tarballs, "
"use the PyPI ones."
)
__version__ = VERSION
if sys.version_info >= (3, 8):
from importlib import metadata
else:
import importlib_metadata as metadata

__version__ = metadata.version(__name__)

0 comments on commit 0277e0b

Please sign in to comment.