Skip to content

Commit 91abe61

Browse files
Initial Package Scaffolding (#1)
* Ignore all .env* * Add Dockerfile * Add CI script * Add test, lint, and publish scripts * Add setup.py * Basic CONTRIBUTOR.md * Add compose files * Add hello world test * Add packages * Add package structure * Add no-op function for CI testing
1 parent fa29da5 commit 91abe61

File tree

14 files changed

+464
-1
lines changed

14 files changed

+464
-1
lines changed

.circleci/config.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ jobs:
55
- image: circleci/python:3.8.11
66
working_directory: ~/wayscript-python
77
steps:
8+
- setup_remote_docker:
9+
version: 20.10.6
810
- checkout
11+
- run:
12+
name: lint
13+
command: docker-compose -f docker-compose.ci.yml run --rm app lint
914
- run:
1015
name: test
11-
command: docker-compose run --rm app test
16+
command: docker-compose -f docker-compose.ci.yml run --rm app test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ celerybeat.pid
103103

104104
# Environments
105105
.env
106+
.env*
106107
.venv
107108
env/
108109
venv/

CONTRIBUTOR.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Contribution Guide
2+
3+
## Running Locally
4+
5+
To speed up development cycles you can run tests and linting locally with:
6+
```
7+
docker-compose run --rm app lint
8+
docker-compose run --rm app test
9+
```
10+
This will mount your local working directory into the container and set it as the working directory within the container.
11+
12+
To exactly replicate the CI steps, add the `-f docker-compose.ci.yml` arg to the above commands.
13+
14+
## Publishing A New Version
15+
16+
To cut a new version, follow these steps:
17+
18+
- create and merge final feature branch updating `CHANGELOG.md`
19+
- tag final commit hash with `git tag <VERSION>`, e.g. `git tag 0.1.3`.
20+
- publish to pypi with:
21+
```
22+
docker-compose run --rm app bash publish.sh
23+
```
24+
- push tag to github with `git push --tags`

Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM python:3.8.11-buster AS base
2+
LABEL org.wayscript.image.authors="founders@wayscript.com"
3+
4+
ENV SRC_DIR /usr/local/src/project
5+
WORKDIR ${SRC_DIR}
6+
7+
RUN pip3 install pipenv
8+
9+
COPY Pipfile Pipfile.lock ${SRC_DIR}/
10+
11+
RUN pipenv install --system --dev && \
12+
rm -rf /root/.cache/pip
13+
14+
COPY ./files/ /
15+
16+
COPY ./ ${SRC_DIR}/
17+
18+
RUN chmod u+x /usr/local/bin/*

Pipfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[[source]]
2+
url = "https://pypi.org/simple"
3+
verify_ssl = true
4+
name = "pypi"
5+
6+
[packages]
7+
8+
[dev-packages]
9+
pytest = "*"
10+
twine = "*"
11+
pytest-xdist = "*"
12+
pyflakes = "*"
13+
tag-version = "*"
14+
15+
[requires]
16+
python_version = "3.8"

Pipfile.lock

Lines changed: 284 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3'
2+
services:
3+
app:
4+
build:
5+
context: .
6+
environment:
7+
- TWINE_USERNAME=__token__
8+
- TWINE_NON_INTERACTIVE=1
9+
- TWINE_PASSWORD
10+
stdin_open: true
11+
tty: true
12+

0 commit comments

Comments
 (0)