Skip to content

Commit

Permalink
Merge pull request #49 from scipy-conference/modernize
Browse files Browse the repository at this point in the history
Update the development process and package versions
  • Loading branch information
achabotl committed Mar 6, 2024
2 parents faf7840 + 92a5d06 commit 95a3fcd
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 171 deletions.
91 changes: 54 additions & 37 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PY=python
PELICAN=pelican
PY?=
PELICAN?=pelican
PELICANOPTS=

BASEDIR=$(CURDIR)
Expand All @@ -8,59 +8,76 @@ OUTPUTDIR=$(BASEDIR)/output
CONFFILE=$(BASEDIR)/pelicanconf.py
PUBLISHCONF=$(BASEDIR)/publishconf.py


DEBUG ?= 0
ifeq ($(DEBUG), 1)
PELICANOPTS += -D
endif

RELATIVE ?= 0
ifeq ($(RELATIVE), 1)
PELICANOPTS += --relative-urls
endif

SERVER ?= "0.0.0.0"

PORT ?= 0
ifneq ($(PORT), 0)
PELICANOPTS += -p $(PORT)
endif


help:
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@echo ' make regenerate regenerate files upon modification '
@echo ' make publish generate using production settings '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
@echo ' make devserver [PORT=8000] start/restart develop_server.sh '
@echo ' make stopserver stop local server '
@echo ' make rsync rsync published output to server '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
@echo ' '
@echo 'Makefile for a pelican Web site '
@echo ' '
@echo 'Usage: '
@echo ' make html (re)generate the web site '
@echo ' make clean remove the generated files '
@echo ' make regenerate regenerate files upon modification '
@echo ' make publish generate using production settings '
@echo ' make serve [PORT=8000] serve site at http://localhost:8000'
@echo ' make serve-global [SERVER=0.0.0.0] serve (as root) to $(SERVER):80 '
@echo ' make devserver [PORT=8000] serve and regenerate together '
@echo ' make devserver-global regenerate and serve on 0.0.0.0 '
@echo ' '
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
@echo 'Set the RELATIVE variable to 1 to enable relative urls '
@echo ' '

html:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
"$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

clean:
[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR)
[ ! -d "$(OUTPUTDIR)" ] || rm -rf "$(OUTPUTDIR)"

regenerate:
$(PELICAN) -r $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
"$(PELICAN)" -r "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

serve:
ifdef PORT
cd $(OUTPUTDIR) && $(PY) -m pelican.server $(PORT)
else
cd $(OUTPUTDIR) && $(PY) -m pelican.server
endif
"$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

serve-global:
"$(PELICAN)" -l "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b $(SERVER)

devserver:
ifdef PORT
$(BASEDIR)/develop_server.sh restart $(PORT)
else
$(BASEDIR)/develop_server.sh restart
endif
"$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS)

stopserver:
kill -9 `cat pelican.pid`
kill -9 `cat srv.pid`
@echo 'Stopped Pelican and SimpleHTTPServer processes running in background.'
devserver-global:
"$(PELICAN)" -lr "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(CONFFILE)" $(PELICANOPTS) -b 0.0.0.0

publish:
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(PUBLISHCONF) $(PELICANOPTS)
"$(PELICAN)" "$(INPUTDIR)" -o "$(OUTPUTDIR)" -s "$(PUBLISHCONF)" $(PELICANOPTS)

update-deps:
python -m pip install --upgrade pip-tools pip wheel
python -m piptools compile --upgrade --resolver backtracking -o requirements.txt pyproject.toml

init:
python -m pip install --upgrade pip wheel
python -m pip install --upgrade -r requirements.txt
python -m pip check

update: update-deps init

rsync: publish
aws s3 sync output/ s3://conference.scipy.org
.PHONY: update-deps init html help clean regenerate serve serve-global devserver devserver-global publish

.PHONY: html help clean regenerate serve devserver publish rsync
147 changes: 43 additions & 104 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,149 +1,88 @@
conference.scipy.org
====================

This repository contains the landing page and blog for the
conference.scipy.org. Each specific SciPy Conference manages it's own
website and this site is only meant to capture the commonalities
between them.
This repository contains the landing page for
[conference.scipy.org](https://conference.scipy.org). Each conference manages
its own website. This site is only meant to capture the commonalities between
them.

## Dependencies
## Quick Set Up

You need a python environment with `pelican` and `markdown` packages installed.
In a Python virtual environment, install dependencies:

## Contributing

Currently the website is a set of static pages generated by
[Pelican](http://getpelican.org). The generated content is uploaded
to an S3 bucket manged by [Enthought](https://enthought.com). Contact
[[email protected]](mailto://[email protected]) to
get things updated.

Please feel free to contribute in what ever capacity you feel best.
For now, the site contains details for conferences past and news items
from conferences.

Here are a few ways you can contribute:
```
$ make init
```

### Add news item
Build the site. The output will be in the `output/` directory.

* [Fork the repository](https://help.github.com/articles/fork-a-repo) on
[github](https://github.com/scipy-conference/conference.scipy.org)
```
$ make html
```

* [Clone the fork](https://help.github.com/articles/fork-a-repo#step-2-clone-your-fork)
To view the site locally:

```
$ git clone [email protected]:aterrel/conference.scipy.org.git
Cloning into 'conference.scipy.org'...
remote: Counting objects: 74, done.
remote: Compressing objects: 100% (68/68), done.
remote: Total 74 (delta 3), reused 73 (delta 2)
Receiving objects: 100% (74/74), 248.52 KiB | 0 bytes/s, done.
Resolving deltas: 100% (3/3), done.
Checking connectivity... done
$ cd conference.scipy.org
$ make serve
< open browser to http://127.0.0.1:8000 >
( you should see your test page in the News and archives )
< Ctrl-C to exit server on terminal >
```

* [Create a new branch](https://help.github.com/articles/fork-a-repo#create-branches) with the name of your news item.

* Add your news item in content/news, see
[Pelican docs](http://docs.getpelican.com/en/3.3.0/getting_started.html#writing-content-using-pelican)
for details can be rst or markdown. An exmple below:
## Adding and Editing Items

The website is a set of static pages generated by
[Pelican](http://getpelican.org) from Markdown files. The content is published
automatically to GitHub Pages every time a pull request is merged to the `main`
branch.

News items in `content/news` are published on the News pages. The format looks like this:

```
$ cd content/news
$ cat << EOF > 2013-10-25-test.md
$ cat << EOF > 2024-03-05-test.md
> Title: Test
> Date: 2013-10-25
> Date: 2024-03-05
> Comments: true
> Categories:
> Author: Andy R. Terrel <andy.terrel@gmail.com>
> Author: Ze Claw <ze.claw@example.com>
> Summary: Testing
>
> Testing how this works!
>
> EOF
```

* [Push to your fork on github](https://help.github.com/articles/fork-a-repo#push-commits)

* [Create a pull request](https://help.github.com/articles/using-pull-requests)

* Email [[email protected]](mailto://[email protected]) to get the content deployed.

### Add or edit a page

* To edit the website one needs to first install the pelican blog system, see http://docs.getpelican.com/en/3.3.0/getting_started.html
* be sure to have [Markdown](http://pythonhosted.org/Markdown/index.html) installed as well

* Next checkout the source code:
```
$ git clone [email protected]:scipy-conference/conference.scipy.org.git
$ cd conference.scipy.org.git
```

Pages in `content/pages` map to top-level menu items as defined in
`pelicanconf.py`.

* Editting pages:
After adding or making changes to an item, regenerate the site:

* The content of the page can be found in the content directory
```
$ cd content; ls
images news pages pdf
< Ctrl-C to exit server on the terminal if it's already running >
$ make html && make serve
```
* images and pdf: static content to be copied,
* news: the markdown blog like pages,
* pages: the set of pages to be displayed

* To add a new post, add a file to the news, see pelican docs for the page issues:
## Edit the Home Page and the Layout

* Generating and viewing changes
* Now go to the top dir and regenerate site:
```
$ cd ../../
$ make html
```
The layout is defined in the `theme/` folder.

* To view it locally:
```
$ make serve
< open browser to http://127.0.0.1:8000 >
( you should see your test page in the News and archives )
< Ctrl-C to exit server on terminal >
```

* To modify a page edit inside the pages content
```
$ cd content/pages
$ vi 2013_detail.md
```

* Once again go to top and make it and view
```
$ cd ../.. && make html && make serve
```

* To edit the layout see thing inside the theme
```
$ ls theme
tuxlite_zfs
```

* Be sure to check in your changes and push
```
$ git add <files changed>
$ git commit -m “<Describe changes>”
$ git push origin <branch-name>
```

## Publishing
## Update Dependencies

You need to have a user on the conference.scipy.org server. This user needs to
have your ssh keys and ssh connection should work fine. The user also needs to
be added into the `scipy` group on the server to be allowed to publish new
content.
There's a Make target to update dependencies:

To publish an updated website, just use `make rsync` after `make publish`.
```
$ make update-deps
```

Be careful, we do not backup the old website.
It'll read dependencies from `pyproject.toml` and update the `requirements.txt`
file with the latest version.

## Contact

Expand Down
39 changes: 19 additions & 20 deletions pelicanconf.py
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals

import os

AUTHOR = u'SciPy Organizers <[email protected]>'
SITENAME = u'SciPy Conferences'
SITEURL = ''

TIMEZONE = 'US/Central'
DEFAULT_LANG = u'en'
AUTHOR = "SciPy Organizers <[email protected]>"
SITENAME = "SciPy Conferences"
SITEURL = ""

TIMEZONE = "US/Central"
DEFAULT_LANG = "en"

USE_FOLDER_AS_CATEGORY = True

# Set the article URL
ARTICLE_URL = 'news/{date:%Y}/{date:%m}/{date:%d}/{slug}/'
ARTICLE_SAVE_AS = 'news/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html'
ARTICLE_URL = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/"
ARTICLE_SAVE_AS = "news/{date:%Y}/{date:%m}/{date:%d}/{slug}/index.html"

# Title menu options
DISPLAY_PAGES_ON_MENU = False
MENUITEMS = [('Home', '/'),
('Past Conferences', '/past.html'),
('Proceedings', '/proceedings'),
('News', '/archives.html')]

MENUITEMS = [
("Home", "/"),
("Past Conferences", "/past.html"),
("Proceedings", "/proceedings"),
("News", "/archives.html"),
]

NEWEST_FIRST_ARCHIVES = False

# Theme
# Theme
THEME_DIR = os.path.join(os.getcwd(), "theme")
THEME_NAME = "tuxlite_zf"
THEME = os.path.join(THEME_DIR, THEME_NAME)
Expand All @@ -45,12 +44,12 @@
# ('You can modify those links in your config file', '#'),)

# Social widget
#SOCIAL = (('You can add links in your config file', '#'),
# SOCIAL = (('You can add links in your config file', '#'),
# ('Another social link', '#'),)

DEFAULT_PAGINATION = 5

STATIC_PATHS = ['images', 'pdf', 'CNAME', 'proceedings']
STATIC_PATHS = ["images", "pdf", "CNAME", "proceedings"]

# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
# RELATIVE_URLS = True
Loading

0 comments on commit 95a3fcd

Please sign in to comment.