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

Move from Pipenv to venv #192

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ trim_trailing_whitespace = true
end_of_line = lf
charset = utf-8

[.github/workflows/*.yml]
[*.yml]
indent_style = space
indent_size = 2

Expand Down
42 changes: 21 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ jobs:
with:
python-version: 3.7

- name: Install dependencies with pipenv
- name: Install dependencies
run: |
sleep 4m
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.format
- run: pipenv run invoke test.lint
- run: pipenv run invoke integration.clean
- run: pipenv run invoke integration.version
- run: pipenv run invoke integration.initialize
- run: pipenv run invoke unit.pytest
- run: pipenv run invoke test.security
- run: pipenv run invoke integration.query
- run: pipenv run invoke integration.write-policy
- run: pipenv run invoke build.uninstall-package
- run: invoke build.install-package
- run: invoke test.format
- run: invoke test.lint
- run: invoke integration.clean
- run: invoke integration.version
- run: invoke integration.initialize
- run: invoke unit.pytest
- run: invoke test.security
- run: invoke integration.query
- run: invoke integration.write-policy
- run: invoke build.uninstall-package

publish-package:
needs: test
Expand All @@ -44,17 +44,18 @@ 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
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@master
with:
Expand All @@ -70,19 +71,18 @@ jobs:
uses: actions/setup-python@v1
with:
python-version: 3.7
- uses: dschep/install-pipenv-action@v1
- name: publish brew
run: |
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 policy_sentry -U
pip install homebrew-pypi-poet
pip install policy_sentry -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 policy_sentry > HomebrewFormula/policy_sentry.rb
poet -f policy_sentry > HomebrewFormula/policy_sentry.rb
git add .
git commit -m "update brew formula" policy_sentry/bin/cli.py HomebrewFormula/policy_sentry.rb || echo "No brew changes to commit"
git push -u origin master
29 changes: 15 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,19 @@ jobs:
with:
python-version: 3.7

- name: Install dependencies with pipenv
- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev --skip-lock
- run: pipenv run invoke build.install-package
- run: pipenv run invoke test.format
- run: pipenv run invoke test.lint
- run: pipenv run invoke integration.clean
- run: pipenv run invoke integration.version
- run: pipenv run invoke integration.initialize
- run: pipenv run invoke unit.pytest
- run: pipenv run invoke test.security
- run: pipenv run invoke integration.query
- run: pipenv run invoke integration.write-policy
- run: pipenv run invoke build.uninstall-package
pip install -r requirements.txt
pip install -r requirements-dev.txt

- run: invoke build.install-package
- run: invoke test.format
- run: invoke test.lint
- run: invoke integration.clean
- run: invoke integration.version
- run: invoke integration.initialize
- run: invoke unit.pytest
- run: invoke test.security
- run: invoke integration.query
- run: invoke integration.write-policy
- run: invoke build.uninstall-package
11 changes: 11 additions & 0 deletions .pyup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# autogenerated pyup.io config file
# see https://pyup.io/docs/configuration/ for all available options

schedule: every month
requirements:
- requirements-dev.txt:
update: all
- requirements.txt:
update: all
- docs/requirements.txt:
update: insecure
4 changes: 0 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
#sphinx:
# configuration: docs/conf.py

mkdocs:
configuration: mkdocs.yml
fail_on_warning: false
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
## Future release (Unreleased)
* Add conditions support

## 0.8.0.8 (Unreleased)
* Delivery related:
- Automatic Python dependency updates via PyUp.io
- Automatic AWS Documentation updates thanks to @zscholl

## 0.8.0.7 (2020-05-20)
* Fixes #182 - adding the ability to exclude some actions from the resulting policy.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM python:${FROM_TAG}
MAINTAINER Kinnaird McQuade "kinnairdm@gmail.com"

# Install python dependencies
COPY ./utils/requirements.txt /tmp/
COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt --no-cache-dir && \
rm -rf /root/.cache/

Expand Down
48 changes: 0 additions & 48 deletions Pipfile

This file was deleted.

26 changes: 9 additions & 17 deletions docs/contributing/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,30 @@ Contributing to Documentation
=============================

If you're looking to help document Policy Sentry, your first step is to
get set up with Sphinx, our documentation tool. First you will want 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:

- python-dev (if you're on OS X, you already have this)
- pip
- pipenv

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

```bash
# If you have a fork, you'll want to clone it instead
git clone git@github.com:salesforce/policy_sentry.git

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

# Enter the docs directory and compile
cd docs/
make html
# Create the HTML files
invoke docs.build-docs
invoke docs.serve-docs

# View the file titled docs/_build/html/index.html in your browser
# The above will open the built documentation in your browser
```

Building Documentation
----------------------

Inside the `docs` directory, you can run `make` to build the
documentation. See `make help` for available options and the [Sphinx
Documentation](http://sphinx-doc.org/contents.html) for more
information.

Docstrings
----------

Expand Down
3 changes: 2 additions & 1 deletion docs/contributing/iam-database.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ This will update the HTML files stored in
`policy_sentry/shared/data/docs/[list]()*.html`:

```bash
pipenv shell
pip install -r requirements.txt
pip install -r requirements-dev.txt
python3 ./utils/download_docs.py
```

Expand Down
5 changes: 2 additions & 3 deletions docs/contributing/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ Pipenv
------

```bash
pipenv --python 3.7 # create the environment
pipenv shell # start the environment
pipenv install # install both development and production dependencies
pip install -r requirements.txt
pip install -r requirements-dev.txt
```

Invoke
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.3
astroid==2.3.3
atomicwrites==1.4.0
attrs==19.3.0
bandit==1.6.2
beautifulsoup4==4.8.2
black==19.10b0
certifi==2020.4.5.1
chardet==3.0.4
click==7.1.1
click-log==0.3.2
contextlib2==0.5.5
coverage==5.1
dparse==0.5.1
future==0.18.2
gitdb==4.0.5
GitPython==3.1.2
idna==2.8
importlib-metadata==1.6.0
invoke==1.4.1
isort==4.3.21
Jinja2==3.0.0a1
joblib==0.14.1
lazy-object-proxy==1.4.3
livereload==2.6.1
lunr==0.5.6
Markdown==3.2.2
MarkupSafe==2.0.0a1
mccabe==0.6.1
mkdocs==1.1
mkdocs-material==5.1.5
mkdocs-material-extensions==1.0b2
mkdocstrings==0.11.0
more-itertools==8.2.0
nltk==3.5
nose==1.3.7
packaging==20.3
pathspec==0.8.0
pbr==5.4.5
pluggy==0.13.1
py==1.8.1
Pygments==2.6.1
pylint==2.4.2
pymdown-extensions==7.1
pyparsing==3.0.0a1
pytest==5.2.1
pytkdocs==0.3.0
PyYAML==5.3.1
regex==2020.5.7
requests==2.22.0
safety==1.8.7
schema==0.7.1
six==1.14.0
smmap==3.0.4
soupsieve==2.0
stevedore==1.32.0
toml==0.10.0
tornado==6.0.4
tqdm==4.46.0
typed-ast==1.4.1
urllib3==1.25.9
wcwidth==0.1.9
wrapt==1.11.2
zipp==3.1.0
2 changes: 1 addition & 1 deletion utils/requirements.txt → requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ PyYAML==5.3.1
requests==2.22.0
schema==0.7.1
soupsieve==2.0
urllib3==1.25.8
urllib3==1.25.9
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,12 @@ def get_description():
packages=setuptools.find_packages(exclude=['test*']),
tests_require=TESTS_REQUIRE,
install_requires=[
'beautifulsoup4',
'click',
'click_log',
'requests',
'schema',
'PyYAML',
'click',
'click_log',
'beautifulsoup4',
# 'html5lib',
# 'lxml',
],
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
7 changes: 0 additions & 7 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,6 @@ def upload_to_pypi_prod_server(c):
c.run('python -m pip install policy_sentry')


@task
def update_requirements_txt_file(c):
"""Update the requirements.txt file in the utils folder for use in Docker"""
c.run('python -m pipenv lock --clear --requirements > utils/requirements.txt')


# INTEGRATION TESTS
@task
def clean_config_directory(c):
Expand Down Expand Up @@ -307,6 +301,5 @@ def build_docker(c):
build.add_task(upload_to_pypi_test_server, 'upload-test')
build.add_task(upload_to_pypi_prod_server, 'upload-prod')
build.add_task(upload_to_pypi_prod_server, 'upload-prod')
build.add_task(update_requirements_txt_file, 'update-requirements-file')

docker.add_task(build_docker, 'build-docker')
Loading