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

Formatting error in pyproject.toml for GUI backends PySide2/None #405

Closed
GenevieveBuckley opened this issue May 22, 2020 · 6 comments
Closed
Labels
bug A crash or error in behavior.

Comments

@GenevieveBuckley
Copy link
Contributor

Description

When I run the briefcase tutorial example, there's a formatting error in the generated pyproject.toml. This formatting error means the next step in the tutorial (the briefcase dev command) will not run.

Version numbers

  • briefcase 0.3.0
  • Python 3.7
  • Mac Catalina

Note: I think this issue is new with briefcase version 0.3.0? I was using it last month-ish and didn't see the same problem until I updated briefcase today.

How to reproduce

  1. Setup your python virtual environment, and then start a new briefcase project with:
briefcase new
  1. Select the default for every question, EXCEPT when asked to select the GUI backend.
    Choose either "[2] PySide2" or "[3] None" for this question.

  2. Observe the failure when running briefcase dev

cd helloworld
briefcase dev

The error message is:

Briefcase configuration error: Invalid pyproject.toml: This float doesn't have a leading digit (line 26 column 1 char 519)

Suggested fix

It seems like the only problem is two missing \n characters in pyproject.toml that should make a line break before [tool.briefcase.app.helloworld.windows].

If I edit the file and insert the newlines myself, this fixes my problem and briefcase dev will run.

Here's the relevant part of pyproject.toml:

...
[tool.briefcase.app.helloworld.macOS]
requires = []

[tool.briefcase.app.helloworld.linux]
requires = [][tool.briefcase.app.helloworld.windows]
requires = []

# Mobile deployments
...

The thing is, I'm not quite sure where pyproject.toml is being written.
The briefcase/commands/new.py file pulls in the briefcase-template cookiecutter. That setup.py file seems like the closest thing.
But there haven't been any changes to this repo since last year, and the formatting in setup.py looks ok to me. Any tips?

@freakboy3742
Copy link
Member

Thanks for the report! Confirmed you've found a bug.

Your diagnosis looks completely correct to me; the only piece you've missed is that Briefcase (as of v0.3) uses the v0.3 branch of the briefcase-template repository.

There's been at least 2 recent changes to that file - one of which was exactly in the area you've described (between the requirements for Linux and the Windows section).

Let me know if you're interested in working on a fix for this; if I don't hear from you in a day or two, I'll assume your not and I'll tag it for others to look at.

@freakboy3742 freakboy3742 added the bug A crash or error in behavior. label May 23, 2020
@GenevieveBuckley
Copy link
Contributor Author

...the only piece you've missed is that Briefcase (as of v0.3) uses the v0.3 branch of the briefcase-template repository.

Ah, I was only looking at the master branch! Uh, I'm not sure my briefcase is actually using that template branch though. One of the recent changes added "PursuedPyBear" to the list of GUI options you can choose when starting a new project, but I only get asked to choose from Toga/PySide2/None.

Do you get different (better) behavour from briefcase 0.3.0?

@GenevieveBuckley
Copy link
Contributor Author

I would like to take a stab at fixing this.

That said, I still need to work out where the fix goes. Maybe reading up on how to create cookiecutters will help me there.

@freakboy3742
Copy link
Member

Unfortunately not - that's the subject of #392. At present, the list of supported platforms is hard coded. Once #392 is fixed, PursuedPyBear should automatically appear in the list of options.

As for fixing this bug: Cookiecutter is a (Python installable) tool for taking a collection of Jinja templates, and rolling them out into a full directory structure. Metadata for the template is declared in the cookiecutter.json file in the root of the template. If you run cookiecutter <path to directory> or cookiecutter <URL>, it will prompt you for the metadata it needs, and then roll out the template.

My suggestion here would be to fork & clone the briefcase-template repo, and then point cookiecutter at your local copy of the template; Tweak the template, then rerun. Rinse and repeat until the template does the right thing :-)

@freakboy3742
Copy link
Member

Oh - and if you need any more pointers or background, ask away - either here, or in our chat room!

@GenevieveBuckley
Copy link
Contributor Author

I'll go ahead and close this issue, now that beeware/briefcase-template#18 has been merged in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior.
Projects
None yet
Development

No branches or pull requests

2 participants