Skip to content

Conversation

@ram-from-tvl
Copy link
Contributor

@ram-from-tvl ram-from-tvl commented Sep 22, 2025

Pull Request

Description

  • Updated pyproject.toml to use setuptools-scm for dynamic version generation based on git tags
  • Added setuptools-scm to build requirements
  • Modified Dockerfile to copy the .git directory into the container, allowing setuptools-scm to access git information for version determination
  • Updated main.py and main_india.py to use setuptools-scm for version retrieval instead of importlib.metadata
  • Added fallback to "v?" if version cannot be determined

Fixes #371

Checklist:

  • My code follows OCF's coding style guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation

@ram-from-tvl
Copy link
Contributor Author

Hi @peterdudfield
I have raised this PR for #371. Please review it and let me know if any changes are required.
Thank you!

@peterdudfield
Copy link
Contributor

Does this work with docker, can you try?
I think you need to copy over the .git folder in the docker file

@ram-from-tvl
Copy link
Contributor Author

Hi @peterdudfield
I just switched from using importlib.metadata (which needs the package installed) to reading the version straight from pyproject.toml with tomllib I think no need for .git copying.
Thank you!

@ram-from-tvl
Copy link
Contributor Author

image

@peterdudfield
Copy link
Contributor

image

how does tomlib work?

@peterdudfield
Copy link
Contributor

Ah sorry, we need to change the pyproject to work with dynamic version, as we want to sue the git tags now. Do you want to do this in this PR or a separate one?

@ram-from-tvl
Copy link
Contributor Author

image

how does tomlib work?

it’s used to open pyproject.toml and extract the project.version field to display it. @peterdudfield
I am trying to alter the .toml file.
Thank you!

@ram-from-tvl
Copy link
Contributor Author

Hi @peterdudfield
Please let me know if the changes here are good to go.
Thank you!

@peterdudfield
Copy link
Contributor

Would you be able to add a screenshot of the text in this PR?

@peterdudfield
Copy link
Contributor

peterdudfield commented Oct 22, 2025

Could you also update the PR description, we are trying to not just link the issue, but describe what has been done in the PR. This helps make it really easy to see what each comment was about.

@ram-from-tvl
Copy link
Contributor Author

Hi @peterdudfield
I have updated the text description in this PR. Please look into it and let me know if any changes are required.
Thank you!

@peterdudfield
Copy link
Contributor

Hi @peterdudfield I have updated the text description in this PR. Please look into it and let me know if any changes are required. Thank you!

were you able to add a screen shot too?

@ram-from-tvl
Copy link
Contributor Author

image

@peterdudfield
Copy link
Contributor

I think you might need to add
dirty_template = "{tag}" in your pyproject.toml like this to make it a clearer tag name. Do you mind adding that in and sharing an updated screenshot?

@ram-from-tvl
Copy link
Contributor Author

image

@ram-from-tvl
Copy link
Contributor Author

Hi @peterdudfield
I hope it looks good now.
please let me know if we are good to go.
Thank you!

@peterdudfield
Copy link
Contributor

I think you might need to add dirty_template = "{tag}" in your pyproject.toml like this to make it a clearer tag name. Do you mind adding that in and sharing an updated screenshot?

have you added this so the version number should be something like x.y.z

@ram-from-tvl
Copy link
Contributor Author

I think the dirty template parameter was not working with the current version so i used local_scheme = "no-local-version"
which reduces the long version string a bit.
I'll then try with some other versions if we need something like x.y.z..?

@peterdudfield
Copy link
Contributor

I think the dirty template parameter was not working with the current version so i used local_scheme = "no-local-version" which reduces the long version string a bit. I'll then try with some other versions if we need something like x.y.z..?

Can you share screen shot?

@ram-from-tvl
Copy link
Contributor Author

image

yes @peterdudfield
This snapshot i shared is exactly how it looks after using the local scheme parameter.
I'll try some other versions and keep you updated on this.
were you asking for this snapshot.
Thank you!

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.

Add version to main page

2 participants