https://python-packaging.readthedocs.io/en/latest/minimal.html



https://towardsdatascience.com/publishing-your-own-python-package-3762f0d268ec

Publishing on PyPI:https://pypi.org is quite simple:

1. Pick a name
2. Create a Github repository with the exact name of your package
3. Create a folder, in that repository, with the exact name of your package; that’s the folder that will hold the package’s code 
4. Put your module, and any other modules it uses, in that inner folder. Add an __init__.py file if one is missing.
5. Import the important objects, usually functions, that users of the package will call directly, from their respective modules into the __init__.py file. These are the functions, classes and variables that will be available under the package namespace. The API of the package, if you will.
6. Not package-specific, but you really should include a .gitignore file in the repository’s root directory, like https://github.com/github/gitignore/blob/master/Python.gitignore
7. Should add a license (create a LICENSE file, see link above)
8. Create a setup.py file using setuptools (see link above)
9. Build a source distribution file and a wheel distribution file (see link above). Need to do python -m pip install wheel
10. Upload package to the global PyPI server. Need to do python -m pip install twine and nano ~/.pypirc and follow link

source env/bin/activate
cd pip_capstone_test
python setup.py sdist bdist_wheel
twine upload dist/*

-----

Do not use "-" in the package name!
Always use from .something instead of from something
Don't run any functions in any files... unless you want them to run when importing xD

To use static files, we need to add a MANIFEST.in at the same level as setup.py with:
include README.md
recursive-include pip_capstone_test/Chapters *
recursive-include pip_capstone_test/Logo *
And then add to setup.py include_package_data=True.

To use these static files in the scripts, just create a script called get_package_path.py:
import pathlib
PACKAGE_PATH = str(pathlib.Path(__file__).parent.absolute()) + "/"
And then in each python script do from .get_package_path import PACKAGE_PATH.
This way, we get the absolute path to the module, and then we can use it to access the static files

-----

Mac:

virtualenv venv -p python3
source venv/bin/activate
python -m pip install PyQt5
python -m pip install matplotlib
python -m pip install pip-capstone-test

python
import pip_capstone_test
pip_capstone_test.run()

-----

Ubuntu:

virtualenv venv -p python3.7
source venv/bin/activate
python -m pip install PyQt5
python -m pip install matplotlib
python -m pip install pip-capstone-test

python
import pip_capstone_test
pip_capstone_test.run()


-----

ssh into new instance
sudo apt-get update
sudo apt install python3-pip

pip3 install pip-capstone-test==0.0.1 --> Failed
python3 -m pip install pip-capstone-test==0.0.1 --> Failed
wget https://files.pythonhosted.org/packages/90/b5/0b6dd79754b24b745ad97c3d1e06db36ebcd3ee553cb47ba96f6d3d4edb9/pip_capstone_test-0.0.1-py3-none-any.whl
pip3 install pip_capstone_test-0.0.1-py3-none-any.whl
Processing ./pip_capstone_test-0.0.1-py3-none-any.whl
pip-capstone-test requires Python '>=3.7' but the running Python is 3.6.9

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.7

python3.7 -m pip install pip-capstone-test
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sgrexbox/PyQt5/
python3.7 -m pip install PyQt5
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sgrexbox/PyQt5/
python3.7 -m pip install --upgrade setuptools
python3.7 -m pip install pip-capstone-test
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-3jwbn2k0/PyQt5/
sudo apt-get install libpcap-dev libpq-dev

sudo apt install python3-pyqt5






