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

Create shell script to run to automatically bump the version number in setup.cfg and setup.py #56

Closed
Milind220 opened this issue Mar 10, 2022 · 10 comments · Fixed by #69
Assignees
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers

Comments

@Milind220
Copy link
Collaborator

This script would be run by the maintainer when a new release is being created, to bump the version number before the final commit for the release.

  • setup.cfg mentions the version number once, on line 3
  • setup.py mentions the version number twice, on line 12, and in the download url in line 13
@Milind220 Milind220 added enhancement New feature or request good first issue Good for newcomers labels Mar 10, 2022
@AliShahpurwala
Copy link
Contributor

AliShahpurwala commented Mar 16, 2022

Hi! So I got to working a little bit on this issue. So far I've covered some good ground but I'm still not sure of how the versioning system works. From what I've read online, I can see that different projects use different versioning systems. What I have so far is a script that reads the current version number from setup.cfg. If the last number is 10, eg. 1.4.10, it'll bump up the number and make it 1.5.0. For any other third number less than 10, eg. 1.4.3, it'll simply bump up the last number and make it 1.4.4. I was just looking for some guidance on how to proceed with how you're looking for the version number to get bumped up. Thanks!

EDIT: I'm taking a look at the versioning semantic right now. Missed it before but I should be able to do this if that's okay!

@Samxx97
Copy link
Contributor

Samxx97 commented Mar 16, 2022

Hello @AliShahpurwala thank you for taking the time of your day to contribute to ozone!
Now as you said , the schema that we follow here in this repository is called Semantic versioning and it is actually explained at length here .
At the end of the page the complete grammar (Backus - Naur Form) this schema is listed , and if you read the grammar you will be able to make out that none of the MAJOR ,MINOR or PATCH numbers have any numerical upper limits, so for example if we have 1.4.10 (in the form MAJOR.MINOR.PATCH) and we wish to bump up the patch number it will simply become 1.4.11 with no issues , and if we want to bump up MINOR number it will become 1.5.0. so bumping any number will reset the the numbers to its right to zeros.

ideally you can make the script take in a single option with one of these values {minor, major,patch} and the script will simply increment this specific number in various places inside the python packaging files that @Milind220 listed above

@Samxx97
Copy link
Contributor

Samxx97 commented Mar 16, 2022

@AliShahpurwala I have assigned you to handle this issue 😁

@Milind220
Copy link
Collaborator Author

@AliShahpurwala Hey! @Sam-damn explained it well. As he mentions, the script doesn't need to decide the new version number on its own, but instead accept the version number from whoever runs it. Then it just does the job of changing it for us

Hope that clears it up!

@AliShahpurwala
Copy link
Contributor

Hey guys! Thank you so much for the input. I've created a small shell script to do so. I'll explain the usage in the PR request. I've done some limited testing (General and boundary cases) and so far it seems to working as intended.

@Milind220
Copy link
Collaborator Author

Milind220 commented Mar 19, 2022

Hey @AliShahpurwala, on testing the script now, I've been unable to get it to work. I realise now that this could be because my computer uses Zsh as it's default shell, but I'm not entirely sure.

Here's what I've tried (Below each code segment is the output that it showed me):

./updateVersion.sh patch
zsh: permission denied: ./updateVersion.sh

sudo ./updateVersion.sh patch
sudo: ./updateVersion.sh: command not found

sh updateVersion.sh patch

Current Version 1 4 4

zsh updateVersion.sh patch         
bash updateVersion.sh patch

updateVersion  sh read26 bad option

zsh updateVersion.sh
bash updateVersion.sh
sh updateVersion.sh 

You must provide an argument for this script

@Milind220 Milind220 added the bug Something isn't working label Mar 19, 2022
@AliShahpurwala
Copy link
Contributor

AliShahpurwala commented Mar 20, 2022

Hmm ok that's odd. I'll take a look at this and get back to you ASAP. I'll also try and see the OS that I'm working on currently and try it on a VM too if required.

EDIT 1: Ok so I fetched and merged all the new commits that I needed and pulled them to my repo. When I tried using my script then, it wouldn't run and give me a whole bunch of weird errors. But then I deleted my repo from my local PC and cloned it again. Once I did that, the script seems to be working properly as intended. This is really weird but I'm going to keep working at it and keep you updated. If anyone else has any input to this problem, feel free to jump in!

EDIT 2: Here is something I found that would explain why zsh breaks. I was able to recreate the second set of errors that you got (ie. bad option -a). The script doesn't seem to work with zsh.

Final EDIT: Ok so I've now tested the script on my local Windows PC through the Ubuntu WSL as well as a Linux Mint VM. The reason that this issue is coming up is because some of the functions that are used are all configured for bash. So for the script to work, you can't use either zsh or sh. It must be run with bash. So the usage will be

bash updateVersion.sh patch

@Milind220
Copy link
Collaborator Author

@AliShahpurwala Gotcha! That makes sense. I'll try re-cloning the repo and then try it with bash. Thanks!

@AliShahpurwala
Copy link
Contributor

Hey so from this issue, I had an idea that would help maybe avoid these problems in the future. I've recently been using Docker in one of my courses for school and it seems that if we have a Docker image that people could use, it could help avoid some development problems in the future. I'm still very very new to Docker but I'm willing to learn more about it and give it a go. Not sure if this is overkill but I feel like it could do some good. Let me know what you think !

@Milind220
Copy link
Collaborator Author

@AliShahpurwala Hey! Docker might be a tad overkill for something like Ozone as far as I understand. However, as you learn more about it, if you see a good concrete application for it I'd be open to using it with the package.
Thanks for the suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants