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

chore: Modify build tool #36

Merged
merged 27 commits into from
Jan 24, 2024
Merged

chore: Modify build tool #36

merged 27 commits into from
Jan 24, 2024

Conversation

fmotaf
Copy link

@fmotaf fmotaf commented Jan 8, 2024

Closes #16

pyproject.toml Outdated
[tool.setuptools_scm]
write_to = "mox/__version__.py"
[tool.hatch.version]
path = "hatch/__about__.py"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should stay as "mox/__version__.py" and it will write automatically.

Copy link
Author

@fmotaf fmotaf Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is according to docs hatch looks for a variable named __version__ inside the file pointed by path but in mox/__version__.py there's already a variable with a different value '0.1.dev296+gb25cd38.d20240110' for the version which is (i believe) the version of the package and not the version of hatch, hence when i try to build using
poetry run python -m hatch build it fails with the message:
ValueError: Error getting the version from source 'regex': unable to parse the version from the file: mox/__version__.py
Docs: https://hatch.pypa.io/latest/version/#pyprojecttoml

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the docs, what should be in __about__.py is the project version, and not the version of hatch itself. The hatch version is already in pyproject.toml. Here is a suggestion so it works with the current __version__.py file:

Suggested change
path = "hatch/__about__.py"
path = "mox/__version__.py"
validate-bump = true
scheme = "semver"
pattern = "__version__ = version = \"(?P<version>[^\"]+)"

Copy link
Author

@fmotaf fmotaf Jan 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, will patch it.

setuptools_scm = { version = "^8.0", python = ">=3.8,<4" }
hatch = { version = "^1.9.1", python = ">=3.9,<4" }
hatchling = { version = "^1.21.0", python = ">=3.8,<4" }
hatch-semver = { version = "^1.0.1", python = ">=3.9,<4" }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work! We need to drop Python 3.7 support before merging this, though. #37

@ivancrneto
Copy link
Owner

@fmotaf can you merge the latest main and solve the conflicts here? thank you!

Copy link

codecov bot commented Jan 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (78cbc4e) 89.92% compared to head (9581b53) 89.92%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #36   +/-   ##
=======================================
  Coverage   89.92%   89.92%           
=======================================
  Files          11       11           
  Lines        1072     1072           
  Branches      168      168           
=======================================
  Hits          964      964           
  Misses         83       83           
  Partials       25       25           
Flag Coverage Δ
pymox-tests-3.10 89.73% <ø> (ø)
pymox-tests-3.11 89.73% <ø> (ø)
pymox-tests-3.12 89.73% <ø> (ø)
pymox-tests-3.8 89.72% <ø> (ø)
pymox-tests-3.9 89.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted file tree graph

@ivancrneto
Copy link
Owner

Great work!

@ivancrneto ivancrneto merged commit 4bc8b46 into ivancrneto:main Jan 24, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace build system with hatch
2 participants