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

Make the library pip-installable #27

Open
aivarannamaa opened this issue Sep 1, 2017 · 7 comments
Open

Make the library pip-installable #27

aivarannamaa opened this issue Sep 1, 2017 · 7 comments

Comments

@aivarannamaa
Copy link

aivarannamaa commented Sep 1, 2017

Thank you for this work!

I want to propose an alternative, Python-centric, way for installing the plugin and the Python library. For users who have Python already installed, this approach could could feel more natural, than current approach.

Once the user has Minecraft and Forge set up, she runs pip install raspberryjam, which dowloads and installs the Python library into current interpreter or virtual environment (instead of .minecraft directory). After this she would execute following commands to download and install the mod:

import raspberryjam
raspberryjam.installMod()

It would be also nice, if the mod allowed specifying the scripts directory for \py game command (so that the user doesn't need to deal with a hidden folder deep under). This could be done either from the mod Config view in Minecraft (which currently crashes the game (1.12)), or by:

import raspberryjam
raspberryjam.setScriptDirectory("C:/Users/Aivar/Minecraft")

(BTW, does \py command currently allow anything else beside running a script in certain directory?)

If you like this proposal but don't have time for implementing it, then I could create the first prototype myself. (You only need to instruct me how to change the script lookup policy inside the mod.)

@aivarannamaa
Copy link
Author

Looks like it's possible even to install the mod during pip install: https://stackoverflow.com/questions/20288711/post-install-script-with-python-setuptools

@aivarannamaa
Copy link
Author

One may think that pip is too difficult for young beginners to use, but Thonny (http://thonny.org) makes it trivial: http://thonny.org/blog/2017/05/02/version_2_1_0.html

@arpruss
Copy link
Owner

arpruss commented Sep 3, 2017

I don' t know how to make a pip package. :-(

@aivarannamaa
Copy link
Author

aivarannamaa commented Sep 3, 2017

I made necessary files for creating a pip package: aivarannamaa@4f913a3

At the moment it cares only about mine module and mcpi package (all demo scripts are ignored).

To create the package in whl format you should change into mcpipy and run

python setup.py bdist_wheel

(you may need to do pip install wheel first). This should create a whl file in dist subfolder. It is actually a zip file so you can easily check its content.

I also made a trial PyPI entry: https://pypi.python.org/pypi/raspberryjammod
I can later transfer the permissions to you (or delete it if you want to use another name). I had to increase the version number, because I made a mistake in initial upload and PyPI doesn't let you to change a version once it is uploaded.

You can test it by pip install raspberryjammod. I tested it myself with Python 3.6, but it should be also 2.7-compatible.

I added a convenience function for installing the mod:

from raspberryjammod import install
install()

or

> python -m raspberryjammod install

If you like it, then I can create a pulll-request.

@arpruss
Copy link
Owner

arpruss commented Sep 3, 2017

This is very kind of you, but I am not sure I want to upload something to another location each time I do a release.

And the licensing is weird, too: my stuff is MIT license, but the Mojang API files are under a "do anything other than evil" license which is not compatible with standard open source licenses (not that I want anybody doing evil!).

@aivarannamaa
Copy link
Author

You can easily script the uploading just by replacing python setup.py bdist_wheel with python setup.py bdist_wheel upload. You can create .pypirc file to avoid typing passwords for uploading: https://docs.python.org/3.6/distutils/packageindex.html#the-pypirc-file

If you still decide to skip pypi support, do you don't mind if I keep https://pypi.python.org/pypi/raspberryjammod and use this with my students?

@arpruss
Copy link
Owner

arpruss commented Nov 28, 2017

You are certainly free to keep and maintain the pip package as you wish.

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

No branches or pull requests

2 participants