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

Not getting expected towncrier version #304

Closed
altendky opened this issue Dec 16, 2020 · 5 comments
Closed

Not getting expected towncrier version #304

altendky opened this issue Dec 16, 2020 · 5 comments
Labels

Comments

@altendky
Copy link
Member

Both master and your branch from #303 are still at 19.2.0, I only found https://github.com/twisted/towncrier/tree/hawkowl/release-19.09 which seems to be newer, but there I get the same:

% towncrier build --draft
Usage: towncrier build [OPTIONS]

Error: Got unexpected extra argument (build)

Originally posted by @fschulze in #105 (comment)

@altendky
Copy link
Member Author

I'm more curious how you are installing things. Also, type towncrier. Present master definitely seems to be coded for subcommands and I haven't run into any oddities in this regard. It seems that for some reason you aren't running what you think you are.

entry_points={"console_scripts": ["towncrier = towncrier._shell:cli"]},

@click.group(cls=DefaultGroup, default="build", default_if_no_args=True)
def cli():
pass
cli.add_command(_build_cmd)
cli.add_command(_check_cmd)
cli.add_command(_create_cmd)

@fschulze
Copy link

The installation method seems to be the key.

With pip it works properly and the towncrier script uses after setting up the requirements for load_entry_point:

...
if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(load_entry_point('towncrier', 'console_scripts', 'towncrier')())

With zc.buildout which I use in the project I tested the changes the script is different and does this:

...
import towncrier._shell

if __name__ == '__main__':
    sys.exit(towncrier._shell.cli())

I haven't looked deeper yet, but it seems like the cli.add_command stuff is lost in the process somehow. I never had issues like this with a simple console script entry point like that.

@fschulze
Copy link

fschulze commented Dec 16, 2020

I would say this issue can be closed for now, because the source of the problem is most likely not towncrier but either click or zc.buildout or their interaction.

Also the project I test this in has various older version pins which might cause the issue and which I can't easily update. The functionality of towncrier I need is available in that project, so I don't have much incentive to investigate further.

@altendky
Copy link
Member Author

You have ... instead of the rest of the code. Is it using the wrong Python? Maybe hand tweak the generated script to print(towncrier._shell) first and see what file it is referencing. But yeah, if you pin to an old version...? Anyways... glad we got something identified.

@fschulze
Copy link

I checked that I get to the correct code, that is how I noticed the cli.add_command stuff is there and executed. It just behaves as if only the build command is there. I did have a pin for click 6.7 which I updated, but that didn't fix it either. There may be other pinned dependencies which I didn't check. That was when I decided to stop investigating.

Anyway, thanks for caring and if I ever feel the need to investigate further, I'll let you know my findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants