-
Notifications
You must be signed in to change notification settings - Fork 6
Generate package
This project are using the PEP 517 approach, using setup.cfg and pyproject.toml files.
So, for create a .whl (Wheel) and tar.gz files, enter on this repository folder and run the command below:
python -m build --sdist --wheel .After that, will be generated a folder called dist with the files: surface_reconstruction-0.1.1.dev1-py3-none-any.whl and surface_reconstruction-0.1.1.dev1-tar.gz. These files may contains the suffix dirty, if your current branch contains uncommitted changes.
The folder structure would be something like this:
./surface_reconstruction_python
|
|-dist
|-surface_reconstruction-0.1.1.dev1+dirty.tar.gz
|-surface_reconstruction-0.1.1.dev1+dirty-py3-none-any.whlTip 1: The version of these files are generated from the last local git tag, and increment +1. A file
version.pyis generated with this as well
Tip 2: The suffix
devis added only if your git tag is some commits behind your current branch. For more information, see: setuptools-scm versioning scheme
Install from the .whl generated file
pip install dist/surface_reconstruction-x.x.x.whlOptionally you can install from the .tar.gz source as well
pip install dist/surface_reconstruction-x.x.x.tar.gzFirst, publish to https://test.pypi.org and verify if everything is ok with this package:
- Register a account in https://test.pypi.org and create a new token. Copy this token and paste in a file
$HOME/.pypircwith something like this:
# Test: test.pypi.org
[testpypi]
username = __token__
password = pypi-[your-token-here]- Publish to test.pypi.org with twine
# Install "twine" package if is not installed
pip install twine
# Publish the .tar.gz and .whl files. Use the "testpypi" defined in .pypirc file
twine upload --repository testpypi dist/*- Now, you can test
pip installfrom the command line:
pip install --index-url https://test.pypi.org/simple surface_reconstructionDo the same commands above, and just remove the --repository-url argument. By default, twine uploads to https://pypi.org. When you execute pip install, just remove --index-url argument as well. Make sure that you added the token to .pypirc too:
[pypi]
username = __token__
password = pypi-[your-token-here]# Publish the .tar.gz and .whl files. The "pypi" remote repository will be used by default
twine upload dist/*pip install surface_reconstructionif everything is all right, your package is installed in your local python environment and you can import and use it 😃