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

switch to pypi version of MolecularNodes #1

Merged
merged 2 commits into from
Sep 28, 2023

Conversation

BradyAJohnston
Copy link
Contributor

I put Molecular Nodes up on pypi, so it can be installed from there and no longer requires
the internal packaging. The example .ipynb now works with the the installed version.

@kolibril13
Copy link
Owner

hi @BradyAJohnston , thanks for this pr!

Great to hear that molecular nodes is on pypi now!

This will make maintaining this package much more simple.

And actually, the previous implementation with that package folder was in the project did not working because of this line
https://github.com/BradyAJohnston/MolecularNodes/blob/dev-headless/MolecularNodes/auto_load.py#L57

I got this error, which is fixed now :)

from ipyblender_experimental import BlenderWidget
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
[/Users/jan-hendrik/projects/ipyMolecularNodes/debugging_import.ipynb](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/debugging_import.ipynb) Cell 1 line 1
----> [1](vscode-notebook-cell:/Users/jan-hendrik/projects/ipyMolecularNodes/debugging_import.ipynb#W0sZmlsZQ%3D%3D?line=0) from ipyblender_experimental import BlenderWidget

File [~/projects/ipyMolecularNodes/src/ipyblender_experimental/__init__.py:3](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/~/projects/ipyMolecularNodes/src/ipyblender_experimental/__init__.py:3)
      1 import importlib.metadata
      2 import pathlib
----> 3 from .render_to_image import render_to_image
      4 from .render_to_gltf_model import render_to_gltf_model , render_to_gltf_structure
      5 import anywidget

File [~/projects/ipyMolecularNodes/src/ipyblender_experimental/render_to_image.py:5](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/~/projects/ipyMolecularNodes/src/ipyblender_experimental/render_to_image.py:5)
      2 import base64
      3 from pathlib import Path
----> 5 from . import MolecularNodes as mn
      8 def apply_mods(obj):
      9     """
     10     Applies the modifiers on the modifier stack
     11 
   (...)
     14     vertices of the object.
     15     """

File [~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/__init__.py:33](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/__init__.py:33)
     30 import bpy
     31 from . import utils
---> 33 auto_load.init()
     35 def register():
     36     auto_load.register()

File [~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/auto_load.py:25](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/auto_load.py:25), in init()
     22 global modules
     23 global ordered_classes
---> 25 modules = get_all_submodules(Path(__file__).parent)
     26 ordered_classes = get_ordered_classes_to_register(modules)

File [~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/auto_load.py:53](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/auto_load.py:53), in get_all_submodules(directory)
     52 def get_all_submodules(directory):
---> 53     return list(iter_submodules(directory, directory.name))

File [~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/auto_load.py:57](https://file+.vscode-resource.vscode-cdn.net/Users/jan-hendrik/projects/ipyMolecularNodes/~/projects/ipyMolecularNodes/src/ipyblender_experimental/MolecularNodes/auto_load.py:57), in iter_submodules(path, package_name)
     55 def iter_submodules(path, package_name):
     56     for name in sorted(iter_submodule_names(path)):
---> 57         yield importlib.import_module("." + name, package_name)

File [/opt/homebrew/Cellar/python](https://file+.vscode-resource.vscode-cdn.net/opt/homebrew/Cellar/python)@3.10/3.10.13/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py:126, in import_module(name, package)
    124             break
    125         level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)

ModuleNotFoundError: No module named 'MolecularNodes'

@kolibril13 kolibril13 merged commit a86dae2 into kolibril13:main Sep 28, 2023
1 check passed
@kolibril13
Copy link
Owner

kolibril13 commented Sep 28, 2023

For the new version, I had to change import MolecularNodes as mn to import molecularnodes as mn and now it works like a charm!! :)

@BradyAJohnston
Copy link
Contributor Author

yeah I don't know why it goes lowercase, any ideas?

@kolibril13
Copy link
Owner

I found

All comparisons of distribution names MUST be case insensitive, and MUST consider hyphens and underscores to be equivalent.

here: https://peps.python.org/pep-0426/#name

@BradyAJohnston
Copy link
Contributor Author

It uses capital letters on PyPi (https://pypi.org/project/MolecularNodes/) but it just turns into lowercase when installed?

@kolibril13
Copy link
Owner

good question! ChatGPT saies:

When specifying dependencies in setup.py or pyproject.toml, the package names are case-insensitive, but the version specifiers are case-sensitive.

https://chat.openai.com/share/464b23d9-515b-4d77-8e27-c82d08c67cce

I don't know why it shows up with the capital letters on pypi.

@BradyAJohnston
Copy link
Contributor Author

I found lots of discussion on the poetry repo (python-poetry/poetry#1538).

It seems to be somewhat unresolved. It is still unclear to me why on pypi it is listed with capitals, but installs as lowercase.

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

Successfully merging this pull request may close these issues.

2 participants