Skip to content
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: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,4 @@ test/
.history/
pydata-sphinx-theme/
_build
_version.py
3 changes: 1 addition & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ install_requires =
docutils>=0.18
feedgen>=0.9.0
invoke>=1.6.0
packaging>=19.0
python-dateutil>=2.8.2
sphinx>=5.0.0
watchdog>=2.1.0
Expand Down Expand Up @@ -57,8 +58,6 @@ filterwarnings =
always::pytest.PytestConfigWarning
# Sphinx and other packages raise these
ignore:'imghdr' is deprecated and slated for removal in Python 3.13:DeprecationWarning
ignore:.*pkg_resources.declare_namespace.*
ignore:The alias.*

[pycodestyle]
max_line_length = 120
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python
from setuptools import setup # isort:skip
import os
from itertools import chain

try:
Expand All @@ -25,5 +26,5 @@

setup(
extras_require=extras,
use_scm_version=True,
use_scm_version={"write_to": os.path.join("src", "ablog", "_version.py")},
)
21 changes: 16 additions & 5 deletions src/ablog/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
from pkg_resources import DistributionNotFound, get_distribution

try:
version = get_distribution("ablog").version
except DistributionNotFound:
version = "unknown.dev"
from ._version import version
except Exception:
import warnings

warnings.warn(f'could not determine {__name__.split(".")[0]} package version; this indicates a broken installation')
del warnings

version = "0.0.0"

from packaging.version import parse as _parse

_version = _parse(version)
major, minor, bugfix = [*_version.release, 0][:3]
release = not _version.is_devrelease

__all__ = ["version", "major", "minor", "bugfix", "release"]
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ conda_deps =
make
myst-parser
nbsphinx
packaging
pandoc
pip
pytest
python-dateutil
setuptools
setuptools-scm
sphinx
sphinx-automodapi
watchdog
Expand Down