Skip to content

Commit

Permalink
ensure generation of missing version file
Browse files Browse the repository at this point in the history
- style: watchmen Dr Manhatten stands by does nothing expresses academic curiousity
- feat: add param is_only_not_exists. Create nonexistent version file during write
- fix: version file is generated, git no track. During build, not exists, create it
- fix: in build backend, lazy load plugins after ensuring existence of version file
- fix(build plugins): subprocess cmd use absolute path
- fix(wrap_infer_version): add reverse search for config file
- refactor: remove package exports except exceptions
- refactor: config_settings hack encapsulate in class ConfigSettings
- tests(conftest): fixture finalize remove resources only on success
- tests(conftest): add fixture to verify version file semantic version str
- ci: missing requirements include
  • Loading branch information
msftcangoblowm committed Aug 5, 2024
1 parent d108fd1 commit b2b82a9
Show file tree
Hide file tree
Showing 25 changed files with 938 additions and 221 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/kit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ jobs:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
SET_LOCK: ${{ vars.DRAINSWAMP_SET_LOCK }}
run: |
echo "python -m build -C--kind=$RELEASE_VERSION -C--set-lock=$SET_LOCK"
python -m build -C--kind="$RELEASE_VERSION -C--set-lock=$SET_LOCK"
echo "python -m build -C--kind=current -C--set-lock=$SET_LOCK"
python -m build -C--kind="current" -C--set-lock="$SET_LOCK"
- name: "List tarballs"
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
SET_LOCK: ${{ vars.DRAINSWAMP_SET_LOCK }}
run: |
echo "python -m build -C--kind=$RELEASE_VERSION -C--set-lock=$SET_LOCK"
python -m build -C--kind="$RELEASE_VERSION -C--set-lock=$SET_LOCK"
python -m build -C--kind="$RELEASE_VERSION" -C--set-lock="$SET_LOCK"
- name: Store the distribution packages
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
SET_LOCK: ${{ vars.DRAINSWAMP_SET_LOCK }}
run: |
set -xe
echo "python -m build -C--kind=$RELEASE_VERSION -C--set-lock=$SET_LOCK"
python -m build -C--kind="$RELEASE_VERSION -C--set-lock=$SET_LOCK"
echo "python -m build -C--kind='current' -C--set-lock='$SET_LOCK'"
python -m build -C--kind="current" -C--set-lock="$SET_LOCK"
- name: "Install"
run: |
set -xe
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/testsuite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ jobs:
run: |
set -xe
python -m pip install -r requirements/tox$LOCK_SUFFIX
python -m pip install -r requirements/prod$LOCK_SUFFIX
python -m pip install -r requirements/kit$LOCK_SUFFIX
- name: "Refresh dependency lock .lnk files"
env:
Expand Down
17 changes: 17 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,23 @@ Changelog

.. scriv-start-here
.. _changes_1-2-0:

Version 1.2.0 — 2024-08-05
--------------------------

- style: watchmen Dr Manhatten stands by does nothing expresses academic curiousity
- feat: add param is_only_not_exists. Create nonexistent version file during write
- fix: version file is generated, git no track. During build, not exists, create it
- fix: in build backend, lazy load plugins after ensuring existence of version file
- fix(build plugins): subprocess cmd use absolute path
- fix(wrap_infer_version): add reverse search for config file
- refactor: remove package exports except exceptions
- refactor: config_settings hack encapsulate in class ConfigSettings
- tests(conftest): fixture finalize remove resources only on success
- tests(conftest): add fixture to verify version file semantic version str
- ci: missing requirements include

.. _changes_1-1-2:

Version 1.1.2 — 2024-08-02
Expand Down
10 changes: 4 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ That's a lot of boilerplate code ... gone! Not all, but most.
* Python 3.9 through 3.12, PyPy

**New in 1.2.x**

generate version file if missing;

**New in 1.1.x**

tox-test.ini; tox.ini; gha; build backend DS_CONFIG_SETTINGS support;
add gha variable DRAINSWAMP_SET_LOCK;

**New in 1.0.x**

build plugin manager and plugins; build uses plugins; entrypoint scm-version;
version file native support; drain-swamp tag; semantic version str sane fallback;
license apache2.0 --> AGPLv3+;

Extensions
-----------

Expand Down
18 changes: 14 additions & 4 deletions _req_links/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@
import copy
import sys
from collections.abc import Mapping
from pathlib import Path

from setuptools import build_meta as _orig
from setuptools.build_meta import * # noqa: F401 F403

from drain_swamp.monkey.wrap_infer_version import (
_get_config_settings,
run_build_plugins,
from drain_swamp.monkey.config_settings import ConfigSettings
from drain_swamp.monkey.wrap_get_version import (
SEM_VERSION_FALLBACK_SANE,
write_to_file,
)


Expand Down Expand Up @@ -112,7 +114,8 @@ def get_requires_for_build_sdist(config_settings=None):

if config_settings is None or not isinstance(config_settings, Mapping):
# tox does not pass in config_settings, check DS_CONFIG_SETTINGS
d_config_settings_tox = _get_config_settings()
cs = ConfigSettings()
d_config_settings_tox = cs.read()
if d_config_settings_tox is not None:
d_config_settings = copy.deepcopy(d_config_settings_tox)
else:
Expand All @@ -126,6 +129,13 @@ def get_requires_for_build_sdist(config_settings=None):
else: # pragma: no cover
d_config_settings = copy.deepcopy(config_settings)

# Ensure an initial version file exists. The version within can be incorrect
path_cwd = Path.cwd()
path_f = path_cwd.joinpath("pyproject.toml")
write_to_file(str(path_f), SEM_VERSION_FALLBACK_SANE, is_only_not_exists=True)

from drain_swamp.monkey.wrap_infer_version import run_build_plugins

run_build_plugins(d_config_settings)

return _orig.get_requires_for_build_sdist(d_config_settings)
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
# @@@ editable
copyright = "2024–2024, Dave Faulkmore"
# The short X.Y.Z version.
version = "1.1.2"
version = "1.2.0"
# The full version, including alpha/beta/rc tags.
release = "1.1.2"
release = "1.2.0"
# The date of release, in "monthname day, year" format.
release_date = "August 2, 2024"
release_date = "August 5, 2024"
# @@@ end

v = parse(release)
Expand Down
10 changes: 4 additions & 6 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,15 @@ That's a lot of boilerplate code ... gone! Not all, but most.
* Python 3.9 through 3.12, PyPy

**New in 1.2.x**

generate version file if missing;

**New in 1.1.x**

tox-test.ini; tox.ini; gha; build backend DS_CONFIG_SETTINGS support;
add gha variable DRAINSWAMP_SET_LOCK;

**New in 1.0.x**

build plugin manager and plugins; build uses plugins; entrypoint scm-version;
version file native support; drain-swamp tag; semantic version str sane fallback;
license apache2.0 --> AGPLv3+;

Extensions
-----------

Expand Down
6 changes: 2 additions & 4 deletions src/drain_swamp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.. moduleauthor:: Dave Faulkmore <https://mastodon.social/@msftcangoblowme>
.. py:data:: __all__
:type: tuple[str, str, str, str, str]
:value: ("Snip", "PyProjectTOMLParseError", "BackendNotSupportedError", \
:type: tuple[str, str, str, str]
:value: ("PyProjectTOMLParseError", "BackendNotSupportedError", \
"PyProjectTOMLReadError", "MissingRequirementsFoldersFiles")
Package level exports
Expand All @@ -28,10 +28,8 @@
PyProjectTOMLParseError,
PyProjectTOMLReadError,
)
from .snip import Snip

__all__ = (
"Snip",
"PyProjectTOMLParseError",
"BackendNotSupportedError",
"PyProjectTOMLReadError",
Expand Down
2 changes: 0 additions & 2 deletions src/drain_swamp/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ from .exceptions import (
PyProjectTOMLParseError,
PyProjectTOMLReadError,
)
from .snip import Snip

__all__ = (
"Snip",
"PyProjectTOMLParseError",
"BackendNotSupportedError",
"PyProjectTOMLReadError",
Expand Down
Loading

0 comments on commit b2b82a9

Please sign in to comment.