Skip to content

Commit c81d425

Browse files
committed
Got rst docs working with pypi
1 parent 51a4761 commit c81d425

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

Diff for: .gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
venv/
22

3+
# auto generated
4+
README.rst
5+
36
# Byte-compiled / optimized / DLL files
47
__pycache__/
58
*.py[cod]

Diff for: Makefile

+10-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ PROJECT = webpack-loader
55

66
# Virtual environment settings
77
ENV ?= venv
8+
REPOSITORY ?= test-pypi
89

910
requirements = -r requirements-dev.txt
1011

@@ -24,6 +25,13 @@ install:
2425
@[ ! -d $(ENV)/ ] && virtualenv $(ENV)/ || :
2526
@$(ENV)/bin/pip install $(requirements)
2627

27-
publish: build
28+
generate-rst:
29+
@pandoc --from=markdown --to=rst --output=README.rst README.md
30+
31+
publish: generate-rst build
2832
@echo "Publishing to pypi..."
29-
@$(ENV)/bin/twine upload dist/*
33+
@$(ENV)/bin/twine upload -r $(REPOSITORY) dist/*
34+
35+
register:
36+
@echo "Registering package on pypi..."
37+
@$(ENV)/bin/twine register -r $(REPOSITORY)

Diff for: README.md

+11-7
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[![Coverage Status](https://coveralls.io/repos/owais/django-webpack-loader/badge.svg?branch=master&service=github)](https://coveralls.io/github/owais/django-webpack-loader?branch=master)
66

77
<br>
8+
89
Read http://owaislone.org/blog/webpack-plus-reactjs-and-django/ for a detailed step by step guide on setting up webpack with django using this library.
910

1011

@@ -50,6 +51,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
5051
```
5152

5253
<br>
54+
5355
Assuming `assets/` is in `settings.STATICFILES_DIRS` like
5456

5557
```python
@@ -59,6 +61,7 @@ STATICFILES_DIRS = (
5961
```
6062

6163
<br>
64+
6265
Assuming your webpack config lives at `./webpack.config.js` and looks like this
6366
```javascript
6467
var path = require("path");
@@ -81,6 +84,7 @@ module.exports = {
8184

8285

8386
<br>
87+
8488
### Default Configuration
8589
```python
8690
WEBPACK_LOADER = {
@@ -170,12 +174,12 @@ and your webpack config is located at `/home/src/webpack.config.js`, then the va
170174
## Usage
171175
<br>
172176
173-
#### Manually run webpack to build assets.
177+
### Manually run webpack to build assets.
174178
175179
One of the core principles of django-webpack-loader is to not manage webpack itself in order to give you the flexibility to run webpack the way you want. If you are new to webpack, check one of the [examples](https://github.com/owais/django-webpack-loader/tree/master/examples), read [my detailed blog post](http://owaislone.org/blog/webpack-plus-reactjs-and-django/) or check [webpack docs](http://webpack.github.io/).
176180
177181
178-
#### Settings
182+
### Settings
179183
180184
Add `webpack_loader` to `INSTALLED_APPS`
181185
@@ -186,7 +190,7 @@ INSTALLED_APPS = (
186190
)
187191
```
188192
189-
#### Templates
193+
### Templates
190194
191195
```HTML+Django
192196
{% load render_bundle from webpack_loader %}
@@ -215,7 +219,7 @@ INSTALLED_APPS = (
215219
<br>
216220
217221
218-
#### Multiple webpack projects
222+
### Multiple webpack projects
219223
220224
Version 2.0 and up of webpack loader also supports multiple webpack configurations. The following configuration defines 2 webpack stats files in settings and uses the `config` argument in the template tags to influence which stats file to load the bundles from.
221225
@@ -255,7 +259,7 @@ WEBPACK_LOADER = {
255259
</head>
256260
```
257261
258-
#### File URLs instead of html tags
262+
### File URLs instead of html tags
259263
260264
If you need the URL to an asset without the HTML tags, the `get_files`
261265
template tag can be used. A common use case is specifying the URL to a
@@ -276,7 +280,7 @@ CKEDITOR.config.contentsCss = '{{ editor_css_files.0.publicPath }}';
276280
</ul>
277281
```
278282
279-
#### Refer other static assets
283+
### Refer other static assets
280284
281285
`webpack_static` template tag provides facilities to load static assets managed by webpack
282286
in django templates. It is like django's built in `static` tag but for webpack assets instead.
@@ -350,7 +354,7 @@ TEMPLATES = [
350354
351355
Then in your base jinja template:
352356
353-
```HTML+Jinja2
357+
```HTML
354358
{{ render_bundle('main') }}
355359
```
356360

Diff for: requirements-dev.txt

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ Django==1.10.1
33
django-jinja==2.2.1
44
django-jinja2==0.1
55
unittest2==1.1.0
6-
pypandoc==1.2.0

Diff for: setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[metadata]
2-
description-file = README.md
2+
description-file = README.rst

Diff for: setup.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ def rel(*parts):
88
'''returns the relative path to a file wrt to the current directory'''
99
return os.path.abspath(os.path.join(os.path.dirname(__file__), *parts))
1010

11-
try:
12-
import pypandoc
13-
README = pypandoc.convert('README.md', 'rst')
14-
except OSError, ImportError:
15-
with open(rel('README.md')) as handler:
16-
README = handler.read()
11+
README = open('README.rst', 'r').read()
1712

1813
with open(rel('webpack_loader', '__init__.py')) as handler:
1914
INIT_PY = handler.read()
@@ -26,7 +21,6 @@ def rel(*parts):
2621
packages = ['webpack_loader', 'webpack_loader/templatetags', 'webpack_loader/contrib'],
2722
version = VERSION,
2823
description = 'Transparently use webpack with django',
29-
long_description=README,
3024
author = 'Owais Lone',
3125
author_email = '[email protected]',
3226
download_url = 'https://github.com/owais/django-webpack-loader/tarball/{0}'.format(VERSION),

0 commit comments

Comments
 (0)