From 8042d0adc4b9ba42872f4a7f9c378bb940d58662 Mon Sep 17 00:00:00 2001 From: Ondrej Lexa Date: Sat, 14 Dec 2024 15:28:36 +0100 Subject: [PATCH] packaging updated --- .github/workflows/pythontest.yml | 7 +-- .github/workflows/release.yml | 31 ++++------ .gitignore | 3 + AUTHORS.md | 9 --- HISTORY.md => CHANGELOG.md | 0 CONTRIBUTING.md | 102 ------------------------------- LICENSE | 3 +- MANIFEST.in | 12 ---- docs/index.rst | 2 +- environment.yml | 21 ------- polylx/__init__.py | 1 + pyproject.toml | 68 +++++++++++++++++++++ setup.py | 74 ---------------------- 13 files changed, 88 insertions(+), 245 deletions(-) delete mode 100644 AUTHORS.md rename HISTORY.md => CHANGELOG.md (100%) delete mode 100644 CONTRIBUTING.md delete mode 100644 MANIFEST.in delete mode 100644 environment.yml create mode 100644 pyproject.toml delete mode 100644 setup.py diff --git a/.github/workflows/pythontest.yml b/.github/workflows/pythontest.yml index 72860b1..91fa7ca 100644 --- a/.github/workflows/pythontest.yml +++ b/.github/workflows/pythontest.yml @@ -1,15 +1,12 @@ name: Python tests on: - # We run CI on pushes to the main branch push: branches: - master - # and on all pull requests to the main branch pull_request: branches: - master - # as well as upon manual triggers through the 'Actions' tab of the Github UI workflow_dispatch: jobs: @@ -19,7 +16,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11", "3.12"] + python-version: ["3.10", "3.11", "3.12"] steps: - name: Checkout repository @@ -35,7 +32,7 @@ jobs: - name: Install Python package run: | - python -m pip install .[tests] + python -m pip install .[dev] - name: Run Python tests run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 070703e..afd26cb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,18 @@ -name: Upload Python Package +name: PyPi Publisher on: + workflow_dispatch: release: - types: [created] + types: [ published ] jobs: - deploy: + pypi-publisher: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.9' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel twine - - name: Build and publish - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_APIKEY }} - run: | - python setup.py sdist bdist_wheel - twine upload dist/* + - uses: thevickypedia/pypi-publisher@v3 + env: + token: ${{ secrets.PYPI_APIKEY }} + with: + python-version: "3.10" + skip-existing: true + diff --git a/.gitignore b/.gitignore index 1edf006..5d23603 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,6 @@ docs/_build #codium .vscode/ + +#venv +.venv/ diff --git a/AUTHORS.md b/AUTHORS.md deleted file mode 100644 index 38a20f1..0000000 --- a/AUTHORS.md +++ /dev/null @@ -1,9 +0,0 @@ -# Credits - -## Development Lead - -* Ondrej Lexa - -## Contributors - -None yet. Why not be the first? diff --git a/HISTORY.md b/CHANGELOG.md similarity index 100% rename from HISTORY.md rename to CHANGELOG.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index b50a8ad..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,102 +0,0 @@ -# Contributing - -Contributions are welcome, and they are greatly appreciated! Every -little bit helps, and credit will always be given. - -You can contribute in many ways: - -## Types of Contributions - -### Report Bugs - -Report bugs at [https://github.com/ondrolexa/polylx/issues](https://github.com/ondrolexa/polylx/issues). - -If you are reporting a bug, please include: - -* Your operating system name and version. -* Any details about your local setup that might be helpful in troubleshooting. -* Detailed steps to reproduce the bug. - -### Fix Bugs - -Look through the GitHub issues for bugs. Anything tagged with "bug" -is open to whoever wants to implement it. - -### Implement Features - -Look through the GitHub issues for features. Anything tagged with "feature" -is open to whoever wants to implement it. - -### Write Documentation - -PolyLX could always use more documentation, whether as part of the -official PolyLX docs, in docstrings, or even on the web in blog posts, -articles, and such. - -### Submit Feedback - -The best way to send feedback is to file an issue at https://github.com/ondrolexa/polylx/issues. - -If you are proposing a feature: - -* Explain in detail how it would work. -* Keep the scope as narrow as possible, to make it easier to implement. -* Remember that this is a volunteer-driven project, and that contributions - are welcome :) - -## Get Started! - -Ready to contribute? Here's how to set up `polylx` for local development. - -1. Fork the `polylx` repo on GitHub. -2. Clone your fork locally with SSH or HTTPS. -``` - $ git clone git@github.com:your_name_here/polylx.git -``` -3. Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your fork for local development -``` - $ mkvirtualenv polylx - $ cd polylx/ - $ python setup.py develop -``` -4. Create a branch for local development -``` - $ git checkout -b name-of-your-bugfix-or-feature -``` - Now you can make your changes locally. - -5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox -``` - $ flake8 polylx tests - $ python setup.py test - $ tox -``` - -6. Commit your changes and push your branch to GitHub. -``` - $ git add . - $ git commit -m "Your detailed description of your changes." - $ git push origin name-of-your-bugfix-or-feature -``` -7. Submit a pull request through the GitHub website. - -## Pull Request Guidelines - -Before you submit a pull request, check that it meets these guidelines: - -1. The pull request should include tests. -2. If the pull request adds functionality, the docs should be updated. Put - your new functionality into a function with a docstring, and add the - feature to the list in ``README.md``. -3. The pull request should work for Python 2.7, 3.5, and 3.6. Check - [https://travis-ci.org/ondrolexa/polylx/pull_requests](https://travis-ci.org/ondrolexa/polylx/pull_requests) - and make sure that the tests pass for all supported Python versions. - -Tips ----- - -To run a subset of tests:: -``` - $ python -m unittest discover -v -``` - diff --git a/LICENSE b/LICENSE index eb0e20d..92489c8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -PolyLX - python package to visualize and analyze digitized 2D microstructures +Copyright (c) 2024 Ondrej Lexa Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -19,3 +19,4 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index eee10a8..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,12 +0,0 @@ -include AUTHORS.rst -include CONTRIBUTING.rst -include HISTORY.rst -include LICENSE -include README.rst - -recursive-include tests * -recursive-exclude * __pycache__ -recursive-exclude * *.py[co] - -recursive-include docs *.rst conf.py Makefile make.bat -recursive-include polylx/example *.* diff --git a/docs/index.rst b/docs/index.rst index 8b77183..536494e 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,4 +15,4 @@ Contents: tutorial automodules -.. mdinclude:: ../HISTORY.md +.. mdinclude:: ../CHANGELOG.md diff --git a/environment.yml b/environment.yml deleted file mode 100644 index acd3e12..0000000 --- a/environment.yml +++ /dev/null @@ -1,21 +0,0 @@ -# run: conda env create --file environment.yml -name: polylx -channels: - - conda-forge - - nodefaults -dependencies: - - python>=3.9 - - numpy - - matplotlib - - scipy - - pandas - - pyarrow - - seaborn - - networkx - - shapely>=2 - - pyshp - - fiona - - jupyterlab - - pyefd - - jenkspy - - shapelysmooth diff --git a/polylx/__init__.py b/polylx/__init__.py index 357a53c..2eea990 100644 --- a/polylx/__init__.py +++ b/polylx/__init__.py @@ -8,6 +8,7 @@ from .core import Grain, Boundary, Grains, Boundaries, Sample, Fractnet from .utils import deg, circular, ortensor +__version__ = "0.5.5" __author__ = "Ondrej Lexa" __email__ = "lexa.ondrej@gmail.com" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..87f2b09 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,68 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + + +[project] +name = "polylx" +dynamic = ["version"] +description = "A Python package to visualize and analyze microstructures" +readme = "README.md" +requires-python = ">=3.10" +license = { file = "LICENSE" } +keywords = ["geology", "microstructures"] +authors = [{ name = "Ondrej Lexa", email = "lexa.ondrej@gmail.com" }] +maintainers = [ + { name = "Ondrej Lexa", email = "lexa.ondrej@gmail.com" }, +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", +] +dependencies = [ + "numpy", + "matplotlib", + "pandas", + "pyarrow", + "seaborn", + "networkx", + "scipy", + "shapely", + "pyshp", + "pyefd", + "jenkspy", + "shapelysmooth", +] + +[project.optional-dependencies] +docs = [ + "sphinx", + "sphinx_mdinclude", + "sphinx_rtd_theme", + "ipykernel", + "nbsphinx", + "nbsphinx-link" +] +dev = [ + "pytest", + "pytest-cov", + "nbval", + "black" +] +jupyter = ["jupyterlab"] + +[project.urls] +Homepage = "https://github.com/ondrolexa/polylx" +Documentation = "https://polylx.readthedocs.io/" +Repository = "https://github.com/ondrolexa/polylx.git" +Issues = "https://github.com/ondrolexa/polylx/issues" +Changelog = "https://github.com/ondrolexa/polylx/blob/master/HISTORY.md" + +[project.scripts] +ipolylx = "polylx.shell:main" + +[tool.hatch.version] +path = "polylx/__init__.py" diff --git a/setup.py b/setup.py deleted file mode 100644 index 6b9e20d..0000000 --- a/setup.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -from os import path -from setuptools import setup, find_packages - -CURRENT_PATH = path.abspath(path.dirname(__file__)) - -with open(path.join(CURRENT_PATH, "README.md")) as f: - readme = f.read() - -with open(path.join(CURRENT_PATH, "HISTORY.md")) as f: - history = f.read() - -setup( - name="polylx", - version="0.5.5", - description="A Python package to visualize and analyze microstructures.", - long_description=readme + "\n\n" + history, - long_description_content_type="text/markdown", - author="Ondrej Lexa", - author_email="lexa.ondrej@gmail.com", - url="https://github.com/ondrolexa/polylx", - packages=find_packages(), - package_data={"polylx": ["example/*.*"]}, - include_package_data=True, - install_requires=[ - "numpy", - "matplotlib", - "pandas", - "pyarrow", - "seaborn", - "networkx", - "scipy", - "shapely", - "pyshp", - "pyefd", - "jenkspy", - "shapelysmooth", - ], - extras_require={ - "docs": [ - "sphinx", - "sphinx_mdinclude", - "sphinx_rtd_theme", - "ipykernel", - "nbsphinx", - "nbsphinx-link", - ], - "tests": ["pytest", "pytest-cov", "nbval"], - "lint": ["black"], - "jupyter": ["jupyterlab"], - }, - entry_points=""" - [console_scripts] - ipolylx=polylx.shell:main - """, - license="MIT", - zip_safe=False, - keywords="polylx", - python_requires=">=3.9", - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Programming Language :: Python :: 3", - ], - project_urls={ - "Documentation": "https://polylx.readthedocs.io/", - "Source Code": "https://github.com/ondrolexa/polylx/", - "Bug Tracker": "https://github.com/ondrolexa/polylx/issues/", - }, -)