SciKit-Surgery / scikit-surgery

SciKit-Surgery - Compact Libraries for Surgical Navigation
http://scikit-surgery.github.io/scikit-surgery/
Other
41 stars 12 forks source link

Check if PythonTemplate supports building a stand-alone installer? #6

Closed thompson318 closed 4 years ago

thompson318 commented 4 years ago

In GitLab by @MattClarkson on Oct 1, 2018, 22:00

thompson318 commented 4 years ago

In GitLab by @ThomasDowrick on Oct 2, 2018, 10:10

We touched upon this a bit previously - https://weisslab.cs.ucl.ac.uk/WEISS/SoftwareRepositories/ardavin/wikis/QuestionsForDiscussion

In short, it is possible to build a stand alone installer using PyInstaller/py2exe/py_freeze. I haven't tried this yet, and it isn't currently included with PythonTemplate, but I can update it once I've tried out the process.

thompson318 commented 4 years ago

In GitLab by @MattClarkson on Oct 10, 2018, 13:39

So, i made my own package with hello.py. Using PyInstaller was easy. Also I look in Tom's PythonTemplate, and it looks like it could/should be included, but I don't yet know how to run a specific tox job?

thompson318 commented 4 years ago

In GitLab by @ThomasDowrick on Oct 10, 2018, 14:15

I tested pyinstaller for the ardavin project and it does seem very straightforward.

The PythonTemplate project includes a 'build install' step in the CI pipeline which uses pyinstaller (I hadn't noticed this before). After pip installing tox, tox -e installer should build the executable in the /dist folder.

the 'build install' step is consistently passing CI, for the ardavin project at least, so I think we're safe to leave it as it is for now and can probably close this issue.

thompson318 commented 4 years ago

In GitLab by @MattClarkson on Oct 10, 2018, 15:20

I just used cookie cutter to create a test project, and the installer does what I expect. The only thing I might change, is a .gitignore to people don't accidentally check in the build folder.

Also - have you tried it yet? If you create a new project, for just a library, do you need a toplevel.py file?

I created a project, called banana, and it created a folder called banana/banana.py

Whats that for? (can you try it if you havent).

thompson318 commented 4 years ago

In GitLab by @ThomasDowrick on Oct 11, 2018, 10:16

By default the Project name and the package name are the same (except package is in lower case), but these could be different e.g. Project 'fruit' and package 'banana', in which case there would be

/fruit
    /banana
    banana.py
    etc.

banana.py isn't necessary for package to run, as Tom changed the /banana/main.py template so that python banana does the same thing as python banana.py. I'm not sure if there is any advantage to having them both.

If the project is just a library/module, the top level .py file isn't needed, neither is the __main__.py file. banana/__init__.py is required though, otherwise it won't be treated as a module.

We can change the template as we see fit, or create separate ones for modules/UIs etc, although I think it would be preferable to have one as generic as possible, which can be pared back after implementation.

thompson318 commented 4 years ago

In GitLab by @MattClarkson on Oct 12, 2018, 22:02

I've opened specific issues for the PythonTemplate project, so can close this, as the answer is essentially "yes".

thompson318 commented 4 years ago

In GitLab by @MattClarkson on Oct 12, 2018, 22:02

closed