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

Update to python3 and add pipenv #579

Merged
merged 2 commits into from Apr 9, 2018
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions Pipfile
@@ -0,0 +1,14 @@
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"

[packages]
markdown-include = "==0.5.1"
mkdocs = "==0.15.3"
pymdown-extensions = "==1.1"

[dev-packages]

[requires]
python_version = "3.6"
128 changes: 128 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 6 additions & 35 deletions README.md
Expand Up @@ -21,42 +21,13 @@ Once a PR is merged into master, the latest version will automatically be deploy
## Installation of [mkdocs](http://www.mkdocs.org/)

```sh
brew install python # if you don't have pip already
[sudo] pip install -r requirements.txt
brew install python3 # if you don't have pip already
brew install pipenv
pipenv --three
pipenv shell
pipenv install
```

_Note: If you use `sudo` to run `pip`, you might need to use the `-H` flag of `sudo`._

### Troubleshooting

Due to a bug in `pip` trying to uninstall El Capitan's version of `six` (protected by SIP) when needing a new one, you may encounter the following error during `pip install -r requirements.txt`:

```sh
OSError: [Errno 1] Operation not permitted: '/tmp/pip-[…]-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/six-1.4.1-py2.7.egg-info'
```

In this case, just [install `six` using the `--ignore-installed` flag first before retrying](https://github.com/pypa/pip/issues/3165#issuecomment-146666737):

```sh
[sudo] pip install --ignore-installed six
[sudo] pip install -r requirements.txt
```


## Adding a Python dependency

Likely, to add a [Markdown extension](https://pythonhosted.org/Markdown/extensions/).

1. Install with `pip install <some extension>`
2. Add <some extension> to [requirements-to-freeze.txt](requirements-to-freeze.txt).
3. Run `pip freeze > requirements.txt` to update the exact requirements.

### Why requirements-to-freeze.txt?

Based on [A Better Pip Workflow](http://www.kennethreitz.org/essays/a-better-pip-workflow),
`requirements-to-freeze.txt` and `requirements.txt` provide a similar experience
to Gemfile and Gemfile.lock, respectively.

`requirements-to-freeze.txt` lets you pick out the top level packages the
project depends on, while `requirements.txt` exactly specifies all of the
dependencies and subdependencies for repeatable builds.
Likely, to add a [Markdown extension](https://pythonhosted.org/Markdown/extensions/), install it with `pipenv install <some extension>` after making sure the virtualenv is loaded (`pipenv shell`).
5 changes: 3 additions & 2 deletions circle.yml
@@ -1,11 +1,12 @@
machine:
python:
version: 2.7.11
version: 3.6.0
ruby:
version: 2.3.0
dependencies:
pre:
- pip install -r requirements.txt
- pip install pipenv
- pipenv install
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't get easier than this ❤️

test:
override:
- bundle update
Expand Down
2 changes: 0 additions & 2 deletions requirements-to-freeze.txt

This file was deleted.

16 changes: 0 additions & 16 deletions requirements.txt

This file was deleted.