Are there best practices for (Java) package organization? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 6 years ago. The community reviewed whether to reopen this question 4 months ago and left it closed: Original close reason(s) were … Read more

How can I solve “java.lang.NoClassDefFoundError”?

I’ve tried both the examples in Oracle’s Java Tutorials. They both compile fine, but at run time, both come up with this error: Exception in thread “main” java.lang.NoClassDefFoundError: graphics/shapes/Square at Main.main(Main.java:7) Caused by: java.lang.ClassNotFoundException: graphics.shapes.Square at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) … 1 more I think … Read more

How do I update a Python package?

I’m running Ubuntu 9:10 and a package called M2Crypto is installed (version is 0.19.1). I need to download, build and install the latest version of the M2Crypto package (0.20.2). The 0.19.1 package has files in a number of locations including (/usr/share/pyshared and /usr/lib/pymodules.python2.6). How can I completely uninstall version 0.19.1 from my system before installing … Read more

Is __init__.py not required for packages in Python 3.3+

I am using Python 3.5.1. I read the document and the package section here: https://docs.python.org/3/tutorial/modules.html#packages Now, I have the following structure: /home/wujek/Playground/a/b/module.py module.py: class Foo: def __init__(self): print(‘initializing Foo’) Now, while in /home/wujek/Playground: ~/Playground $ python3 >>> import a.b.module >>> a.b.module.Foo() initializing Foo <a.b.module.Foo object at 0x100a8f0b8> Similarly, now in home, superfolder of Playground: ~ … Read more

Relative imports – ModuleNotFoundError: No module named x

This is the first time I’ve really sat down and tried python 3, and seem to be failing miserably. I have the following two files: test.py config.py config.py has a few functions defined in it as well as a few variables. I’ve stripped it down to the following: config.py debug = True test.py import config … Read more

Standard way to embed version into Python package?

Is there a standard way to associate version string with a Python package in such way that I could do the following? import foo print(foo.version) I would imagine there’s some way to retrieve that data without any extra hardcoding, since minor/major strings are specified in setup.py already. Alternative solution that I found was to have … Read more