diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9f5631d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,47 @@ +# This workflows runs when a tagged release is created or it is triggered manually. +# For more information see: +# - Python docs: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +# - GitHub action: https://github.com/marketplace/actions/pypi-publish +# - GitHub docs: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries +# The source distribution (sdist) is built with the `build` package +# (https://pypa-build.readthedocs.io/en/stable/index.html). +# The sdist is uploaded to: +# - TestPyPI whenever the workflow is run +# - PyPI when the current commit is tagged + +name: Upload to PyPI + +on: + release: + types: [published] + workflow_dispatch: + workflow: "*" + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build + - name: Build package + run: | + python -m build + - name: Publish package to TestPyPI + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + repository_url: https://test.pypi.org/legacy/ + - name: Publish package to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7bea054..990c0a0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ report.log # Python **/__pycache__ *.egg-info +dist/ # Jupyter **.ipynb_checkpoints diff --git a/README.md b/README.md index 242cc21..eac3d24 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,27 @@ available at https://pyebsdindex.readthedocs.io. ## Installation -The package can only be installed from source at the moment. There is an issue with -installing `pyopencl` from `pip` on Windows, so this has to be installed from `conda` -before installing `PyEBSDIndex`: +The package can be installed from the +[Python Package Index](https://pypi.org/project/pyebsdindex) (`pip`) or from source on +all operating systems: + +```bash +pip install pyebsdindex +``` + +Installing with optional GPU support via `pyopencl`: + +```bash +pip install pyebsdindex[gpu] +``` + +Please refer to the [pyopencl](https://documen.tician.de/pyopencl/misc.html) +installation documentation in case installation fails. + +Installing the package from source with optional dependencies for running tests ```bash -conda install pyopencl --channel conda-forge # Only required on Windows git clone https://github.com/USNavalResearchLaboratory/PyEBSDIndex cd PyEBSDIndex -pip install --editable . +pip install --editable .[tests] ``` \ No newline at end of file diff --git a/pyebsdindex/__init__.py b/pyebsdindex/__init__.py index 30f4b19..cd533af 100644 --- a/pyebsdindex/__init__.py +++ b/pyebsdindex/__init__.py @@ -1,7 +1,7 @@ __author__ = "Dave Rowenhorst" __author_email__ = "" # Initial committer first, then sorted by line contributions -__credits__ = ["Dave Rowenhorst"] +__credits__ = "Dave Rowenhorst" __description__ = "Python based tool for Hough/Radon based EBSD indexing" __name__ = "pyebsdindex" -__version__ = "0.1.dev0" +__version__ = "0.1rc1" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..80e1534 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +license_files = License \ No newline at end of file diff --git a/setup.py b/setup.py index 94cc29d..6c5177c 100644 --- a/setup.py +++ b/setup.py @@ -33,13 +33,15 @@ license="Custom", python_requires=">=3.8", description=__description__, + long_description=open("README.md", encoding="utf-8").read(), + long_description_content_type="text/markdown", classifiers=[ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Development Status :: 4 - Beta", "Intended Audience :: Science/Research", - "License :: Custom", + "License :: Other/Proprietary License", "Natural Language :: English", "Operating System :: OS Independent", "Topic :: Scientific/Engineering", @@ -54,7 +56,7 @@ zip_safe=True, # Contact author=__credits__, - download_url="https://github.com/USNavalResearchLaboratory/PyEBSDIndex", + download_url="https://pypi.python.org/pypi/pyebsdindex", maintainer=__author__, maintainer_email=__author_email__, project_urls={ @@ -62,6 +64,7 @@ "Documentation": "https://pyebsdindex.readthedocs.io", "Source Code": "https://github.com/USNavalResearchLaboratory/PyEBSDIndex", }, + url="https://pyebsdindex.readthedocs.io", # Dependencies extras_require=extra_feature_requirements, install_requires=[ @@ -70,8 +73,6 @@ "matplotlib", "numpy", "numba", - #"ocl_icd_wrapper_apple;sys_platform == 'darwin'", - #"ocl-icd-system;sys_platform == 'linux'", "pyswarms", "ray[default]", "scipy", @@ -81,7 +82,10 @@ package_dir={"pyebsdindex": "pyebsdindex"}, include_package_data=True, package_data={ - "": ["License", "README.md"], - "pyebsdindex": ["*.py", "*.cl"], + "pyebsdindex": [ + "*.py", + "*.cl", + "tests/data/al_sim_20kv/al_sim_20kv.png", + ], }, )