Skip to content
Open
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
5 changes: 5 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
# use it with caution when git is large
with:
fetch-depth: 0
- name: Install dependencies
run: |
pip install toml
# - name: Update pyproject.toml version
# run: python update_pyproject_version.py
- name: Tag the release version
run: |
git tag $(cat version.txt)
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ repos:
hooks:
- id: mypy
args: [--no-strict-optional, --ignore-missing-imports]
exclude: '^ruff_mypy/'
exclude: '^update_pyproject_version'

- repo: https://github.com/pycqa/flake8
rev: "7.0.0" # pick a git hash / tag to point to
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"

[project]
name = "packaging-demo-anashr"
# version = "0.0.5"
version = "0.0.6"
authors = [{ name = "Yug", email = "yugg@test.edu" }]
description = "Demo for packaging"
readme = "README.md"
keywords = ["one", "two"]
license = { text = "Apache" }
dependencies = ["numpy"]
dynamic = ['version']
# dynamic = ['version']

[project.optional-dependencies]
test = ['pytest', 'pytest-cov']
Expand Down Expand Up @@ -55,7 +55,7 @@ line_length = 99


[tool.pylint."messages control"]
disable = ["line-too-long", "trailing-whitespace", "missing-function-docstring", "consider-using-f-string", "import-error", "too-few-public-methods", "redefined-outer-name", 'missing-module-docstring', 'pointless-statement', 'invalid-name', 'undefined-variable']
disable = ["line-too-long", "trailing-whitespace", "missing-function-docstring", "consider-using-f-string", "import-error", "too-few-public-methods", "redefined-outer-name", 'missing-module-docstring', 'pointless-statement', 'invalid-name', 'undefined-variable', 'unspecified-encoding']


[tool.ruff]
Expand Down
23 changes: 23 additions & 0 deletions update_pyproject_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import toml


def update_version():
# Read version from version.txt
with open("version.txt", "r") as file:
version = file.read().strip()

# Load the pyproject.toml file
with open("pyproject.toml", "r") as file:
data = toml.load(file)

# Assuming you are managing the version under a tool section,
# for example, [tool.my_package] or similar
data["project"]["version"] = version # Adjust the path as necessary

# Save the updated pyproject.toml
with open("pyproject.toml", "w") as file:
toml.dump(data, file)


if __name__ == "__main__":
update_version()