-
Notifications
You must be signed in to change notification settings - Fork 480
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAINT: Use pyproject and setuptools_scm (#2523)
* MAINT: Use pyproject and setuptools_scm * FIX: Name * FIX: Better * FIX: Better * FIX: Better * FIX: Ver * Update .github/workflows/codespell-private.yml Co-authored-by: Peter Newman <peternewman@users.noreply.github.com> Co-authored-by: Peter Newman <peternewman@users.noreply.github.com>
- Loading branch information
1 parent
3f06fb0
commit 754b9a5
Showing
8 changed files
with
142 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Upload a Python Package using Twine when a release is created | ||
|
||
name: Build | ||
on: | ||
release: | ||
types: [published] | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
package: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build twine | ||
- name: Build package | ||
run: python -m build | ||
- name: Check package | ||
run: twine check --strict dist/* | ||
- name: Check env vars | ||
run: | | ||
echo "Triggered by: ${{ github.event_name }}" | ||
# PyPI on release | ||
pypi: | ||
needs: package | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' | ||
steps: | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|
||
# TestPyPI on push | ||
test_pypi: | ||
needs: package | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
steps: | ||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.TESTPYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ codespell.egg-info | |
*.orig | ||
.cache/ | ||
.pytest_cache/ | ||
codespell_lib/_version.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
from ._codespell import main, _script_main, VERSION as __version__ # noqa | ||
from ._codespell import main, _script_main # noqa | ||
from ._version import __version__ # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# https://setuptools.pypa.io/en/latest/userguide/pyproject_config.html | ||
|
||
[project] | ||
name = "codespell" | ||
description = "Codespell" | ||
readme = { file = "README.rst", content-type = "text/x-rst" } | ||
requires-python = ">=3.7" | ||
license = {text = "GPL v2"} | ||
authors = [ | ||
{name = "Lucas De Marchi", email = "lucas.de.marchi@gmail.com"}, | ||
] | ||
classifiers = [ | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved", | ||
"Programming Language :: Python", | ||
"Topic :: Software Development", | ||
"Operating System :: Microsoft :: Windows", | ||
"Operating System :: POSIX", | ||
"Operating System :: Unix", | ||
"Operating System :: MacOS" | ||
] | ||
dependencies = [] | ||
dynamic = ["version"] | ||
|
||
[project.optional-dependencies] | ||
dev = [ | ||
"check-manifest", | ||
"flake8", | ||
"pytest", | ||
"pytest-cov", | ||
"pytest-dependency", | ||
"tomli" | ||
] | ||
hard-encoding-detection = [ | ||
"chardet" | ||
] | ||
toml = [ | ||
"tomli; python_version < '3.11'" | ||
] | ||
|
||
[project.scripts] | ||
codespell = "codespell_lib:_script_main" | ||
|
||
[project.urls] | ||
homepage = "https://github.com/codespell-project/codespell" | ||
repository = "https://github.com/codespell-project/codespell" | ||
|
||
[build-system] | ||
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2", "wheel"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[tool.setuptools_scm] | ||
write_to = "codespell_lib/_version.py" | ||
|
||
[tool.setuptools.packages.find] | ||
exclude = [ | ||
"snap", | ||
"dist" | ||
] | ||
|
||
[tool.setuptools.package-data] | ||
codespell_lib = [ | ||
"data/dictionary*.txt", | ||
"data/linux-kernel.exclude" | ||
] | ||
|
||
[tool.check-manifest] | ||
ignore = ["codespell_lib/_version.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,6 @@ | ||
#! /usr/bin/env python | ||
|
||
# adapted from mne-python | ||
|
||
import os | ||
|
||
from setuptools import setup | ||
|
||
from codespell_lib import __version__ | ||
|
||
DISTNAME = 'codespell' | ||
DESCRIPTION = """Codespell""" | ||
MAINTAINER = 'Lucas De Marchi' | ||
MAINTAINER_EMAIL = 'lucas.de.marchi@gmail.com' | ||
URL = 'https://github.com/codespell-project/codespell/' | ||
LICENSE = 'GPL v2' | ||
DOWNLOAD_URL = 'https://github.com/codespell-project/codespell/' | ||
with open('README.rst', 'r') as f: | ||
LONG_DESCRIPTION = f.read() | ||
|
||
if __name__ == "__main__": | ||
if os.path.exists('MANIFEST'): | ||
os.remove('MANIFEST') | ||
|
||
setup(name=DISTNAME, | ||
maintainer=MAINTAINER, | ||
include_package_data=True, | ||
maintainer_email=MAINTAINER_EMAIL, | ||
description=DESCRIPTION, | ||
license=LICENSE, | ||
url=URL, | ||
version=__version__, | ||
download_url=DOWNLOAD_URL, | ||
long_description=LONG_DESCRIPTION, | ||
long_description_content_type='text/x-rst', | ||
zip_safe=False, | ||
classifiers=['Intended Audience :: Developers', | ||
'License :: OSI Approved', | ||
'Programming Language :: Python', | ||
'Topic :: Software Development', | ||
'Operating System :: Microsoft :: Windows', | ||
'Operating System :: POSIX', | ||
'Operating System :: Unix', | ||
'Operating System :: MacOS'], | ||
platforms='any', | ||
python_requires='>=3.7', | ||
packages=[ | ||
'codespell_lib', | ||
'codespell_lib.tests', | ||
'codespell_lib.data', | ||
], | ||
package_data={'codespell_lib': [ | ||
os.path.join('data', 'dictionary*.txt'), | ||
os.path.join('data', 'linux-kernel.exclude'), | ||
]}, | ||
entry_points={ | ||
'console_scripts': [ | ||
'codespell = codespell_lib:_script_main' | ||
], | ||
}, | ||
# TODO: toml will need to be updated when 3.11 comes out as it's a | ||
# CPython module there | ||
extras_require={ | ||
"dev": ["check-manifest", "flake8", "pytest", "pytest-cov", | ||
"pytest-dependency", "tomli"], | ||
"hard-encoding-detection": ["chardet"], | ||
"toml": ["tomli"], | ||
} | ||
) | ||
setup() |