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

Implement coh tag command #7

Merged
merged 7 commits into from
Aug 30, 2024
Merged

Implement coh tag command #7

merged 7 commits into from
Aug 30, 2024

Conversation

bswck
Copy link
Member

@bswck bswck commented Aug 5, 2024

Closes #6

@bswck bswck requested a review from jaraco August 5, 2024 22:30
@bswck
Copy link
Member Author

bswck commented Aug 5, 2024

Let me know if we want some acknowledgement output, such as "Successfully created tag ..." (git doesn't print it out, but git always accepts an absolute name, so it has an excuse)

Copy link
Member

@jaraco jaraco left a comment

Choose a reason for hiding this comment

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

Looks good. I have a few nitpicks and some suggestions about naming and execution.

__main__.py Outdated Show resolved Hide resolved
__main__.py Outdated Show resolved Hide resolved
__main__.py Outdated Show resolved Hide resolved
__main__.py Outdated Show resolved Hide resolved
__main__.py Outdated Show resolved Hide resolved
@bswck bswck force-pushed the tag-command branch 2 times, most recently from bb0ec1f to 6338f24 Compare August 6, 2024 17:04
@bswck
Copy link
Member Author

bswck commented Aug 6, 2024

I'm not fine without a demonstrated use case of this command. Let's just not test it locally yet. I'll add some doctests.

@jaraco
Copy link
Member

jaraco commented Aug 6, 2024

Let me know if we want some acknowledgement output, such as "Successfully created tag ..." (git doesn't print it out, but git always accepts an absolute name, so it has an excuse)

I'm okay without the message. I can see how it could be useful, though. I frequently run jaraco.develop.finalize and only figure out what version it created after I push and see the new tag pushed and am surprised to see it created something unexpected (because I had failed to delete a tag, for example). I don't feel strongly about it, so I'll leave it to your instincts.

@bswck
Copy link
Member Author

bswck commented Aug 6, 2024

I'm not fine without a demonstrated use case of this command. Let's just not test it locally yet. I'll add some doctests.

Maybe we could roll out a fixture to create a temporary repo.
Indeed, we can.

@jaraco
Copy link
Member

jaraco commented Aug 6, 2024

I'm not fine without a demonstrated use case of this command. Let's just not test it locally yet. I'll add some doctests.

Maybe we could roll out a fixture to create a temporary repo.

jaraco.vcs has such a thing, but it's probably not yet exposed except for internal use. We could move that into jaraco.vcs.fixtures and expose it as a pytest entry point. Would that help?

Also, don't feel obliged to make it a doctest. If you'd rather write proper unit tests (and that's what most of the world besides me would expect), feel free to create one in tests/test_*.

@bswck
Copy link
Member Author

bswck commented Aug 6, 2024

I'm not fine without a demonstrated use case of this command. Let's just not test it locally yet. I'll add some doctests.

Maybe we could roll out a fixture to create a temporary repo.

jaraco.vcs has such a thing, but it's probably not yet exposed except for internal use. We could move that into jaraco.vcs.fixtures and expose it as a pytest entry point. Would that help?

Also, don't feel obliged to make it a doctest. If you'd rather write proper unit tests (and that's what most of the world besides me would expect), feel free to create one in tests/test_*.

In case it's a proper unit test (which is the best as I think about it), we could monkeypatch subprocess.run and validate against the produced argument list.
EDIT: I'm afraid that could break repo detection. Nevermind.

@bswck
Copy link
Member Author

bswck commented Aug 6, 2024

jaraco.vcs has such a thing, but it's probably not yet exposed except for internal use. We could move that into jaraco.vcs.fixtures and expose it as a pytest entry point. Would that help?

Definitely, yes! Tracking in jaraco/jaraco.vcs#36.

@jaraco
Copy link
Member

jaraco commented Aug 6, 2024

In case it's a proper unit test (which is the best as I think about it), we could monkeypatch subprocess.run and validate against the produced argument list.

If we go that route, I'd recommend pytest-subprocess.

@bswck
Copy link
Member Author

bswck commented Aug 6, 2024

In case it's a proper unit test (which is the best as I think about it), we could monkeypatch subprocess.run and validate against the produced argument list.

If we go that route, I'd recommend pytest-subprocess.

Looks awesome, thanks! However my instinct is that it is more suitable in this specific case to test against the actual Git, as it is done in the project we depend on, i.e. jaraco.vcs.

@jaraco
Copy link
Member

jaraco commented Aug 6, 2024

jaraco.vcs has such a thing, but it's probably not yet exposed except for internal use. We could move that into jaraco.vcs.fixtures and expose it as a pytest entry point. Would that help?

Definitely, yes!

I took a look at the fixtures there, and they're a little peculiar. They create two commits with a bar/baz file. Probably we'll want something more generalizable.

@bswck
Copy link
Member Author

bswck commented Aug 8, 2024

I'm okay without the message. I can see how it could be useful, though. I frequently run jaraco.develop.finalize and only figure out what version it created after I push and see the new tag pushed and am surprised to see it created something unexpected (because I had failed to delete a tag, for example). I don't feel strongly about it, so I'll leave it to your instincts.

As discussed in Discord, this hesitation will be solved by verbosity levels.
I'll simply put a print here and then introduce verbosity levels in another PR.

@jaraco jaraco closed this Aug 30, 2024
@jaraco jaraco reopened this Aug 30, 2024
@bswck
Copy link
Member Author

bswck commented Aug 30, 2024

Wait a sec. I'll put that print on its place.

@bswck
Copy link
Member Author

bswck commented Aug 30, 2024

Well, the project is entirely untested yet. I guess we can add tests later, as soon as I get some more time.

@jaraco jaraco merged commit 101d534 into main Aug 30, 2024
13 checks passed
@jaraco jaraco deleted the tag-command branch August 30, 2024 20:59
@jaraco
Copy link
Member

jaraco commented Aug 30, 2024

I used the feature to cut the next release of this project:

 coherent.cli main 🐚 py -3.12 -m pip-run . -- -m coherent.cli tag minor
Created tag 0.4
 coherent.cli main 🐚 git tags | head
v0.4.0
v0.3.2
v0.3.1
v0.3.0
v0.2.0
v0.1.0

@bswck
Copy link
Member Author

bswck commented Aug 30, 2024

Ahhh, I didn't use the result of semver(name).
Sorry.

@jaraco
Copy link
Member

jaraco commented Aug 30, 2024

Ahhh, I didn't use the result of semver(name).
Sorry.

No biggie.

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 a command to tag a release
2 participants