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

dynamic version strings #1676

Merged
merged 7 commits into from
Aug 15, 2024
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
21 changes: 15 additions & 6 deletions alot/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from importlib.metadata import version, PackageNotFoundError

# this requires python >=3.8
try:
__version__ = version("alot")
except PackageNotFoundError:
# package is not installed
pass


__productname__ = 'alot'
__version__ = '0.10'
__copyright__ = "Copyright (C) 2012-21 Patrick Totzke"
__author__ = "Patrick Totzke"
__author_email__ = "patricktotzke@gmail.com"
# -__copyright__ = "Copyright (C) 2012-21 Patrick Totzke"
# __author__ = "Patrick Totzke"
# __author_email__ = "patricktotzke@gmail.com"
__description__ = "Terminal MUA using notmuch mail"
__url__ = "https://github.com/pazz/alot"
__license__ = "Licensed under the GNU GPL v3+."
# __url__ = "https://github.com/pazz/alot"
# __license__ = "Licensed under the GNU GPL v3+."
5 changes: 3 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# alot documentation build configuration file
import pathlib
import tomllib
import importlib.metadata

pyproject = pathlib.Path(__file__).parent.parent.parent / "pyproject.toml"
with pyproject.open("rb") as f:
Expand Down Expand Up @@ -54,9 +55,9 @@
# built documents.
#
# The short X.Y version.
version = project_data["version"]
version = importlib.metadata.version("alot")
# The full version, including alpha/beta/rc tags.
release = project_data["version"]
release = importlib.metadata.version("alot")

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
packages = {
alot = pkgs.python3Packages.buildPythonApplication {
name = "alot";
version = pyproject.project.version + "-post";
version = "0.dev+${if self ? shortRev then self.shortRev else "dirty"}";
src = self;
pyproject = true;
outputs = [
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ build-backend = "setuptools.build_meta"

[project]
name = "alot"
version = "0.10"
description = "Terminal MUA using notmuch mail"
authors = [
{name="Patrick Totzke", email="patricktotzke@gmail.com"}
Expand All @@ -14,6 +13,7 @@ maintainers = [
{name="Lucas Hoffmann", email="lucc@posteo.de"},
]
readme = "README.md"
dynamic = ["version"]
requires-python = ">=3.8"
license = { text = "GPL-3.0-or-later" }
classifiers = [
Expand Down Expand Up @@ -49,3 +49,5 @@ Issues = "https://github.com/pazz/alot/issues"

[tool.setuptools.packages.find]
include = ["alot*"]

[tool.setuptools_scm]
15 changes: 15 additions & 0 deletions readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,22 @@ build:
os: ubuntu-22.04
tools:
python: "3.12"
apt_packages:
- libmagic1 # for python-magic
jobs:
# remove and mock problematic dependencies
pre_install:
- sed -i -e /gpg/d -e /notmuch2/d pyproject.toml
- touch gpg.py
- echo NullPointerError = NotmuchError = None > notmuch2.py
# make the git state clean again for setuptools_scm
post_install:
- git checkout pyproject.toml

# Install alot itself before building the docs
python:
install:
- path: .
# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py