jamesabel / osnap

MIT License
53 stars 3 forks source link

Can't figure out the __version__ option #25

Closed periwinkleFTW closed 4 years ago

periwinkleFTW commented 4 years ago

I am trying to package an app, but I keep getting an error about version PycharmProjects/qt-projects/PyQt-projects/SR/osnap_setup.py", line 9, in make_installer [APPLICATION_NAME], main_app.version, verbose=verbose) AttributeError: module 'main_app' has no attribute 'version'

jamesabel commented 4 years ago

This is saying your module main_app does not have an attribute version. You may want to try using main_app.__version__ instead, in case that's what holds the version string.

BTW, I'm working on a successor to osnap that I'm targeting to release sometime in July. I will post to the osnap readme when I do so.

periwinkleFTW commented 4 years ago

Thank you for quick reply! It's my first project, hence this question. Is there a special way to write version attribute or do I just add a variable version?

jamesabel commented 4 years ago

You're welcome!

If you're writing a Python package, you can add it to init.py like is in the test example: init.py

Hopefully this will answer your question, but if not I'd recommend open sourcing the project on github so I can see the code.

periwinkleFTW commented 4 years ago

https://github.com/periwinkleFTW/PyQt-projects/tree/master/SR here is the link to the project. My code is pretty messy and I apologize for it

periwinkleFTW commented 4 years ago

I would appreciate any help. Even the topics I should read or research, right now I am a little bit overwhelmed, but I am dedicated to finish my app

jamesabel commented 4 years ago

Ah, yes, that's going to have to be cleaned up. I'd recommend taking a look at requests for a sample layout. osnap works with this style of layout, and __version__ is treated in a similar manner.

That being said, despite the Zen of Python, there's not really one obvious way of putting packages together for freezing. Poetry has a pretty good intro in their new command. I'd recommend checking that out.

Going forward, my next tool is going to work with distribute-able packages, e.g. what can be put on PyPI. So, I'd recommend getting your app in shape where it works with something like Poetry, Flit or Python's regular setup. It's a little more work, but once you're sure it works as a package that can be distributed, then it's easier to get it to freeze and install. If you have the time to be a beta tester for my next tool let me know and I can help you get your app shipped in exchange for giving me feedback.

periwinkleFTW commented 4 years ago

I will take a look at requests. And yes, I do have time to be a beta tester!

jamesabel commented 4 years ago

OK - I just released PyShip. See www.pyship.org. Also, I'm giving a lightening talk at Pyninsula tonight in case you'd like to attend! https://www.meetup.com/Pyninsula-Python-Peninsula-Meetup/events/272950112/