From a35860cf6013de5e6dc573df5f3f0dc648a9a296 Mon Sep 17 00:00:00 2001 From: lindsay stevens Date: Tue, 7 Mar 2023 03:10:50 +1100 Subject: [PATCH 1/2] dev: update packaging - remove .idea project files, not relevant - move prod deps into setup.py, dev deps into dev_requirements.pip - add install steps for general usage and dev - update LICENSE year - update target Python version to 3.9 - simplify .gitignore - add github actions workflow to build dist files --- .github/workflows/build.yml | 50 ++++++++++++ .gitignore | 80 +++---------------- .idea/.name | 1 - .idea/codeStyleSettings.xml | 14 ---- .idea/compiler.xml | 22 ----- .idea/copyright/profiles_settings.xml | 3 - .idea/deployment.xml | 14 ---- .idea/encodings.xml | 6 -- .idea/inspectionProfiles/Project_Default.xml | 9 --- .../inspectionProfiles/profiles_settings.xml | 7 -- .idea/limesurveyrc2api.iml | 14 ---- .idea/misc.xml | 4 - .idea/modules.xml | 8 -- .idea/vcs.xml | 6 -- LICENSE | 2 +- README.md | 32 ++++++++ dev_requirements.pip | 2 + limesurveyrc2api/__init__.py | 2 +- requirements.txt | 3 - setup.py | 10 ++- 20 files changed, 105 insertions(+), 184 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .idea/.name delete mode 100644 .idea/codeStyleSettings.xml delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/copyright/profiles_settings.xml delete mode 100644 .idea/deployment.xml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/inspectionProfiles/Project_Default.xml delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml delete mode 100644 .idea/limesurveyrc2api.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml create mode 100644 dev_requirements.pip delete mode 100644 requirements.txt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..e3b74a2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: Build + +on: [push, pull_request] + +jobs: + + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python: ['3.9'] + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python }} + + # Install dependencies. + - uses: actions/cache@v3 + name: Python cache with dependencies. + id: python-cache + with: + path: ${{ env.pythonLocation }} + key: ${{ env.pythonLocation }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('setup.py') }}-${{ hashFiles('dev_requirements.pip') }} + - name: Install dependencies. + run: | + python -m pip install --upgrade pip + pip install -r dev_requirements.pip + pip list + + # Build and Upload. + - name: Build sdist and wheel. + run: | + pip install wheel + rm -rf build dist *.egg-info + python setup.py sdist bdist_wheel + # Check. + - name: Check dist with twine + run: | + pip install twine + twine check dist/* + - name: Upload sdist and wheel. + if: success() + uses: actions/upload-artifact@v3 + with: + name: limesurveyrc2api--on-${{ matrix.os }}--py${{ matrix.python }} + path: ${{ github.workspace }}/dist/limesurveyrc2api* diff --git a/.gitignore b/.gitignore index 06212f7..9094662 100644 --- a/.gitignore +++ b/.gitignore @@ -1,69 +1,15 @@ +# Common editing files. *.pyc -__pycache__ -dist/ -build/ -*.egg-info/ +*.swp +.DS_Store +.idea +*.iml +.vscode + +# Folders created by setuptools. +build +dist +*.egg-info + +# Pypi manifest. MANIFEST - -# config files as they usually contain confidential information -*.ini - -# Seems to be a user-specific config directory, with path to the project SDK (python interpreter) -.idea/**/misc.xml - - - - -# If using IntelliJ, ignore all the things -# Add project-specific ignores above, below is copied from: -# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore - -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff: -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries - -# Sensitive or high-churn files: -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.xml -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml - -# Gradle: -.idea/**/gradle.xml -.idea/**/libraries - -# CMake -cmake-build-debug/ - -# Mongo Explorer plugin: -.idea/**/mongoSettings.xml - -## File-based project format: -*.iws - -## Plugin-specific files: - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index 73e7863..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -limesurveyrc2api \ No newline at end of file diff --git a/.idea/codeStyleSettings.xml b/.idea/codeStyleSettings.xml deleted file mode 100644 index bece52e..0000000 --- a/.idea/codeStyleSettings.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index 96cc43e..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml deleted file mode 100644 index e7bedf3..0000000 --- a/.idea/copyright/profiles_settings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml deleted file mode 100644 index 4f6e5c6..0000000 --- a/.idea/deployment.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index 97626ba..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml deleted file mode 100644 index ecd817f..0000000 --- a/.idea/inspectionProfiles/Project_Default.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml deleted file mode 100644 index 3b31283..0000000 --- a/.idea/inspectionProfiles/profiles_settings.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/limesurveyrc2api.iml b/.idea/limesurveyrc2api.iml deleted file mode 100644 index 6c348c5..0000000 --- a/.idea/limesurveyrc2api.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 7fb6195..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index a367991..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/LICENSE b/LICENSE index 256b192..fd6f2b6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Lindsay Stevens, UNSW Australia +Copyright (c) 2023 Lindsay Stevens Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 912c83e..1c85db4 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,18 @@ This module provides a class which can be used as a client for interacting with LimeSurvey Remote Control 2 API. +### Install +From pip: +```shell +pip install limesurveyrc2api +``` + +or from GitHub, for example using the master branch: +```shell +pip install https://github.com/lindsay-stevens/limesurveyrc2api/archive/master.zip +``` + + ### Example Usage The tests are a good place to refer to for api usage, until proper docs are written, anyway. Here is how to get a list of surveys. @@ -57,6 +69,26 @@ Where possible, error messages from the RC2API are translated into Python except ## Development +### Setup +```shell +# Get a copy of the repository. +mkdir -P ~/repos/limesurveyrc2api +cd ~/repos/limesurveyrc2api +git clone https://github.com/lindsay-stevens/limesurveyrc2api.git repo + +# Create and activate a virtual environment for the install. +/usr/local/bin/python3.9 -m venv venv +source venv/bin/activate + +# Install limesurveyrc2api, and it's development dependencies. +cd ~/repos/limesurveyrc2api/repo +pip install -e . +pip install -r dev_requirements.pip + +# Leave the virtualenv. +deactivate +``` + ### References diff --git a/dev_requirements.pip b/dev_requirements.pip new file mode 100644 index 0000000..4745b6f --- /dev/null +++ b/dev_requirements.pip @@ -0,0 +1,2 @@ +-e . +aiosmtpd==1.0.0 diff --git a/limesurveyrc2api/__init__.py b/limesurveyrc2api/__init__.py index bcf374d..232e519 100644 --- a/limesurveyrc2api/__init__.py +++ b/limesurveyrc2api/__init__.py @@ -1 +1 @@ -__version__ = "2017.1" +__version__ = "2023.1" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 097d3b2..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --e . -requests -aiosmtpd \ No newline at end of file diff --git a/setup.py b/setup.py index 095bede..68f62ca 100644 --- a/setup.py +++ b/setup.py @@ -1,25 +1,27 @@ -from setuptools import setup +from setuptools import find_packages, setup from limesurveyrc2api import __version__ setup( name="limesurveyrc2api", version=__version__, description="LimeSurvey RC2 API Web Services Client", + long_description=open("README.md", "r").read(), + long_description_content_type="text/markdown", url="https://github.com/lindsay-stevens", author="Lindsay Stevens", author_email="lindsay.stevens.au@gmail.com", - packages=["limesurveyrc2api"], + packages=find_packages(exclude=["tests", "tests.*"]), test_suite="tests", include_package_data=True, license="MIT", install_requires=[ - # see requirements.txt + "requests==2.28.2", ], keywords="limesurvey api webservice client", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", - "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.9", ], ) From 983b795ba82a21edc914550f6fc0d0f05ed2a26a Mon Sep 17 00:00:00 2001 From: lindsay stevens Date: Tue, 7 Mar 2023 03:34:11 +1100 Subject: [PATCH 2/2] dev: v2.0.0 --- limesurveyrc2api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/limesurveyrc2api/__init__.py b/limesurveyrc2api/__init__.py index 232e519..8c0d5d5 100644 --- a/limesurveyrc2api/__init__.py +++ b/limesurveyrc2api/__init__.py @@ -1 +1 @@ -__version__ = "2023.1" +__version__ = "2.0.0"