Skip to content

Commit

Permalink
Merge pull request #40 from HERA-Team/use-setuptools-scm
Browse files Browse the repository at this point in the history
maint: use setuptools_scm like the rest of the hera stack
  • Loading branch information
steven-murray committed Jul 13, 2023
2 parents a8af404 + 1688805 commit c3760ba
Show file tree
Hide file tree
Showing 20 changed files with 173 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
codecov:
branch: master
branch: main
37 changes: 37 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Python distributions to PyPI

on:
push:
tags:
- '*'

jobs:
build-n-publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest
env:
ENV_NAME: publish
PYTHON: "3.10"
steps:
- uses: actions/checkout@main
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ env.PYTHON }}

- name: Install build
run: pip install build

- name: Build a binary wheel and a source tarball
run: |
python -m build
- name: Publish to PyPI
if: startsWith(github.event.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist/*
*.ipynb_checkpoints*
coverage.xml
*.DS_Store
*/_version.py
1 change: 0 additions & 1 deletion linsolve/VERSION

This file was deleted.

4 changes: 0 additions & 4 deletions linsolve/__init__.py

This file was deleted.

83 changes: 0 additions & 83 deletions linsolve/version.py

This file was deleted.

63 changes: 63 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[build-system]
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
build-backend = "setuptools.build_meta"

[tool.setuptools_scm]
write_to = "src/linsolve/_version.py"
parentdir_prefix_version = "linsolve-"
fallback_version = "0.0.0"

[project]
name = "linsolve"
authors = [
{name = "HERA Team"},
]
license = {file = "LICENSE"}
description="high-level tools for linearizing and solving systems of equations"
readme = "README.md"
requires-python = ">=3.7"
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Mathematics",
]
keywords=[
"linear equations",
"optimal estimation"
]
dynamic = ["version"]
dependencies = [
"numpy>=1.23",
"scipy",
]

[project.urls]
Repository = "https://github.com/HERA-Team/linsolve"

[project.optional-dependencies]
test = ["pytest", "pytest-cov"]
dev = ["pre-commit", "linsolve[test]"]

[tool.black]
line-length = 88
py36 = false
exclude = '''
/(
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| _build
| buck-out
| build
| dist
)/
'''
33 changes: 33 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[metadata]
name = linsolve
author = HERA Team
url=https://github.com/HERA-Team/linsolve
license=BSD
license_file=LICENSE
long_description = file: README.md
long_description_content_type = text/x-md
description= high-level tools for linearizing and solving systems of equations
classifiers=
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
License :: OSI Approved :: BSD License
Programming Language :: Python :: 3
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
Programming Language :: Python :: 3.11
Topic :: Scientific/Engineering :: Mathematics
keywords=
linear equations
optimal estimation

[options]
packages = find:
include_package_data= True
package_dir =
=src
install_requires=
numpy>=1.23
scipy
33 changes: 0 additions & 33 deletions setup.py

This file was deleted.

17 changes: 17 additions & 0 deletions src/linsolve/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from pathlib import Path

try:
from importlib.metadata import PackageNotFoundError, version
except ImportError:
from importlib_metadata import PackageNotFoundError, version

try:
from ._version import version as __version__
except ModuleNotFoundError: # pragma: no cover
try:
__version__ = version(__name__)
except PackageNotFoundError: # pragma: no cover
# package is not installed
__version__ = 'unknown'

from .linsolve import *
4 changes: 4 additions & 0 deletions src/linsolve/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# file generated by setuptools_scm
# don't change, don't track in version control
__version__ = version = '1.0.1.dev8+gc98f991.d20230713'
__version_tuple__ = version_tuple = (1, 0, 1, 'dev8', 'gc98f991.d20230713')
1 change: 0 additions & 1 deletion linsolve/linsolve.py → src/linsolve/linsolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from scipy.sparse import csc_matrix
import scipy.sparse.linalg
import scipy.linalg
import warnings
from copy import deepcopy
from functools import reduce

Expand Down
17 changes: 17 additions & 0 deletions src/linsolve/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Version module, kept only for backwards-compatibility."""

import warnings
from . import __version__

version_info = __version__
version = __version__
git_origin = __version__
git_hash = __version__
git_description = __version__
git_branch = __version__

warnings.warn("You should not rely on this module any more. Just use __version__.")


if __name__ == '__main__':
print(__version__)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c3760ba

Please sign in to comment.