From 9d2a86d75fcecf9d648ab7467d0cc9d7b8582378 Mon Sep 17 00:00:00 2001 From: Qiusheng Wu Date: Fri, 20 Sep 2024 11:24:18 -0400 Subject: [PATCH] Change setup.py to pyproject.toml (#56) * Change setup.py to pyproject.toml * Update pypi * Update to py312 --- .github/workflows/docs.yml | 2 +- .github/workflows/macos.yml | 2 +- .github/workflows/pypi.yml | 3 +- .github/workflows/ubuntu.yml | 2 +- .github/workflows/windows.yml | 2 +- .pre-commit-config.yaml | 7 ---- pyproject.toml | 66 +++++++++++++++++++++++++++++++++++ setup.cfg | 20 ----------- setup.py | 56 ----------------------------- 9 files changed, 72 insertions(+), 88 deletions(-) create mode 100644 pyproject.toml delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index fe55534..79859aa 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -10,7 +10,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: - python-version: "3.11" + python-version: "3.12" - name: Install GDAL run: | python -m pip install --upgrade pip diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 887ea26..f0a612d 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: ["macOS-latest"] - python-version: ["3.11"] + python-version: ["3.12"] steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index fe0f813..333cc8b 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -23,5 +23,6 @@ jobs: TWINE_USERNAME: ${{ secrets.PYPI_USERS }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | - python setup.py sdist bdist_wheel + pip install build + python -m build twine upload dist/* diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 581ea53..5727cbd 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - name: Set up Python diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index b9bd76a..e173c19 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,7 +16,7 @@ jobs: uses: conda-incubator/setup-miniconda@v3 with: auto-activate-base: true - python-version: "3.11" + python-version: "3.12" - name: Install GDAL run: | conda install -c conda-forge gdal --yes diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ca6d2f..dc959b4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,13 +15,6 @@ repos: rev: 24.8.0 hooks: - id: black-jupyter - language_version: python3.11 - - # - repo: https://github.com/codespell-project/codespell - # rev: v2.2.6 - # hooks: - # - id: codespell - # args: [--toml, pyproject-codespell.precommit-toml] - repo: https://github.com/kynan/nbstripout rev: 0.7.1 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..980bf5e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,66 @@ +[build-system] +requires = ["setuptools>=64", "setuptools_scm>=8"] +build-backend = "setuptools.build_meta" + +[project] +name = "geospatial" +version = "0.10.4" +dynamic = [ + "dependencies", +] +description = "A Python package for installing commonly used packages for geospatial analysis and data visualization with only one command." +readme = "README.md" +requires-python = ">=3.8" +license = {text = "MIT license"} +keywords = ["geospatial"] +classifiers = [ + "Development Status :: 2 - Pre-Alpha", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +authors = [{name = "Qiusheng Wu", email = "giswqs@gmail.com"}] + +[tool] +[tool.setuptools.packages.find] +include = ["geospatial*"] +exclude = ["docs*"] + + +[tool.setuptools.dynamic] +dependencies = {file = ["requirements.txt"]} + +[tool.distutils.bdist_wheel] +universal = true + +[tool.bumpversion] +current_version = "0.10.4" +commit = true +tag = true + +[[tool.bumpversion.files]] +filename = "pyproject.toml" +search = 'version = "{current_version}"' +replace = 'version = "{new_version}"' + +[[tool.bumpversion.files]] +filename = "geospatial/__init__.py" +search = '__version__ = "{current_version}"' +replace = '__version__ = "{new_version}"' + +[tool.flake8] +exclude = [ + "docs", +] +max-line-length = 88 + +[tool.setuptools_scm] + +[project.urls] +Homepage = "https://github.com/opengeos/geospatial" \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 480e33d..0000000 --- a/setup.cfg +++ /dev/null @@ -1,20 +0,0 @@ -[bumpversion] -current_version = 0.10.4 -commit = True -tag = True - -[bumpversion:file:setup.py] -search = version="{current_version}" -replace = version="{new_version}" - -[bumpversion:file:geospatial/__init__.py] -search = __version__ = "{current_version}" -replace = __version__ = "{new_version}" - -[bdist_wheel] -universal = 1 - -[flake8] -exclude = docs - -[aliases] diff --git a/setup.py b/setup.py deleted file mode 100644 index ea314cb..0000000 --- a/setup.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -"""The setup script.""" - -import io -from os import path as op -from setuptools import setup, find_packages - -with open("README.md") as readme_file: - readme = readme_file.read() - -here = op.abspath(op.dirname(__file__)) - -# get the dependencies and installs -with io.open(op.join(here, "requirements.txt"), encoding="utf-8") as f: - all_reqs = f.read().split("\n") - -install_requires = [x.strip() for x in all_reqs if "git+" not in x] -dependency_links = [x.strip().replace("git+", "") for x in all_reqs if "git+" not in x] - -requirements = [] - -setup_requirements = [] - -test_requirements = [] - -setup( - author="Qiusheng Wu", - author_email="giswqs@gmail.com", - python_requires=">=3.8", - classifiers=[ - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "Natural Language :: English", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - description="A Python package for installing commonly used packages for geospatial analysis and data visualization with only one command.", - install_requires=install_requires, - dependency_links=dependency_links, - license="MIT license", - long_description=readme, - long_description_content_type="text/markdown", - include_package_data=True, - keywords="geospatial", - name="geospatial", - packages=find_packages(include=["geospatial", "geospatial.*"]), - setup_requires=setup_requirements, - test_suite="tests", - tests_require=test_requirements, - url="https://github.com/opengeos/geospatial", - version="0.10.4", - zip_safe=False, -)