mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-19 08:39:58 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb14e4daa0 | ||
|
|
28ac783995 |
No files matched your search
@@ -44,7 +44,7 @@ jobs:
|
||||
run: |
|
||||
git config --global user.name "${GITHUB_ACTOR}"
|
||||
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
|
||||
uv run bump2version ${{ github.event.inputs.bump }}
|
||||
uv run poe ${{ github.event.inputs.bump }}
|
||||
|
||||
- name: Push
|
||||
run: |
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "spoolman-ui",
|
||||
"version": "0.22.1",
|
||||
"version": "0.22.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "spoolman-ui",
|
||||
"version": "0.22.1",
|
||||
"version": "0.22.2",
|
||||
"dependencies": {
|
||||
"@ant-design/v5-patch-for-react-19": "^1.0.3",
|
||||
"@loadable/component": "^5.16.7",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "spoolman-ui",
|
||||
"version": "0.22.1",
|
||||
"version": "0.22.2",
|
||||
"engines": {
|
||||
"node": "20.x"
|
||||
},
|
||||
|
||||
+5
-20
@@ -1,12 +1,10 @@
|
||||
[project]
|
||||
name = "spoolman"
|
||||
version = "0.22.1"
|
||||
version = "0.22.2"
|
||||
description = "A web service that keeps track of 3D printing spools."
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
authors = [
|
||||
{ name = "Donkie", email = "daniel.cf.hultgren@gmail.com" },
|
||||
]
|
||||
authors = [{ name = "Donkie", email = "daniel.cf.hultgren@gmail.com" }]
|
||||
dependencies = [
|
||||
"uvicorn~=0.34",
|
||||
"httptools>=0.6.4; platform_machine != \"armv7l\"",
|
||||
@@ -35,7 +33,6 @@ dev = [
|
||||
"pytest-asyncio~=0.25.3",
|
||||
"httpx~=0.28.1",
|
||||
"poethepoet>=0.40.0",
|
||||
"bump2version>=1.0.1",
|
||||
]
|
||||
|
||||
[tool.poe.tasks.generate-docs]
|
||||
@@ -70,9 +67,7 @@ line-length = 120
|
||||
target-version = "py310"
|
||||
|
||||
[tool.ruff.lint]
|
||||
select = [
|
||||
"ALL",
|
||||
]
|
||||
select = ["ALL"]
|
||||
ignore = [
|
||||
"A003",
|
||||
"COM812",
|
||||
@@ -98,15 +93,5 @@ ignore = [
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests*/*" = [
|
||||
"ANN201",
|
||||
"ASYNC210",
|
||||
"S101",
|
||||
"PLR2004",
|
||||
"D103",
|
||||
"TID252",
|
||||
]
|
||||
"migrations/versions/*" = [
|
||||
"N999",
|
||||
]
|
||||
|
||||
"tests*/*" = ["ANN201", "ASYNC210", "S101", "PLR2004", "D103", "TID252"]
|
||||
"migrations/versions/*" = ["N999"]
|
||||
+66
-24
@@ -26,34 +26,16 @@ def bump() -> None:
|
||||
print("There are staged changes, please commit them before bumping the version number.")
|
||||
sys.exit(1)
|
||||
|
||||
if subprocess.run(["pip", "show", "pdm-bump"], cwd=project_root, capture_output=True, check=False).returncode != 0:
|
||||
print("Please install pdm-bump using pip.")
|
||||
sys.exit(1)
|
||||
|
||||
# Bump the version number, read the pdm bump output to determine the new version number
|
||||
# Bump the version number by editing pyproject.toml directly.
|
||||
bump_type = sys.argv[1]
|
||||
bump_output = subprocess.run(["pdm", "bump", bump_type], cwd=project_root, capture_output=True, check=True)
|
||||
# Example output: "Performing increment of version: 0.7.0 -> 0.8.0\nSome more text"
|
||||
# Parse using regex
|
||||
new_version_match = re.search(r"-> ([A-Za-z0-9\.\-]+)", bump_output.stdout.decode())
|
||||
if new_version_match is None:
|
||||
print("Failed to parse pdm bump output, did it fail?")
|
||||
sys.exit(1)
|
||||
new_version = new_version_match.group(1)
|
||||
|
||||
new_version = _bump_pyproject(project_root, bump_type)
|
||||
|
||||
# Update the version number in the node project
|
||||
with Path("client", "package.json").open("r") as f:
|
||||
node_package = json.load(f)
|
||||
node_package["version"] = new_version
|
||||
with Path("client", "package.json").open("w") as f:
|
||||
json.dump(node_package, f, indent=2)
|
||||
_update_node_pkg_version(project_root, new_version)
|
||||
|
||||
# Run npm install to update the lock file with new version
|
||||
# On windows, shell=True is required for npm to be found
|
||||
if os.name == "nt":
|
||||
subprocess.run(["npm", "install"], cwd=project_root.joinpath("client"), check=True, shell=True) # noqa: S602
|
||||
else:
|
||||
subprocess.run(["npm", "install"], cwd=project_root.joinpath("client"), check=True)
|
||||
# Run uv lock to update the lock file
|
||||
subprocess.run(["uv", "lock"], check=True)
|
||||
|
||||
# Stage the changed files
|
||||
subprocess.run(
|
||||
@@ -70,3 +52,63 @@ def bump() -> None:
|
||||
|
||||
# Notify user that the process is complete
|
||||
print(f"Bumped version to {new_version}.")
|
||||
|
||||
|
||||
def _update_node_pkg_version(project_root: Path, new_version: str) -> None:
|
||||
with Path("client", "package.json").open("r") as f:
|
||||
node_package = json.load(f)
|
||||
node_package["version"] = new_version
|
||||
with Path("client", "package.json").open("w") as f:
|
||||
json.dump(node_package, f, indent=2)
|
||||
|
||||
# Run npm install to update the lock file with new version
|
||||
# On windows, shell=True is required for npm to be found
|
||||
if os.name == "nt":
|
||||
subprocess.run(["npm", "install"], cwd=project_root.joinpath("client"), check=True, shell=True) # noqa: S602
|
||||
else:
|
||||
subprocess.run(["npm", "install"], cwd=project_root.joinpath("client"), check=True)
|
||||
|
||||
|
||||
def _bump_pyproject(project_root: Path, bump_type: str) -> str:
|
||||
"""Bump the version number in pyproject.toml. Returns the new version."""
|
||||
pyproject_path = project_root.joinpath("pyproject.toml")
|
||||
try:
|
||||
pyproject_text = pyproject_path.read_text()
|
||||
except OSError:
|
||||
print("Failed to read pyproject.toml to determine current version.")
|
||||
sys.exit(1)
|
||||
|
||||
# Parse current version expecting MAJOR.MINOR.PATCH (digits only)
|
||||
version_match = re.search(
|
||||
r'^\s*version\s*=\s*"(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)"',
|
||||
pyproject_text,
|
||||
re.MULTILINE,
|
||||
)
|
||||
if version_match is None:
|
||||
print("Failed to parse current version from pyproject.toml.")
|
||||
sys.exit(1)
|
||||
|
||||
major = int(version_match.group("major"))
|
||||
minor = int(version_match.group("minor"))
|
||||
patch = int(version_match.group("patch"))
|
||||
|
||||
if bump_type == "major":
|
||||
major += 1
|
||||
minor = 0
|
||||
patch = 0
|
||||
elif bump_type == "minor":
|
||||
minor += 1
|
||||
patch = 0
|
||||
elif bump_type in ("micro", "patch"):
|
||||
patch += 1
|
||||
else:
|
||||
print("Unknown bump type. Use 'major', 'minor' or 'micro'.")
|
||||
sys.exit(1)
|
||||
|
||||
new_version = f"{major}.{minor}.{patch}"
|
||||
|
||||
# Replace only the first occurrence of the version line in pyproject.toml
|
||||
pattern = re.compile(r'(^\s*version\s*=\s*")\d+\.\d+\.\d+(\")', re.MULTILINE)
|
||||
new_pyproject_text = pattern.sub(r"\1" + new_version + r"\2", pyproject_text, count=1)
|
||||
pyproject_path.write_text(new_pyproject_text)
|
||||
return new_version
|
||||
@@ -150,15 +150,6 @@ wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/d7/8fb3044eaef08a310acfe23dae9a8e2e07d305edc29a53497e52bc76eca7/asyncpg-0.31.0-cp314-cp314t-win_amd64.whl", hash = "sha256:bd4107bb7cdd0e9e65fae66a62afd3a249663b844fa34d479f6d5b3bef9c04c3", size = 706062, upload-time = "2025-11-24T23:26:44.086Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bump2version"
|
||||
version = "1.0.1"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/29/2a/688aca6eeebfe8941235be53f4da780c6edee05dbbea5d7abaa3aab6fad2/bump2version-1.0.1.tar.gz", hash = "sha256:762cb2bfad61f4ec8e2bdf452c7c267416f8c70dd9ecb1653fd0bbb01fa936e6", size = 36236, upload-time = "2020-10-07T18:38:40.119Z" }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1d/e3/fa60c47d7c344533142eb3af0b73234ef8ea3fb2da742ab976b947e717df/bump2version-1.0.1-py2.py3-none-any.whl", hash = "sha256:37f927ea17cde7ae2d7baf832f8e80ce3777624554a653006c9144f8017fe410", size = 22030, upload-time = "2020-10-07T18:38:38.148Z" },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2026.1.4"
|
||||
@@ -973,7 +964,6 @@ dependencies = [
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "bump2version" },
|
||||
{ name = "httpx" },
|
||||
{ name = "poethepoet" },
|
||||
{ name = "pytest" },
|
||||
@@ -1004,7 +994,6 @@ requires-dist = [
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
{ name = "bump2version", specifier = ">=1.0.1" },
|
||||
{ name = "httpx", specifier = "~=0.28.1" },
|
||||
{ name = "poethepoet", specifier = ">=0.40.0" },
|
||||
{ name = "pytest", specifier = "~=8.3.5" },
|
||||
|
||||
Reference in new issue
Block a user