afids / afids-validator

Validator for the anatomical fiducial placement protocol
https://validator.afids.io
GNU General Public License v3.0
2 stars 4 forks source link

MAINT: Setup poetry #155

Closed kaitj closed 2 years ago

kaitj commented 2 years ago

Proposed changes

This PR starts to integrate poetry for package management, including updating the README, and the actions workflow. AFAIK it won't automatically handle the packages and versions, but it is cleaner to use. The pre-release version (1.2.0a2) introduced dependency groups (eg. dev dependencies, actions dependencies, etc). that get installed alongside the default dependency. A poetry.lock file is included as any installs will always attempt to match the versions found in this file first, even if another version is specified in the pyproject.toml. Idea behind poetry is to have anyone contributing to the repo to be in the same environment (as much as possible).

With this, it will also automatically setup the precommit hook if git commands are run from within the virtual environment created by poetry (via poetry shell).

I have left the setup.py and requirements.txt in the repo for now, but should set a date for deprecation / removal if switch to poetry is made. poetry will generate a requirements.txt file with a simple command, though they recommend against going this route.

Types of changes

What types of changes does your code introduce? Put an x in the boxes that apply

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you are unsure about any of the choices, don't hesitate to ask!

Notes

All PRs will undergo the unit testing before being reviewed. You may be requested to explain or make additional changes before the PR is accepted.

_PR template was adopted from appium_

kaitj commented 2 years ago

Wait until transition from heroku as the requirements.txt is required.

kaitj commented 2 years ago

I started to go through this action item for the migration.

kaitj commented 2 years ago

I was testing the poetry build command, and one thing we'll have to decide on is "afids-valdiator" vs "afidsvalidator" unless there is a way around that. I've changed the name in the pyproject.toml file for now to be "afidsvalidator" but this is an easy fix. The other way was to go through and update manage.py but wasn't sure if that would break anything.

@tkkuehn - sorry meant to tag you in this to see if you had any thoughts on how this should be handled

tkkuehn commented 2 years ago

I'm just as happy calling it afidsvalidator if that's easier!

kaitj commented 2 years ago

This should be good for a first look. The CI workflow is working now with poetry up to the quality checks where it fails to pass. Which reminds me, we should set up the pre-commit or a poe task for quality (or both).

The release workflow will need to be reworked as discussed yesterday.

kaitj commented 2 years ago

Huh...some of the things you caught I thought I had fixed. Maybe I didn't push them.

kaitj commented 2 years ago

If this look good to you @tkkuehn, it can be merged. I'll try to go through and create a quality task similar to snakebids / pre-commit on a new branch so we can get past the linting not passing.

tkkuehn commented 2 years ago

Do you know what's going on with the "Lint code" job not running for 3.8 and 3.9? Otherwise this looks to be in good shape.

kaitj commented 2 years ago

Do you know what's going on with the "Lint code" job not running for 3.8 and 3.9? Otherwise this looks to be in good shape.

I assumed it stopped because 3.10 failed, which would lead to the action failing all together.