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

Maintenance cleanup #263

Merged
merged 6 commits into from
Oct 1, 2022
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
1 change: 0 additions & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

jobs:
check_release:
Expand Down
21 changes: 2 additions & 19 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Run weekly
# * is a special character in YAML so you have to quote this string
Expand All @@ -25,12 +24,9 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -qq octave octave-signal liboctave-dev
- name: Install dependencies
run: |
make install
- name: Generate coverage report
run: |
xvfb-run --auto-servernum make cover
pip install hatch; xvfb-run --auto-servernum hatch run cover:test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
Expand All @@ -45,20 +41,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install Oct2py
run: make
- name: Generate Docs
run: make docs

release_prep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install Oct2py
run: make
- name: Make sure the package is release-able
run: make release_prep
- run: pip install hatch; hatch run docs:build

pre-commit:
name: pre-commit
Expand Down
9 changes: 9 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
python:
version: 3.8
install:
# install itself with pip install .
- method: pip
path: .
extra_requirements:
- docs
2 changes: 0 additions & 2 deletions .readthedocs.yml

This file was deleted.

5 changes: 2 additions & 3 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ Installation and Test

To install and run tests locally, run::

make install
make test

pip install -e ".[test]"
pytest .

Linters
-------
Expand Down
49 changes: 0 additions & 49 deletions Makefile

This file was deleted.

8 changes: 0 additions & 8 deletions docs/environment.yml

This file was deleted.

32 changes: 9 additions & 23 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
# serve to show the default.

import datetime
import os
from pathlib import Path
from typing import Any, Dict

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -46,10 +49,14 @@
project = "Oct2Py"
copyright = f"2011 - {datetime.date.today().year}, Oct2Py contributors"

version = "5.5.1"
version_ns: Dict[str, Any] = {}
root = Path(__file__).parent.parent.parent
version_py = os.path.join(root, "oct2py", "_version.py")
with open(version_py) as f:
exec(compile(f.read(), version_py, "exec"), version_ns)

# The short X.Y version.
version = ".".join(version.split(".")[:2])
version = ".".join(version_py.split(".")[:2])
# The full version, including alpha/beta/rc tags.
release = version

Expand Down Expand Up @@ -254,24 +261,3 @@
# Numpy extensions
# -----------------------------------------------------------------------------
numpydoc_show_class_members = False

# -----------------------------------------------------------------------------
# intersphinx
# -----------------------------------------------------------------------------
_python_doc_base = "https://docs.python.org/3.5"
intersphinx_mapping = {
_python_doc_base: None,
}


# remove non-local uri warning
import sphinx.environment # noqa
from docutils.utils import get_source_line # noqa


def _warn_node(self, msg, node, **kwargs):
if not msg.startswith("nonlocal image URI found:"):
self._warnfunc(msg, "%s:%s" % get_source_line(node))


sphinx.environment.BuildEnvironment.warn_node = _warn_node
16 changes: 12 additions & 4 deletions oct2py/_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

import re
from collections import namedtuple
from typing import List

VersionInfo = namedtuple("VersionInfo", ["major", "minor", "micro", "releaselevel", "serial"])

version_info = VersionInfo(5, 5, 1, "", "")
# Version string must appear intact for hatch versioning
__version__ = "5.5.1"

__version__ = f"{version_info.major}.{version_info.minor}.{version_info.micro}"
# Build up version_info tuple for backwards compatibility
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<micro>\d+)(?P<releaselevel>.*?)(?P<serial>\d*)"
match = re.match(pattern, __version__)
assert match is not None
parts: List[object] = [int(match[part]) for part in ["major", "minor", "micro"]]
parts.append(match["releaselevel"] or "")
parts.append(match["serial"] or "")

if version_info.releaselevel:
__version__ += f"{version_info.releaselevel}{version_info.serial}"
version_info = VersionInfo(*parts)
60 changes: 22 additions & 38 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "oct2py"
version = "5.5.1"
dynamic = ["version"]
description = "'Python to GNU Octave bridge --> run m-files from python.'"
license = {text = "MIT"}
authors = [{name = "Steven Silvester", email = "steven.silvester@ieee.org"}]
Expand Down Expand Up @@ -42,50 +42,38 @@ test = [
docs = [
"sphinx",
"sphinx-bootstrap-theme",
"myst-parser",
"myst_parser",
"sphinx_rtd_theme"
]

[tool.jupyter-releaser]
skip = ["check-links"]

[tool.jupyter-releaser.hooks]
before-build-python = ["sudo apt-get update", "sudo apt-get install -qq octave octave-signal liboctave-dev"]
before-check-links = ["sudo apt-get update", "sudo apt-get install -qq octave octave-signal liboctave-dev"]

[tool.tbump.version]
current = "5.5.1"
regex = '''
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<micro>\d+)(?P<releaselevel>[a-z]+)?(?P<serial>[a-z]+)?
'''

[tool.tbump.git]
message_template = "Bump to {new_version}"
tag_template = "v{new_version}"

[[tool.tbump.file]]
src = "pyproject.toml"
version_template = '{major}.{minor}.{micro}{releaselevel}{serial}'

[[tool.tbump.file]]
src = "oct2py/_version.py"
version_template = '({major}, {minor}, {micro}, "{releaselevel}", "{serial}")'
[tool.jupyter-releaser]
skip = ["check-links"]

[[tool.tbump.file]]
src = "docs/source/conf.py"
version_template = '{major}.{minor}.{micro}{releaselevel}{serial}'
[tool.hatch.version]
path = "oct2py/_version.py"

[[tool.tbump.file]]
src = "Makefile"
version_template = '{major}.{minor}.{micro}{releaselevel}{serial}'
[tool.hatch.envs.docs]
features = ["docs"]
[tool.hatch.envs.docs.scripts]
build = "make -C docs html SPHINXOPTS='-W'"

[[tool.tbump.field]]
name = "releaselevel"
default = ""
[tool.hatch.envs.test]
features = ["test"]
[tool.hatch.envs.test.scripts]
test = "python -m pytest -vv {args}"
nowarn = "python -m pytest -vv -W default {args}"

[[tool.tbump.field]]
name = "serial"
default = ""
[tool.hatch.envs.cover]
features = ["test"]
dependencies = ["coverage", "pytest-cov"]
[tool.hatch.envs.cover.env-vars]
ARGS = "--doctest-modules -l --cov-report html --cov-report=xml --cov=oct2py -vv"
[tool.hatch.envs.cover.scripts]
test = "python -m pytest $ARGS --cov-fail-under 90 {args}"

[tool.pytest.ini_options]
testpaths = "oct2py"
Expand All @@ -97,10 +85,6 @@ timeout = 300
filterwarnings= [
# Fail on warnings
"error",
# Ignore imp deprecation warnings from ipykernel
"ignore:the imp module is deprecated:DeprecationWarning",
# Ignore imp distutils warnings from ipykernel
"ignore:the distutils package is deprecated:DeprecationWarning",
# Ignore our own user warnings
"ignore:Using deprecated:UserWarning:oct2py",
"ignore:Key - value pairs:UserWarning:oct2py",
Expand Down