Skip to content

Commit

Permalink
Merge pull request psychopy#6666 from peircej/PKG-versioning
Browse files Browse the repository at this point in the history
PKG: dynamic versioning with setuptools-git-versioning
  • Loading branch information
peircej committed Jul 5, 2024
2 parents 09686f8 + f11ccb8 commit 4d37905
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 15 deletions.
8 changes: 3 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include LICENSE
include psychopy/VERSION
recursive-include psychopy *.txt
recursive-include psychopy *.zip

recursive-include psychopy *.png
recursive-include psychopy/app/themes *.json
recursive-include psychopy *.png *.json
recursive-include psychopy/app/Resources *.icns
recursive-include psychopy/app/Resources *.ico
recursive-include psychopy/app/Resources *.ttf
Expand All @@ -18,12 +18,11 @@ recursive-include psychopy/experiment *.tmpl experiment.xsd
recursive-include psychopy/monitors *.ico

recursive-include psychopy/iohub *.yaml
recursive-include psychopy/iohub/devices/eyetracker/hw/sr_research/eyelink/win32 *.pyc *.dll *.pyd

recursive-include psychopy/visual/textbox/fonts *.ttf
recursive-include psychopy/experiment *.xltx

recursive-include psychopy/demos/coder *.mov *.jpg *.ttf *.yaml *.py *.part *.xlsx *.xls
recursive-include psychopy/demos/coder *.mov *.jpg *.ttf *.yaml *.py *.part *.xlsx
recursive-include psychopy/demos/builder *.psyexp *.csv *.xlsx *.wav *.yaml

recursive-include psychopy/preferences *.spec
Expand All @@ -37,6 +36,5 @@ recursive-include docs/source/_templates *.html
prune docs/build
prune docs/source/nonSphinx
prune windlls
include version

recursive-include psychopy/alerts *.yaml
1 change: 1 addition & 0 deletions psychopy/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2024.2.0
3 changes: 2 additions & 1 deletion psychopy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@

import os
import sys
import pathlib

__version__ = '2024.2.0dev6'
__version__ = (pathlib.Path(__file__).parent/"VERSION").read_text(encoding="utf-8").strip()
__license__ = 'GPL v3'
__author__ = 'Open Science Tools Ltd'
__author_email__ = '[email protected]'
Expand Down
28 changes: 20 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[tool.pdm]
version = { source = "file", path = "psychopy/__init__.py" }

[project]
name = "psychopy"
Expand Down Expand Up @@ -136,16 +134,30 @@ psychopy = "psychopy.app.psychopyApp:main"

[build-system]
requires = [
"pdm-backend",
"distro; platform_system == \"Linux\"",
"tomlkit",
"setuptools>=41", "wheel", "setuptools-git-versioning>=2.0,<3",
]
build-backend = "pdm.backend"
build-backend = "setuptools.build_meta"

[tool.pdm.build]
includes = []
excludes = ["building/"]
#source-includes = ["tests/"]
[tool.setuptools]
# this package will read some included files in runtime, avoid installing it as .zip
zip-safe = false

[tool.setuptools-git-versioning]
enabled = true
version_file = "psychopy/VERSION"
count_commits_from_version_file = true # <--- enable commits tracking
dev_template = "{tag}.{branch}{ccount}+git.{sha}" # suffix for versions will be .dev
dirty_template = "{tag}.{branch}{ccount}+git.{sha}.dirty" # same thing here
branch_formatter = "utils:_branchFormatter"

[tool.setuptools.packages.find]
# https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#automatic-discovery
where = ["."]
# include = ["pkg*"]
exclude = ["psychopy/tests", "building"]
namespaces = false

[tool.distutils.bdist_wheel]
universal = 1
Expand Down
10 changes: 10 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

def _branchFormatter(name):
"""Receives name of this git branch (from setuptools-git-versioning) and
returns the relevant release tag"""
# see https://setuptools-git-versioning.readthedocs.io/en/stable/options/branch_formatter.html
print("THIS:", name)
if name == "release":
return "post" # so we get 2024.2.1post4+4ea4af for post-release
else:
return "dev" # so we get 2024.2.2dev4+4ea4af for pre-release
1 change: 0 additions & 1 deletion version

This file was deleted.

0 comments on commit 4d37905

Please sign in to comment.