-
Notifications
You must be signed in to change notification settings - Fork 28
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
Address issue 59 (refactor build system) #85
Conversation
Note all builds are going to break for a while as I purposefully removed |
* Remove hardcoded version (which will be replaced dynamically) * Add specific lines to init * Add scripts directory, which contains a few helpers
2c21d34
to
5652303
Compare
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #85 +/- ##
==========================================
+ Coverage 95.24% 95.47% +0.22%
==========================================
Files 55 54 -1
Lines 4247 4239 -8
==========================================
+ Hits 4045 4047 +2
+ Misses 202 192 -10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@ziatdinovmax I've changed quite a few files so your eyes on the latest commit would be great. Please don't hesitate to ask any questions! The strangest, but in my opinion, nicest, difference is that you no longer have to manually update |
@matthewcarbone - thanks! I will review it shortly. |
@ziatdinovmax I'll need to rebase and force push again. I also might have a slightly better way to do this, though it'll be similar in spirit. Going to convert back to a draft temporarily. I'll let you know when it's done! |
b5e5318
to
b696b97
Compare
@ziatdinovmax sorry for the |
One minor important change. To handle dynamic versioning, there is now # gpax/__init__.py
from gpax._version import __version__ and # gpax/_version.py
try:
import dunamai as _dunamai
__version__ = _dunamai.Version.from_any_vcs().serialize()
del _dunamai
except ImportError:
__version__ = "dev" The above is used when dealing with local copies. I.e., if someone does However, when actually building and deploying to PyPI, the following script is run. # scripts/build_project.sh
pip install flit~=3.7
pip install dunamai==1.19.2
echo "__version__ = '$(dunamai from any --style=pep440 --no-metadata)'" >gpax/_version.py
flit build This dynamically, at build time, rewrites Anyways, I think everything is pretty clean now. Let me know if you have any questions! |
Just in case someone using GPax as a dev copy does not have dunamai installed, GPax will now gracefully fail to detect the version and will simply use "dev" as the version name.
@ziatdinovmax I think this is ready for your review at this point. Please let me know if you have any questions, and I think we should test the build/deploy once on the PyPI test server before launching it live! |
Current WIP, I'll explain the changes I'm making as I go.
Below is my summary of changes
Refactor semantic versioning
Status: ✅ done
I have spent a while trying to figure out a robust way of getting the tag of the commit to be automatically swapped in for the
__version__
dunder attribute in the__init__.py
files. I have failed to find a way to do this without actually rewriting part of the file itself, so that's what I did. It's ugly, but it works! I think I might even write a GH action for it at some point.Modernize build system
Status: ✅ done
This includes deprecating
setup.py
in favor ofpyproject.toml
and also using a more modern build system like flit.Note that the deploy workflow only runs on pushes and when there is a tagged commit!
Refactor
.github/workflows
systemStatus: ✅ done
Just trying to clean this up a bit, and refactor the workflow files so they're much easier to read.