Skip to content

Commit a69d0fb

Browse files
Migrate packaging metadata to pyproject and add matrix package checks
1 parent 6108983 commit a69d0fb

5 files changed

Lines changed: 58 additions & 184 deletions

File tree

.github/workflows/build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ jobs:
7474
run: python tests.py
7575

7676
build4-Packaging-check:
77-
runs-on: ubuntu-24.04
77+
strategy:
78+
fail-fast: false
79+
matrix:
80+
os: ['ubuntu-24.04', 'windows-latest', 'macos-latest']
81+
runs-on: ${{ matrix.os }}
7882

7983
steps:
8084
- uses: actions/checkout@v5
@@ -89,5 +93,6 @@ jobs:
8993
python -m build
9094
- name: Install wheel and verify CLI entry points
9195
run: |
92-
python -m pip install dist/*.whl
93-
gff3_sort -h
96+
python -c "import glob,subprocess,sys; wheels=glob.glob('dist/*.whl'); assert wheels, 'No wheel built'; subprocess.check_call([sys.executable, '-m', 'pip', 'install', wheels[0]])"
97+
python -m gff3tool.bin.gff3_sort -h
98+
python -c "import shutil,sys; sys.exit(0 if shutil.which('gff3_sort') else 1)"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The [GFF3 format](https://github.com/The-Sequence-Ontology/Specifications/blob/m
1313

1414
## Prerequisite
1515

16-
* Python 3.x
16+
* Python 3.9+
1717
* [wheel](https://pythonwheels.com/) (should have been installed for most python distributions, if you don't have, use `pip install wheel` to install it.)
1818
* Perl
1919

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
11
[build-system]
22
requires = ["setuptools>=68", "wheel"]
33
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "gff3tool"
7+
description = "Python programs for processing GFF3 files"
8+
readme = "README.md"
9+
requires-python = ">=3.9"
10+
license = { text = "Public Domain" }
11+
authors = [
12+
{ name = "NAL i5k workspace", email = "i5k@ars.usda.gov" }
13+
]
14+
keywords = ["gff3", "gff", "bioinformatics"]
15+
classifiers = [
16+
"Development Status :: 5 - Production/Stable",
17+
"Operating System :: POSIX :: Linux",
18+
"Operating System :: Microsoft :: Windows",
19+
"Operating System :: MacOS :: MacOS X",
20+
"Intended Audience :: Science/Research",
21+
"Topic :: Scientific/Engineering :: Bio-Informatics",
22+
"License :: Public Domain",
23+
"Programming Language :: Python :: 3",
24+
]
25+
dynamic = ["version"]
26+
27+
[project.urls]
28+
Homepage = "https://github.com/NAL-i5K/GFF3toolkit"
29+
"Bug Reports" = "https://github.com/NAL-i5K/GFF3toolkit/issues"
30+
Source = "https://github.com/NAL-i5K/GFF3toolkit"
31+
32+
[project.scripts]
33+
gff3_fix = "gff3tool.bin.gff3_fix:script_main"
34+
gff3_merge = "gff3tool.bin.gff3_merge:script_main"
35+
gff3_QC = "gff3tool.bin.gff3_QC:script_main"
36+
gff3_sort = "gff3tool.bin.gff3_sort:script_main"
37+
gff3_to_fasta = "gff3tool.bin.gff3_to_fasta:script_main"
38+
39+
[tool.setuptools.dynamic]
40+
version = { attr = "gff3tool.bin.version.__version__" }
41+
42+
[tool.setuptools]
43+
include-package-data = true
44+
45+
[tool.setuptools.packages.find]
46+
exclude = ["contrib", "docs", "tests", "tests.*"]

setup.cfg

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[sdist]
2-
dist-dir=dist
2+
dist_dir=dist
33

44
[metadata]
5-
description-file = README.md
6-
long-description-content-type = text/markdown
5+
description_file = README.md
6+
long_description_content_type = text/markdown

setup.py

Lines changed: 3 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
"""A setuptools based setup module.
1+
"""Compatibility setup.py that keeps custom BLAST bundling hooks."""
22

3-
See:
4-
https://packaging.python.org/en/latest/distributing.html
5-
https://github.com/pypa/sampleproject
6-
"""
7-
# Always prefer setuptools over distutils
83
from setuptools import setup, find_packages
94
from distutils.command.build import build
10-
# To use a consistent encoding
11-
from codecs import open
125
from os import path, remove, mkdir
136
import platform
147
import shutil
@@ -68,185 +61,18 @@ def bundle_blast(project_root, version):
6861
class bdist_wheel(_bdist_wheel):
6962
def finalize_options(self):
7063
_bdist_wheel.finalize_options(self)
71-
# Mark us as not a pure python package
7264
self.root_is_pure = False
7365

7466
class CustomBuildCommand(build):
7567
def run(self):
7668
bundle_blast(here, BLAST_VERSION)
7769
super(CustomBuildCommand, self).run()
7870

79-
# Get the long description from the README file
80-
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
81-
long_description = f.read()
82-
83-
version = {}
84-
with open(path.join(here, 'gff3tool', 'bin', 'version.py')) as fp:
85-
exec (fp.read(), version)
86-
87-
# Arguments marked as "Required" below must be included for upload to PyPI.
88-
# Fields marked as "Optional" may be commented out.
8971
setup(
90-
# This is the name of your project. The first time you publish this
91-
# package, this name will be registered for you. It will determine how
92-
# users can install this project, e.g.:
93-
#
94-
# $ pip install bcinfo
95-
#
96-
# And where it will live on PyPI: https://pypi.org/project/bcinfo/
97-
#
98-
# There are some restrictions on what makes a valid project name
99-
# specification here:
100-
# https://packaging.python.org/specifications/core-metadata/#name
101-
name='gff3tool', # Required
102-
103-
# Versions should comply with PEP 440:
104-
# https://www.python.org/dev/peps/pep-0440/
105-
#
106-
# For a discussion on single-sourcing the version across setup.py and the
107-
# project code, see
108-
# https://packaging.python.org/en/latest/single_source_version.html
109-
version=version['__version__'], # Required
110-
111-
# This is a one-line description or tagline of what your project does. This
112-
# corresponds to the "Summary" metadata field:
113-
# https://packaging.python.org/specifications/core-metadata/#summary
114-
description='Python programs for processing GFF3 files', # Required
115-
116-
# This is an optional longer description of your project that represents
117-
# the body of text which users will see when they visit PyPI.
118-
#
119-
# Often, this is the same as your README, so you can just read it in from
120-
# that file directly (as we have already done above)
121-
#
122-
# This field corresponds to the "Description" metadata field:
123-
# https://packaging.python.org/specifications/core-metadata/#description-optional
124-
long_description=long_description, # Optional
125-
long_description_content_type='text/markdown',
126-
# This should be a valid link to your project's main homepage.
127-
#
128-
# This field corresponds to the "Home-Page" metadata field:
129-
# https://packaging.python.org/specifications/core-metadata/#home-page-optional
130-
url='https://github.com/NAL-i5K/GFF3toolkit', # Optional
131-
132-
# This should be your name or the name of the organization which owns the
133-
# project.
134-
author='NAL i5k workspace', # Optional
135-
136-
# This should be a valid email address corresponding to the author listed
137-
# above.
138-
author_email='i5k@ars.usda.gov', # Optional
139-
140-
# Classifiers help users find your project by categorizing it.
141-
#
142-
# For a list of valid classifiers, see
143-
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
144-
classifiers=[ # Optional
145-
# How mature is this project? Common values are
146-
# 3 - Alpha
147-
# 4 - Beta
148-
# 5 - Production/Stable
149-
'Development Status :: 5 - Production/Stable',
150-
'Operating System :: POSIX :: Linux',
151-
'Operating System :: Microsoft :: Windows',
152-
'Operating System :: MacOS :: MacOS X',
153-
# Indicate who your project is intended for
154-
'Intended Audience :: Science/Research',
155-
'Topic :: Scientific/Engineering :: Bio-Informatics',
156-
# Pick your license as you wish
157-
'License :: Public Domain',
158-
# Specify the Python versions you support here. In particular, ensure
159-
# that you indicate whether you support Python 2, Python 3 or both.
160-
'Programming Language :: Python :: 3',
161-
],
162-
163-
# This field adds keywords for your project which will appear on the
164-
# project page. What does your project relate to?
165-
#
166-
# Note that this is a string of words separated by whitespace, not a list.
167-
keywords='gff3 gff bioinformatics ', # Optional
168-
169-
# Explicitly declare supported runtime versions for installers and tools.
170-
python_requires='>=3.9',
171-
172-
# You can just specify package directories manually here if your project is
173-
# simple. Or you can use find_packages().
174-
#
175-
# Alternatively, if you just want to distribute a single Python file, use
176-
# the `py_modules` argument instead as follows, which will expect a file
177-
# called `my_module.py` to exist:
178-
#
179-
# py_modules=["my_module"],
180-
#
181-
packages=find_packages(exclude=['contrib', 'docs', 'tests']), # Required
182-
18372
cmdclass={
18473
'build': CustomBuildCommand,
18574
'bdist_wheel': bdist_wheel
18675
},
187-
188-
# This field lists other packages that your project depends on to run.
189-
# Any package you put here will be installed by pip when your project is
190-
# installed, so they must be valid existing projects.
191-
#
192-
# For an analysis of "install_requires" vs pip's requirements files see:
193-
# https://packaging.python.org/en/latest/requirements.html
194-
install_requires=[], # Optional
195-
196-
# List additional groups of dependencies here (e.g. development
197-
# dependencies). Users will be able to install these using the "extras"
198-
# syntax, for example:
199-
#
200-
# $ pip install sampleproject[dev]
201-
#
202-
# Similar to `install_requires` above, these must be valid existing
203-
# projects.
204-
extras_require={ # Optional
205-
},
206-
207-
# If there are data files included in your packages that need to be
208-
# installed, specify them here.
209-
#
210-
# If using Python 2.6 or earlier, then these have to be included in
211-
# MANIFEST.in as well.
212-
package_data={ # Optional
213-
},
214-
215-
# Although 'package_data' is the preferred approach, in some case you may
216-
# need to place data files outside of your packages. See:
217-
# http://docs.python.org/3.4/distutils/setupscript.html#installing-additional-files
218-
#
219-
# In this case, 'data_file' will be installed into '<sys.prefix>/my_data'
220-
data_files=[], # Optional
221-
222-
# To provide executable scripts, use entry points in preference to the
223-
# "scripts" keyword. Entry points provide cross-platform support and allow
224-
# `pip` to create the appropriate form of executable for the target
225-
# platform.
226-
#
227-
# For example, the following would provide a command called `sample` which
228-
# executes the function `main` from this package when invoked:
229-
entry_points={ # Optional
230-
'console_scripts': [
231-
'gff3_fix=gff3tool.bin.gff3_fix:script_main',
232-
'gff3_merge=gff3tool.bin.gff3_merge:script_main',
233-
'gff3_QC=gff3tool.bin.gff3_QC:script_main',
234-
'gff3_sort=gff3tool.bin.gff3_sort:script_main',
235-
'gff3_to_fasta=gff3tool.bin.gff3_to_fasta:script_main'
236-
]
237-
},
238-
include_package_data=True, # include other files
239-
# List additional URLs that are relevant to your project as a dict.
240-
#
241-
# This field corresponds to the "Project-URL" metadata fields:
242-
# https://packaging.python.org/specifications/core-metadata/#project-url-multiple-use
243-
#
244-
# Examples listed include a pattern for specifying where the package tracks
245-
# issues, where the source is hosted, where to say thanks to the package
246-
# maintainers, and where to support the project financially. The key is
247-
# what's used to render the link text on PyPI.
248-
project_urls={ # Optional
249-
'Bug Reports': 'https://github.com/NAL-i5K/GFF3toolkit/issues',
250-
'Source': 'https://github.com/NAL-i5K/GFF3toolkit',
251-
},
76+
packages=find_packages(exclude=['contrib', 'docs', 'tests', 'tests.*']),
77+
include_package_data=True,
25278
)

0 commit comments

Comments
 (0)