Skip to content

Commit

Permalink
Move to Virtualenv instead of Pipenv
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcquade committed Jul 8, 2020
1 parent 0fad579 commit b7a9502
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 95 deletions.
39 changes: 20 additions & 19 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:
with:
python-version: 3.7

- name: Install dependencies with pipenv
- name: Install dependencies
run: |
sleep 2m
pip install pipenv
pipenv install --dev --skip-lock
sleep 4m
pip install -r requirements.txt
pip install -r requirements-dev.txt
- run: pipenv run invoke build.install-package
- run: pipenv run invoke test.lint
- run: pipenv run invoke test.security
- run: pipenv run invoke unit.pytest
- run: pipenv run invoke integration.version
- run: pipenv run invoke integration.expand-policy
- run: pipenv run invoke integration.scan
- run: pipenv run invoke build.uninstall-package
- run: invoke build.install-package
- run: invoke test.lint
- run: invoke test.security
- run: invoke unit.pytest
- run: invoke integration.version
- run: invoke integration.expand-policy
- run: invoke integration.scan
- run: invoke build.uninstall-package

publish-package:
needs: test
Expand All @@ -41,17 +41,19 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1

- name: Install dependencies
run: |
pipenv install --dev
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: create python package
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git fetch --tags
git pull origin master
pipenv run python setup.py sdist bdist_wheel
pip install setuptools wheel twine
python -m setup sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
Expand All @@ -67,20 +69,19 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: publish brew
run: |
sleep 2m
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
pipenv run pip install homebrew-pypi-poet
pipenv run pip install cloudsplaining -U
pip install homebrew-pypi-poet
pip install cloudsplaining -U
git fetch origin
git checkout --track origin/master
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest tag: $latest_tag"
git pull origin $latest_tag
pipenv run poet -f cloudsplaining > HomebrewFormula/cloudsplaining.rb
poet -f cloudsplaining > HomebrewFormula/cloudsplaining.rb
git add .
git commit -m "update brew formula" cloudsplaining/bin/version.py HomebrewFormula/cloudsplaining.rb || echo "No brew changes to commit"
git push -u origin master
22 changes: 11 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
with:
python-version: 3.7

- name: Install dependencies with pipenv
- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev --skip-lock
pip install -r requirements.txt
pip install -r requirements-dev.txt
- run: pipenv run invoke build.install-package
- run: pipenv run invoke test.lint
- run: pipenv run invoke test.security
- run: pipenv run invoke unit.pytest
- run: pipenv run invoke integration.version
- run: pipenv run invoke integration.expand-policy
- run: pipenv run invoke integration.scan
- run: pipenv run invoke build.uninstall-package
- run: invoke build.install-package
- run: invoke test.lint
- run: invoke test.security
- run: invoke unit.pytest
- run: invoke integration.version
- run: invoke integration.expand-policy
- run: invoke integration.scan
- run: invoke build.uninstall-package
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ default-results-summary.csv
private/*
current.json

venv
Pipfile.lock

iam-report-fake-000011112222.html
Expand Down
4 changes: 3 additions & 1 deletion .pyup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

schedule: every month
requirements:
- Pipfile:
- requirements-dev.txt:
update: all
- requirements.txt:
update: all
- docs/requirements.txt:
update: insecure
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
## Unreleased
* Docker


## 0.1.5 (Unreleased)
* Made callable via script to partially fix #39
* Move to virtualenv instead of Pipenv

## 0.1.4 (2020-05-26)
* Inline policies are now clearly mapped to their roles.
Expand Down
30 changes: 0 additions & 30 deletions Pipfile

This file was deleted.

15 changes: 8 additions & 7 deletions docs/contributing/contributing.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Contributing

We use Pipenv for package management. PyInvoke is used for storing common commands.
We use Virtualenv for package management instead of Pipenv or Poetry. PyInvoke is used for storing common commands.

## Pipenv
## Virtual environment

```bash
pipenv --python 3.7 # create the environment
pipenv shell # start the environment
pipenv install # install both development and production dependencies
# Set up the virtual environment
python3 -m venv ./venv && source venv/bin/activate
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
```


## Invoke
To run and develop Policy Sentry without having to install from PyPi, you can use Invoke.
To run and develop Cloudsplaining without having to install from PyPi, you can use Invoke.

```bash
```
# List available tasks
invoke -l
Expand Down
26 changes: 19 additions & 7 deletions docs/contributing/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,30 @@

## ReadTheDocs

You can contribute to the User Guide and ReadTheDocs documentation itself by editing the
Markdown files in the `docs/` folder.
If you're looking to help document Cloudsplaining, your first step is to
get set up with Mkdocs, our documentation tool. First you will want to
make sure you have a few things on your local system:

To see what it looks like, enter your Pipenv and run the PyInvoke command to build the docs:
- python-dev (if you're on OS X, you already have this)
- pip

Once you've got all that, the rest is simple:

```bash
pipenv shell
pipenv install --dev
# If you have a fork, you'll want to clone it instead
git clone git@github.com:salesforce/cloudsplaining.git

# Set up the virtual environment
python3 -m venv ./venv && source venv/bin/activate
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt

# Create the HTML files
invoke docs.build-docs
```
invoke docs.serve-docs

Then open your browser to [http://127.0.0.1:8000](http://127.0.0.1:8000) to view the documentation.
# The above will open the built documentation in your browser
```

## Report Guidance documents

Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ nose==1.3.7
packaging==20.3
pathspec==0.8.0
pbr==5.4.5
pipenv==2020.6.2
pluggy==0.13.1
policy-sentry==0.8.0.5
py==1.8.1
Expand Down
64 changes: 64 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
appdirs==1.4.4
astroid==2.4.2
attrs==19.3.0
bandit==1.6.2
beautifulsoup4==4.9.1
black==19.10b0
boto3==1.13.25
botocore==1.16.25
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
click-log==0.3.2
contextlib2==0.6.0.post1
coverage==5.2
docutils==0.15.2
dparse==0.5.1
future==0.18.2
gitdb==4.0.5
GitPython==3.1.3
idna==2.10
importlib-metadata==1.7.0
invoke==1.4.1
isort==4.3.21
Jinja2==2.11.2
jmespath==0.10.0
joblib==0.16.0
lazy-object-proxy==1.4.3
livereload==2.6.2
lunr==0.5.8
Markdown==3.2.2
MarkupSafe==1.1.1
mccabe==0.6.1
mkdocs==1.1.2
more-itertools==8.4.0
nltk==3.5
nose==1.3.7
packaging==20.4
pathspec==0.8.0
pbr==5.4.5
pluggy==0.13.1
policy-sentry==0.8.0.7
py==1.9.0
pylint==2.5.3
pyparsing==2.4.7
pytest==5.4.3
python-dateutil==2.8.1
PyYAML==5.3.1
regex==2020.6.8
requests==2.24.0
s3transfer==0.3.3
safety==1.9.0
schema==0.7.2
six==1.15.0
smmap==3.0.4
soupsieve==2.0.1
stevedore==2.0.1
toml==0.10.1
tornado==6.0.4
tqdm==4.47.0
typed-ast==1.4.1
urllib3==1.25.9
wcwidth==0.2.5
wrapt==1.12.1
zipp==3.1.0
25 changes: 25 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
beautifulsoup4==4.9.1
boto3==1.13.25
botocore==1.16.25
certifi==2020.6.20
chardet==3.0.4
click-log==0.3.2
click==7.1.2
contextlib2==0.6.0.post1
docutils==0.15.2
idna==2.10
importlib-metadata==1.7.0
jinja2==2.11.2
jmespath==0.10.0
markdown==3.2.2
markupsafe==1.1.1
policy-sentry==0.8.0.7
python-dateutil==2.8.1
pyyaml==5.3.1
requests==2.24.0
s3transfer==0.3.3
schema==0.7.2
six==1.15.0
soupsieve==2.0.1
urllib3==1.25.9
zipp==3.1.0
24 changes: 11 additions & 13 deletions utils/run_tests.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#!/usr/bin/env bash
set -ex
# Suppress annoying warnings
export PIPENV_VERBOSITY=-1

pip3 install pipenv
pipenv install --dev
pip install -r requirements.txt
pip install -r requirements-dev.txt

pipenv run invoke test.lint
pipenv run invoke build.uninstall-package
pipenv run invoke build.install-package
pipenv run invoke test.security
pipenv run invoke unit.pytest
invoke test.lint
invoke build.uninstall-package
invoke build.install-package
invoke test.security
invoke unit.pytest

pipenv run invoke integration.version
pipenv run invoke integration.expand-policy
pipenv run invoke integration.scan
invoke integration.version
invoke integration.expand-policy
invoke integration.scan

pipenv run invoke docs.build-docs
invoke docs.build-docs
14 changes: 9 additions & 5 deletions utils/update-brew.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash
set -x
pipenv uninstall --all
yes | pipenv run pip uninstall cloudsplaining
pipenv run pip install cloudsplaining -U
pipenv run pip install homebrew-pypi-poet
pipenv run poet -f cloudsplaining > HomebrewFormula/cloudsplaining.rb
python3 -m venv ./venv && source venv/bin/activate
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
invoke build.build-package
pip uninstall -r requirements.txt -y
pip uninstall -r requirements-dev.txt -y
pip install homebrew-pypi-poet
pip install cloudsplaining -U
poet -f cloudsplaining > HomebrewFormula/cloudsplaining.rb

0 comments on commit b7a9502

Please sign in to comment.