Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: update dependencies, testing, packaging, and linting/formatting #685

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
6e7c46d
dev: update dev dependencies and build process to current fashion
lindsay-stevens Jan 15, 2024
e60e7a0
dev: remove unused and unmaintained sphinx dev docs stub
lindsay-stevens Jan 15, 2024
3d23423
dev: fix linter warnings from flake8-bugbear rules
lindsay-stevens Jan 15, 2024
618abc1
dev: fix linter warnings from ruff-specific rules
lindsay-stevens Jan 15, 2024
ed585c3
dev: fix linter warnings from flake8-comprehensions rules
lindsay-stevens Jan 15, 2024
bfa91e3
dev: fix linter warnings from perflint and flake8-pie rules
lindsay-stevens Jan 15, 2024
23a225f
dev: fix linter warnings from pylint rules
lindsay-stevens Jan 15, 2024
5c680e7
dev: fix linter warnings from flake8-bandit rules
lindsay-stevens Jan 15, 2024
abf15e2
dev: fix linter warnings from flake8-pyi, tryceratops rules
lindsay-stevens Jan 15, 2024
c5902b5
dev: fix linter warnings from pyupgrade rules
lindsay-stevens Jan 15, 2024
68da45f
dev: fix linter warnings from pyupgrade rules
lindsay-stevens Jan 15, 2024
f77b252
dev: fix linter warnings from pyupgrade rules
lindsay-stevens Jan 15, 2024
7559f05
dev: fix linter warnings from pyupgrade rules
lindsay-stevens Jan 15, 2024
b2cb5ee
dev: rename test modules/methods for unittest runner instead of nose
lindsay-stevens Jan 15, 2024
92d53a5
dev: update usages of codecs.open to use underlying built-in
lindsay-stevens Jan 15, 2024
5533905
dev: fix ResourceWarning during tests, broken test, string formatting
lindsay-stevens Jan 16, 2024
0d5af8f
dev: fix expected output in attribute_columns_test
lindsay-stevens Jan 17, 2024
3ffc8c7
dev: update github actions
lindsay-stevens Jan 17, 2024
87041a5
dev: add encoding to open() calls for cross-platform test compatibility
lindsay-stevens Jan 17, 2024
ed0b6a0
dev: linter fixes following rebase onto master
lindsay-stevens Feb 8, 2024
b7c496a
dev: update dev dependencies
lindsay-stevens Feb 8, 2024
64903fd
dev: move binding_conversion dict to aliases, remove irrelevant comment
lindsay-stevens Feb 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 11 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,31 @@ jobs:
python: ['3.8']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

# Install dependencies.
- uses: actions/cache@v2
- 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') }}
key: ${{ env.pythonLocation }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies.
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.pip
pip install -e .
pip list

# Build.
- name: Build sdist and wheel.
run: |
pip install wheel
python clean_for_build.py
python setup.py sdist bdist_wheel

# Publish.
- name: Publish release to PyPI with twine
# Build and publish.
- name: Publish release to PyPI
if: success()
run: |
pip install twine
twine upload dist/pyxform-*-py3-none-any.whl dist/pyxform-*.tar.gz
pip install flit==3.9.0
flit --debug publish --no-use-vcs
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
FLIT_USERNAME: __token__
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
38 changes: 18 additions & 20 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,28 @@ jobs:
python: ['3.8']
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

# Install dependencies.
- uses: actions/cache@v2
- 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') }}
key: ${{ env.pythonLocation }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies.
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.pip
pip install -e .[dev]
pip list

# Linters.
- run: black pyxform tests --check --diff
- run: isort pyxform tests --check-only --diff
- run: flake8 pyxform tests
- run: pycodestyle pyxform tests
# Linter.
- run: ruff check pyxform tests --no-fix
- run: ruff format pyxform tests --diff

test:
runs-on: ${{ matrix.os }}
Expand All @@ -47,38 +45,38 @@ jobs:
- os: windows-latest
windows_nose_args: --traverse-namespace ./tests
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

# Install dependencies.
- uses: actions/cache@v2
- 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') }}
key: ${{ env.pythonLocation }}-${{ matrix.os }}-${{ matrix.python }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies.
run: |
python -m pip install --upgrade pip
pip install -r dev_requirements.pip
pip install -e .[dev]
pip list

# Tests.
- name: Run tests
run: nosetests -v -v ${{ matrix.windows_nose_args }}
run: python -m unittest --verbose

# Build and Upload.
- name: Build sdist and wheel.
if: success()
run: |
pip install wheel
python clean_for_build.py
python setup.py sdist bdist_wheel
pip install flit==3.9.0
flit --debug build --no-use-vcs
- name: Upload sdist and wheel.
if: success()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: pyxform--on-${{ matrix.os }}--py${{ matrix.python }}
path: ${{ github.workspace }}/dist/pyxform*
43 changes: 18 additions & 25 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ From the command line, complete the following. These steps use a `virtualenv <ht

# Install the pyxform and it's production dependencies.
(venv)$ cd repo
# If this doesn't work, upgrade pip ``pip install --upgrade pip`` and retry.
(venv)$ pip install -e .
(venv)$ python pyxform/xls2xform.py --help
(venv)$ xls2xform --help # same effect as previous line
Expand All @@ -76,25 +77,20 @@ You can then run xls2xform from the commandline::

Development
===========
To set up for development / contributing, first complete the above steps for "Running pyxform from local source", then complete the below.::
To set up for development / contributing, first complete the above steps for "Running pyxform from local source". Then repeat the command used to install pyxform, but with ``[dev]`` appended to the end, e.g.::

pip install -r dev_requirements.pip
pip install -e .[dev]

You can run tests with::

nosetests
python -m unittest

On Windows, use::
Before committing, make sure to format and lint the code using ``ruff``::

nosetests -v -v --traverse-namespace ./tests
ruff format pyxform tests
ruff check pyxform tests

Before committing, make sure to format the code using ``black``::

black pyxform tests

If you are using a copy of black outside your virtualenv, make sure it is the same version as listed in requirements_dev.pip.

In case the pre-commit.sh hooks don't run, also run the code through ``isort`` (sorts imports) and ``flake8`` (misc code quality suggestions). The syntax is the same as above for ``black``.
If you are using a copy of ``ruff`` outside your virtualenv, make sure it is the same version as listed in ``pyproject.toml``. Use the project configuration for ``ruff` in ``pyproject.toml``, which occurs automatically if ``ruff`` is run from the project root (where ``pyproject.toml`` is).

Writing tests
-------------
Expand All @@ -106,11 +102,12 @@ When writing new ``PyxformTestCase`` tests that make content assertions, it is s

Documentation
=============
To check out the documentation for pyxform do the following::
For developers, ``pyxform`` uses docstrings, type annotations, and test cases. Most modern IDEs can display docstrings and type annotations in a easily navigable format, so no additional docs are compiled (e.g. sphinx). In addition to the user documentation, developers should be familiar with the `ODK XForms Specification https://getodk.github.io/xforms-spec/`.

pip install Sphinx==1.0.7
cd your-virtual-env-dir/src/pyxform/docs
make html
For users, ``pyxform`` has documentation at the following locations:
* `XLSForm docs https://xlsform.org/`
* `XLSForm template https://docs.google.com/spreadsheets/d/1v9Bumt3R0vCOGEKQI6ExUf2-8T72-XXp_CbKKTACuko/edit#gid=1052905058`
* `ODK Docs https://docs.getodk.org/`

Change Log
==========
Expand All @@ -127,7 +124,7 @@ Releasing pyxform
3. Draft a new GitHub release with the list of merged PRs. Follow the title and description pattern of the previous release.
4. Checkout a release branch from latest upstream master.
5. Update ``CHANGES.txt`` with the text of the draft release.
6. Update ``setup.py``, ``pyxform/__init__.py`` with the new release version number.
6. Update ``pyproject.toml``, ``pyxform/__init__.py`` with the new release version number.
7. Commit, push the branch, and initiate a pull request. Wait for tests to pass, then merge the PR.
8. Tag the release and it will automatically be published

Expand All @@ -144,18 +141,14 @@ Releases are now automatic. These instructions are provided for forks or for a f
3. Install the production and packaging requirements::

pip install -e .
pip install wheel twine
pip install flit==3.9.0

4. Clean up build and dist folders::

rm -rf build dist pyxform.egg-info

5. Prepare ``sdist`` and ``bdist_wheel`` distributions::

python setup.py sdist bdist_wheel

6. Publish release to PyPI with ``twine``::
5. Prepare ``sdist`` and ``bdist_wheel`` distributions, and publish to PyPI::

twine upload dist/pyxform-*-py3-none-any.whl dist/pyxform-*.tar.gz
flit --debug publish --no-use-vcs

7. Tag the GitHub release and publish it.
6. Tag the GitHub release and publish it.
13 changes: 0 additions & 13 deletions dev_requirements.in

This file was deleted.

42 changes: 0 additions & 42 deletions dev_requirements.pip

This file was deleted.

Loading
Loading