diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index bea1676..0000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,30 +0,0 @@ -# Action to create release with each tagged version -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v* - -name: Create Release - -jobs: - build: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - ref: ${{ github.ref }} - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - # PAT via redata-bot - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - # No body: defaults to tag message and body - draft: false - prerelease: false diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 4fbbc5e..0a3db13 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -2,6 +2,7 @@ # https://pypi.org/project/ldcoolp-figshare/ # Some syntax from: # https://github.com/FootBrawlers/robosoft/blob/f06cfcd8443b33eb258e59a054c7d210fa896dad/.github/workflows/pypi-release.yml +# and https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ name: Publish to PyPI @@ -12,30 +13,59 @@ on: - 'v*' # Push events to matching v* jobs: - package-n-publish: + package-build: runs-on: ubuntu-latest - steps: - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python 3.7 - uses: actions/setup-python@v2 + uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: "3.11" - name: Install PyPI dependencies run: | python -m pip install --user --upgrade setuptools wheel - name: Build run: | python setup.py sdist bdist_wheel + - name: upload distribution package + uses: actions/upload-artifact@v4 + with: + name: ${{ github.event.repository.name }}-${{ github.ref_name }} + path: dist/ + + publish-to-testpypi: + needs: [package-build] + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/p/ldcoolp-figshare/ + permissions: + id-token: write + steps: + - name: download distribution package + uses: actions/download-artifact@v4 + with: + name: ${{ github.event.repository.name }}-${{ github.ref_name }} + path: dist/ - name: Publish to Test PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@release/v1.13 with: - user: __token__ - password: ${{ secrets.TEST_PYPI_TOKEN }} - repository_url: https://test.pypi.org/legacy/ - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@master + repository-url: https://test.pypi.org/legacy/ + + publish-to-pypi: + needs: [package-build] + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/ldcoolp-figshare/ + permissions: + id-token: write + steps: + - name: download distribution package + uses: actions/download-artifact@v4 with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + name: ${{ github.event.repository.name }}-${{ github.ref_name }} + path: dist/ + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1.13 \ No newline at end of file diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml new file mode 100644 index 0000000..89cad1b --- /dev/null +++ b/.github/workflows/python-package.yml @@ -0,0 +1,53 @@ +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Python package + +on: + push: + paths-ignore: + - '**.md' + - '**.png' + - 'img/*' + - 'LICENSE' + - '.gitignore' + - 'docs/**' + pull_request: + paths-ignore: + - '**.md' + - '**.png' + - 'img/*' + - 'LICENSE' + - '.gitignore' + - 'docs/**' + +jobs: + build-n-test: + + runs-on: ubuntu-latest + # See: https://github.com/marketplace/actions/skip-based-on-commit-message + if: "!contains(github.event.head_commit.message, 'docs only')" + strategy: + matrix: + python_version: ["3.11", "3.12", "3.13"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python_version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python_version }} + - name: Install setuptools for python 3.12 and 3.13 + if: matrix.python_version != '3.11' + run: | + python -m pip install setuptools + python -m pip install -r requirements.txt + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pytest pytest-cov + python setup.py install + python -m pip list + - name: Test with pytest + run: | + pytest --cov-report term-missing --cov-config=.coveragerc --cov=ldcoolp-figshare tests diff --git a/.github/workflows/sphinx-build.yml b/.github/workflows/sphinx-build.yml index d31415c..ca8d44e 100644 --- a/.github/workflows/sphinx-build.yml +++ b/.github/workflows/sphinx-build.yml @@ -17,8 +17,8 @@ jobs: steps: - name: Checkout ldcoolp-figshare - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Sphinx build - uses: ammaraskar/sphinx-action@master + uses: ammaraskar/sphinx-action@8.2.3 with: docs-folder: "docs/" diff --git a/.gitignore b/.gitignore index b6d0a41..a80fb20 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ MANIFEST pip-log.txt pip-delete-this-directory.txt -# Unit test / coverage reports +# Unit tests / coverage reports htmlcov/ .tox/ .nox/ diff --git a/docs/requirements.txt b/docs/requirements.txt index c1a7a8a..f8d3a9a 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,5 +1,5 @@ -redata>=0.4.1 +redata>=0.6.0 -sphinx>=4.0 -sphinx-rtd-theme==0.5.2 -sphinx-autodoc-typehints==1.12.0 +sphinx>=8.0.0 +sphinx-rtd-theme==3.0.2 +sphinx-autodoc-typehints==3.2.0 diff --git a/docs/source/authors.rst b/docs/source/authors.rst index a2f5c2c..790deb8 100644 --- a/docs/source/authors.rst +++ b/docs/source/authors.rst @@ -1,11 +1,9 @@ Authors ------- -- Chun Ly, Ph.D. (`@astrochun`_) - - `University of Arizona Libraries`_, `Research Engagement`_ +- `University of Arizona Libraries`_, `Research Engagement`_ See also the list of :repo:`contributors ` who participated in this project. -.. _@astrochun: http://www.github.com/astrochun .. _University of Arizona Libraries: https://github.com/ualibraries .. _Research Engagement: https://github.com/UAL-RE diff --git a/docs/source/conf.py b/docs/source/conf.py index 1052053..d943538 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -21,10 +21,10 @@ project = 'ldcoolp-figshare' copyright = '2021, Arizona Board of Regents' -author = 'Chun Ly, UA Research Data Repository (ReDATA) Team' +author = 'Research Engagement (University of Arizona Libraries)' # The full version, including alpha/beta/rc tags -release = 'v0.3.2' +release = 'v0.4.0' # -- General configuration --------------------------------------------------- diff --git a/docs/source/getting_started.rst b/docs/source/getting_started.rst index 59582bc..3289887 100644 --- a/docs/source/getting_started.rst +++ b/docs/source/getting_started.rst @@ -1,8 +1,8 @@ Getting Started --------------- -You will need Python. We recommend v3.9. This code will be tested with -v3.7, v3.8, and v3.9. +You will need Python. We recommend v3.11 or greater. This code will be tested with +v3.11, v3.12, and v3.13. This code is published as ``ldcoolp-figshare`` on :pypi:`PyPI <>`. Thus, the simplest installation is: diff --git a/ldcoolp_figshare/__init__.py b/ldcoolp_figshare/__init__.py index 7021114..f30cfec 100644 --- a/ldcoolp_figshare/__init__.py +++ b/ldcoolp_figshare/__init__.py @@ -1,3 +1,3 @@ -__version__ = "0.3.2" +__version__ = "0.4.0" from .main import FigshareInstituteAdmin diff --git a/ldcoolp_figshare/main.py b/ldcoolp_figshare/main.py index 6c15b76..eb03436 100644 --- a/ldcoolp_figshare/main.py +++ b/ldcoolp_figshare/main.py @@ -234,7 +234,7 @@ def get_account_list(self, process: bool = True) -> \ accounts_df = accounts_df.drop(columns='institution_id') if self.ignore_admin: - self.log.info("Excluding administrative and test accounts") + self.log.info("Excluding administrative and tests accounts") drop_index = [] for ia in self.admin_filter: diff --git a/requirements.txt b/requirements.txt index cb3c95c..ce8593e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -redata==0.4.1 +redata==0.6.0 diff --git a/setup.py b/setup.py index e2fe40a..f327b48 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name='ldcoolp-figshare', - version='0.3.2', + version='0.4.0', packages=find_namespace_packages(), url='https://github.com/UAL-RE/ldcoolp-figshare/', project_urls={ @@ -17,18 +17,18 @@ 'Tracker': 'https://github.com/UAL-RE/ldcoolp-figshare/issues', }, license='MIT License', - author='Chun Ly', - author_email='astro.chun@gmail.com', + author='Research Engagement (University of Arizona Libraries)', + author_email='redata@arizona.edu', description='Python tool using the Figshare API for data curation', long_description=long_description, long_description_content_type='text/markdown', - python_requires='>=3.7', + python_requires='>=3.11', install_requires=requirements, classifiers=[ 'Development Status :: 4 - Beta', 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9' + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.13' ] ) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_endpoint.py b/tests/test_endpoint.py new file mode 100644 index 0000000..c1d8cdb --- /dev/null +++ b/tests/test_endpoint.py @@ -0,0 +1,8 @@ +from ldcoolp_figshare.main import FigshareInstituteAdmin + +token = "token_dummy_1234567890abcdef" +inst_admin = FigshareInstituteAdmin(token) + +def test_endpoint(): + api_endpoint = "get_curation_list" + assert inst_admin.endpoint(api_endpoint) == "https://api.figshare.com/v2/account/institution/get_curation_list" \ No newline at end of file