cloudtools / awacs

Python library for AWS Access Policy Language creation
BSD 2-Clause "Simplified" License
396 stars 102 forks source link

Replace the generator and add add missing actions #150

Closed michael-k closed 3 years ago

michael-k commented 3 years ago

This PR includes a GitHub Action that automates the updates of IAM Actions. The GitHub Action runs every Monday and pushes updates to the default branch.

michael-k commented 3 years ago

pyflakes is failing on Python 2.7 and 3.5 because the scraper was written for Python 3.8+.

We could switch to flake8 which also runs pyflakes but allows to exclude directories. Or drop support for Python 2.7 and 3.5 which are both past their EOL (for 3.5 see https://www.python.org/dev/peps/pep-0478/#release-schedule).

markpeek commented 3 years ago

This is awesome. Thank you @michael-k!

Some questions:

michael-k commented 3 years ago

Since the generated code is still compatible with 2.7, likely we could leave that support in still. Could add into setup.py "!=3.5.*"?

Is python now mapped to python3 in the latest ubunutu? Should the README and github actions be more explicit with python3 for a bit?

The github action checks in changes automatically, is there a downside in doing this in case the scraper has an issue? Or do you feel it could be backed out, fixed, and still needs a release to publish anyway?

If the scraper fails, it shouldn't create a commit, instead the GitHub Action is marked as failed. If it does something weird, it'll commit something weird. The trade-off is between reviewing one PR (the GitHub Action could create a PR instead of pushing to the default branch) each week and reviewing all changes at once on release. If you prefer PRs, I could help reviewing them.

I would like to have some of the tests running. I'm guessing your comment about pyflakes is more due to running it on python 2.7? Should we just assume all development and tests should use python 3.8?

The tests can all run under Python 2.7 and 3.5–3.9 as they don't import anything in ./scrape. Only pyflakes . fails because it covers ./scrape and the syntax is invalid for Python 2 (async/await) and 3.5 (variable annotations).

Possible workaround for pyflakes .:

I've added commits that drop support for Python 3.5 and implement the second option (just because it was the simplest one). The tests are passing now: https://travis-ci.org/github/cloudtools/awacs/builds/732744788

markpeek commented 3 years ago

Released as awacs 1.0.0.