Package: dtrx
dtrxChanges in this repoDevelopmentContributionsIssuesReleasesInvoke + TestsLintingDockerdtrx"Do The Right eXtraction" - don't remember what set oftarflags or where
to pipe the output to extract it? no worries!TL;DRpipinstalldtrx

dtrxyolo.tar.gzThis is a copy-paste of the original dtrx repo, andall credit for this
softwareshould be attributed to the original author, Brett Smith @brettcs:https://github.com/brettcs/dtrxSee the originalREADMEfor more details on what this does!Changes in this repoThis repo contains some patches on top of the original source to enable usingdtrxwith python3. The original motivation was to enabledtrxon Ubuntu
20.04+, where thedtrxapt package was removed from the default ppas (likely
due to being python2 only).I attempted to get the tests all working viatox, for which I used a
Dockerfile to try to get some kind of environment consistency. You can run the
tests by running (requires Docker installed):./test.shDevelopmentContributionsContributions are gladly welcomed! Feel free to open a Pull Request with any
changes.IssuesWhen posting an issue, it can be very handy to provide any example files (for
example, the archive that failed to extract) or reproduction steps so we can
address the problem quickly.ReleasesReleases are tagged in this repo and published to pypi.org. The release process
for maintainers is the below steps:update the version specifier:# update the VERSION value in dtrx/dtrx.py, then:❯gitadddtrx/dtrx.py
❯gitcommit# fill in the commit messagecreate an annotated tag for the release. usually good to put a list of new
commits since the previous tag, for example by listing them with:❯gitlog$(gitdescribe--tags--abbrev=0)..HEAD--oneline# create the annotated tag❯gittag-a<versionnumber>be sure to push the tag,git push --tags.use themake publish-releasecommand to build and publish to GitHub and
PyPiSee theMakefilefor details on what that rule does.Invoke + TestsThere's some minimal helper scripts for pyinvoke undertasks/.To bootstrap, runpip install -r requirements.txt, theninv --listto see
available tasks:❯inv--list
Availabletasks:build-dockerbuilddockerimagepush-dockerpushdockerimagequick-testrunquicktestsindockerrst2manrunrst2manindockertest-nonexistent-file-cmdruntest-nonexistent-file-cmd.shtoxruntoxindockerwindowsjustcheckthatwindowsinstallfails.pullsaminimalwinedockerimagetotestTo run the tests, runinv tox. Takes a couple of minutes to go through all the
python versions.LintingLinting is provided bypre-commit. To use it, first install
the pre-commit hook:pipinstallpre-commit
pre-commitinstallpre-commit will run anytimegit commitruns (disable with--no-verify). You
can manually run it withpre-commit run.DockerThe tests in CI (and locally) can be run inside a Docker container, which
provides all the tested python versions.This image is defined atDockerfile. It's pushed to the GitHub
Container Registry so it can be managed by thedtrx-pyorganization on GitHub-
Docker Hub charges for Organizations.There are Invoke tasks for building + pushing the Docker image, which push both
a:latesttag as well as a:2022-09-16ISO8601 numbered tag. The tag can
then be updated in the GitHub actions runner.Note: there's a bit of complexity around how the image is used, because the
dtrx tests need to run as a non-root user (there's one test that checks for
error handling when the output directory is not accessible by the current
user). To deal with this, there's an entrypoint script that switches user to a
non-root user, but that still has read/write access to the mounted host volume
(which is the cwd, intended for local development work). This is required on
Linux, where it's nice to have the host+container UID+GUID matching, so any
changes to the mounted host volume have the same permissions set.In the GitHub actions runner, we need to run inside the same container (to
have access to the correct python versions for testing), and the github action
for checkout assumes it can write to somewhat arbitrary locations in the file
system (basically root access). So we switch to the non-root useraftercheckout.