From df61119017480fb674cf07625b20dff3dd787a4a Mon Sep 17 00:00:00 2001 From: Michael Terry Date: Wed, 17 Jul 2024 10:07:18 -0400 Subject: [PATCH] Switch from setuptools to a modern pyproject config --- .bumpversion.cfg | 3 --- .github/workflows/ci.yaml | 3 +-- AUTHORS.md | 2 ++ Doxyfile | 2 +- MANIFEST.in | 1 - README.md | 37 ++++++++++--------------- fhirclient/__init__.py | 3 +++ pyproject.toml | 36 +++++++++++++++++++++++++ requirements.txt | 6 ----- setup.cfg | 6 ----- setup.py | 57 --------------------------------------- 11 files changed, 57 insertions(+), 99 deletions(-) delete mode 100644 .bumpversion.cfg delete mode 100644 MANIFEST.in create mode 100644 pyproject.toml delete mode 100644 requirements.txt delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg deleted file mode 100644 index 9a25df2c5..000000000 --- a/.bumpversion.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[bumpversion] -current_version = 4.2.0 -files = fhirclient/client.py diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 560402fa6..012ae4d0a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -30,8 +30,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements.txt - pip install pytest pytest-cov + pip install .[tests] - name: Test with pytest run: | diff --git a/AUTHORS.md b/AUTHORS.md index c889fd777..d3a409be3 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -16,6 +16,8 @@ The following wonderful people contributed directly or indirectly to this projec - Faith Oyedemi - Josh Mandel - Martin Burchell +- Matt Garber +- Michael Terry - Nikolai Schwertner - Pascal Pfiffner - Raheel Sayeed diff --git a/Doxyfile b/Doxyfile index 66c76f666..81fb29dc2 100644 --- a/Doxyfile +++ b/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = "SMART on FHIR Python Client" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 4.0.0 +PROJECT_NUMBER = 4.2.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 8bd3bb6e0..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1 +0,0 @@ -include *.md LICENSE diff --git a/README.md b/README.md index 7acb486d6..82d10de7f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -SMART FHIR Client -================= +# SMART FHIR Client This is _fhirclient_, a flexible Python client for [FHIR][] servers supporting the [SMART on FHIR][smart] protocol. @@ -22,14 +21,12 @@ The `develop` branch should be on recent freezes, and the `feature/latest-ci` br **0.0.2** | `0.0.82.2943` | (DSTU 1) -Installation ------------- +## Installation pip install fhirclient -Documentation -------------- +## Documentation Technical documentation is available at [docs.smarthealthit.org/client-py/][docs]. @@ -170,23 +167,19 @@ Clone the _client-py_ repository, then create a virtual environment (not compuls python flask_app.py -Building Distribution ---------------------- +## Building Distribution - pip install -r requirements.txt - python setup.py sdist - python setup.py bdist_wheel + pip install -U build + python3 -m build ### Incrementing the lib version - bumpversion patch - bumpversion minor - bumpversion major +- Edit `fhirclient/client.py` and change the `__version__` field. +- Edit `Doxyfile` and change the `PROJECT_NUMBER` field. -Docs Generation ---------------- +## Docs Generation Docs are generated with [Doxygen][] and [doxypypy][]. You can install doxypypy via pip: `pip install doxypypy`. @@ -200,10 +193,9 @@ I usually perform a second checkout of the _gh-pages_ branch and copy the html f rsync -a docs/html/ ../client-py-web/ -PyPi Publishing (notes for SMART team) --------------------------------------- +## PyPi Publishing (notes for SMART team) -Using setuptools (*Note*: Alternatively, you can use twine https://pypi.python.org/pypi/twine/): +Using flit (*Note*: Alternatively, you can use [twine](https://twine.readthedocs.io/)): ### Make sure that you have the PyPi account credentials in your account @@ -211,13 +203,12 @@ Using setuptools (*Note*: Alternatively, you can use twine https://pypi.python.o ### Test the build - python setup.py sdist - python setup.py bdist_wheel + python3 -m build ### Upload the packages to PyPi - python setup.py sdist upload -r pypi - python setup.py bdist_wheel upload -r pypi + pip install -U flit + flit publish [fhir]: http://www.hl7.org/implement/standards/fhir/ diff --git a/fhirclient/__init__.py b/fhirclient/__init__.py index e69de29bb..39429d419 100644 --- a/fhirclient/__init__.py +++ b/fhirclient/__init__.py @@ -0,0 +1,3 @@ +"""A flexible client for FHIR servers supporting the SMART on FHIR protocol""" + +from .client import __version__ diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..3120a541e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,36 @@ +[project] +name = "fhirclient" +requires-python = ">= 3.8" +dependencies = [ + "isodate >= 0.5", + "requests >= 2.4", +] +authors = [{ name="SMART Platforms Team", email="support@smarthealthit.org" }] +readme = "README.md" +keywords = ["smart", "fhir", "healthcare", "medical-informatics", "clinical-informatics", "biomedical-informatics"] +license = { file="LICENSE" } +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Topic :: Software Development :: Libraries :: Python Modules", +] +dynamic = ["description", "version"] + +[project.urls] +Homepage = "https://github.com/smart-on-fhir/client-py" +Documentation = "https://docs.smarthealthit.org/client-py/" + +[build-system] +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + +[project.optional-dependencies] +tests = [ + "pytest >= 2.5", + "pytest-cov", +] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 96e0a5db6..000000000 --- a/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -pip>=1.4 -setuptools>=0.9 -wheel>=0.21 -bumpversion>=0.3 -isodate>=0.5 -requests>=2.4 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index a2b6d2369..000000000 --- a/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[tool:pytest] -minversion = 2.5 - -[wheel] -# Since we're a pure Python package, we can mark our wheels as universal. -universal = 1 diff --git a/setup.py b/setup.py deleted file mode 100644 index b59bc5141..000000000 --- a/setup.py +++ /dev/null @@ -1,57 +0,0 @@ -import codecs -import os -import re - -from setuptools import setup, find_packages - -def read(*parts): - """ - Build an absolute path from *parts* and and return the contents of the - resulting file. Assume UTF-8 encoding. - """ - here = os.path.abspath(os.path.dirname(__file__)) - with codecs.open(os.path.join(here, *parts), 'rb', 'utf-8') as f: - return f.read() - -def find_version(*file_paths): - """ - Build a path from *file_paths* and search for a ``__version__`` - string inside. - """ - version_file = read(*file_paths) - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) - if version_match: - return version_match.group(1) - raise RuntimeError("Unable to find version string.") - -setup( - name='fhirclient', - version=find_version("fhirclient/client.py"), - description='A flexible client for FHIR servers supporting the SMART on FHIR protocol', - long_description=(read('README.md') + '\n\n' + - read('AUTHORS.md')), - keywords='smart fhir healthcare medical-informatics clinical-informatics biomedical-informatics', - url='https://github.com/smart-on-fhir/client-py/', - license="APACHE2", - author="SMART Platforms Team", - author_email='support@smarthealthit.org', - packages=find_packages(exclude=['tests*']), - python_requires='>= 3.8', - install_requires=['requests', 'isodate'], - classifiers=[ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'License :: OSI Approved :: Apache Software License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', - 'Programming Language :: Python :: 3.4', - 'Programming Language :: Python :: 3.5', - 'Topic :: Software Development :: Libraries :: Python Modules', - ], -)