Skip to content

Commit c7d23af

Browse files
Ernesto ArbitrioErnesto Arbitrio
authored andcommitted
first commit
0 parents  commit c7d23af

29 files changed

Lines changed: 864 additions & 0 deletions

File tree

‎.github/workflows/style.yml‎

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Code Style
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths-ignore:
7+
- 'pretix_advanced_stats/locale/**'
8+
- 'pretix_advanced_stats/static/**'
9+
pull_request:
10+
branches: [ main, master ]
11+
paths-ignore:
12+
- 'pretix_advanced_stats/locale/**'
13+
- 'pretix_advanced_stats/static/**'
14+
15+
jobs:
16+
isort:
17+
name: isort
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set up Python 3.11
22+
uses: actions/setup-python@v1
23+
with:
24+
python-version: 3.11
25+
- uses: actions/cache@v1
26+
with:
27+
path: ~/.cache/pip
28+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
29+
restore-keys: |
30+
${{ runner.os }}-pip-
31+
- name: Install pretix
32+
run: pip3 install pretix
33+
- name: Install Dependencies
34+
run: pip3 install isort -Ue .
35+
- name: Run isort
36+
run: isort -c .
37+
flake:
38+
name: flake8
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- name: Set up Python 3.11
43+
uses: actions/setup-python@v1
44+
with:
45+
python-version: 3.11
46+
- uses: actions/cache@v1
47+
with:
48+
path: ~/.cache/pip
49+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
50+
restore-keys: |
51+
${{ runner.os }}-pip-
52+
- name: Install pretix
53+
run: pip3 install pretix
54+
- name: Install Dependencies
55+
run: pip3 install flake8 -Ue .
56+
- name: Run flake8
57+
run: flake8 .
58+
working-directory: .
59+
black:
60+
name: black
61+
runs-on: ubuntu-latest
62+
steps:
63+
- uses: actions/checkout@v2
64+
- name: Set up Python 3.11
65+
uses: actions/setup-python@v1
66+
with:
67+
python-version: 3.11
68+
- uses: actions/cache@v1
69+
with:
70+
path: ~/.cache/pip
71+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
72+
restore-keys: |
73+
${{ runner.os }}-pip-
74+
- name: Install pretix
75+
run: pip3 install pretix
76+
- name: Install Dependencies
77+
run: pip3 install black -Ue .
78+
- name: Run black
79+
run: black --check .
80+
working-directory: .
81+
packaging:
82+
name: packaging
83+
runs-on: ubuntu-latest
84+
steps:
85+
- uses: actions/checkout@v2
86+
- name: Set up Python 3.11
87+
uses: actions/setup-python@v1
88+
with:
89+
python-version: 3.11
90+
- uses: actions/cache@v1
91+
with:
92+
path: ~/.cache/pip
93+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
94+
restore-keys: |
95+
${{ runner.os }}-pip-
96+
- name: Install pretix
97+
run: pip3 install pretix
98+
- name: Install Dependencies
99+
run: pip3 install twine check-manifest pretix-plugin-build setuptools build -Ue .
100+
- name: Run check-manifest
101+
run: check-manifest .
102+
working-directory: .
103+
- name: Build package
104+
run: python setup.py sdist
105+
working-directory: .
106+
- name: Check package
107+
run: twine check dist/*
108+
working-directory: .

‎.github/workflows/tests.yml‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths-ignore:
7+
- 'pretix_advanced_stats/locale/**'
8+
pull_request:
9+
branches: [ main, master ]
10+
paths-ignore:
11+
- 'pretix_advanced_stats/locale/**'
12+
13+
jobs:
14+
test:
15+
runs-on: ubuntu-latest
16+
name: Tests
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python 3.11
20+
uses: actions/setup-python@v1
21+
with:
22+
python-version: 3.11
23+
- uses: actions/cache@v1
24+
with:
25+
path: ~/.cache/pip
26+
key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }}
27+
restore-keys: |
28+
${{ runner.os }}-pip-
29+
- name: Install system dependencies
30+
run: sudo apt update && sudo apt install gettext
31+
- name: Install pretix
32+
run: pip3 install pretix
33+
- name: Install Dependencies
34+
run: pip3 install pytest pytest-django -Ue .
35+
- name: Run checks
36+
run: py.test tests

‎.gitignore‎

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
.venv/
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
.ropeproject/
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.coverage
43+
.coverage.*
44+
.cache
45+
nosetests.xml
46+
coverage.xml
47+
*,cover
48+
.hypothesis/
49+
50+
# Translations
51+
*.mo
52+
53+
# Django stuff:
54+
*.log
55+
data/
56+
57+
# Sphinx documentation
58+
docs/_build/
59+
60+
# PyBuilder
61+
target/
62+
63+
#Ipython Notebook
64+
.ipynb_checkpoints

‎.gitlab-ci.yml‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
test:
2+
image:
3+
name: pretix/ci-image
4+
before_script:
5+
- pip install -U pip uv
6+
- uv pip install --system -U wheel setuptools pytest pytest-django coverage
7+
- uv pip install --system -U git+https://github.com/pretix/pretix.git@master#egg=pretix
8+
script:
9+
- uv pip install --system -e .
10+
- make
11+
- coverage run -m pytest tests
12+
- coverage report
13+
style:
14+
image:
15+
name: pretix/ci-image
16+
before_script:
17+
- pip install -U pip uv
18+
- uv pip install --system -U wheel setuptools isort black flake8 check-manifest
19+
- uv pip install --system -U git+https://github.com/pretix/pretix.git@master#egg=pretix
20+
script:
21+
- uv pip install --system -e .
22+
- black --check .
23+
- isort -c --gitignore .
24+
- flake8 --extend-exclude .cache .
25+
- check-manifest --ignore .cache .
26+
pypi:
27+
image:
28+
name: pretix/ci-image
29+
before_script:
30+
- cat $PYPIRC > ~/.pypirc
31+
- pip install -U pip uv
32+
- uv pip install --system -U wheel setuptools twine build pretix-plugin-build check-manifest
33+
script:
34+
- python -m build
35+
- check-manifest .
36+
- twine check dist/*
37+
- twine upload dist/*
38+
only:
39+
- pypi
40+
artifacts:
41+
paths:
42+
- dist/

‎.install-hooks.sh‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
REPO_DIR=$(git rev-parse --show-toplevel)
3+
GIT_DIR=$REPO_DIR/.git
4+
VENV_ACTIVATE=$VIRTUAL_ENV/bin/activate
5+
if [[ ! -f $VENV_ACTIVATE ]]
6+
then
7+
echo "Could not find your virtual environment"
8+
fi
9+
10+
echo "#!/bin/sh" >> $GIT_DIR/hooks/pre-commit
11+
echo "set -e" >> $GIT_DIR/hooks/pre-commit
12+
echo "source $VENV_ACTIVATE" >> $GIT_DIR/hooks/pre-commit
13+
echo "black --check ." >> $GIT_DIR/hooks/pre-commit
14+
echo "isort -c ." >> $GIT_DIR/hooks/pre-commit
15+
echo "flake8 ." >> $GIT_DIR/hooks/pre-commit
16+
chmod +x $GIT_DIR/hooks/pre-commit

‎.update-locales.sh‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/sh
2+
COMPONENTS=pretix/pretix-plugin-pretix-advanced-stats
3+
DIR=pretix_advanced_stats/locale
4+
# Renerates .po files used for translating the plugin
5+
set -e
6+
set -x
7+
8+
# Lock Weblate
9+
for c in $COMPONENTS; do
10+
wlc lock $c;
11+
done
12+
13+
# Push changes from Weblate to GitHub
14+
for c in $COMPONENTS; do
15+
wlc commit $c;
16+
done
17+
18+
# Pull changes from GitHub
19+
git pull --rebase
20+
21+
# Update po files itself
22+
make localegen
23+
24+
# Commit changes
25+
git add $DIR/*/*/*.po
26+
git add $DIR/*.pot
27+
28+
git commit -s -m "Update po files
29+
[CI skip]"
30+
31+
# Push changes
32+
git push
33+
34+
# Unlock Weblate
35+
for c in $COMPONENTS; do
36+
wlc unlock $c;
37+
done

‎LICENSE‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Copyright 2025 pamaron
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+

‎MANIFEST.in‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
recursive-include pretix_advanced_stats/static *
2+
recursive-include pretix_advanced_stats/templates *
3+
recursive-include pretix_advanced_stats/locale *
4+
include LICENSE
5+
exclude .gitlab-ci.yml

‎Makefile‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
all: localecompile
2+
LNGS:=`find pretix_advanced_stats/locale/ -mindepth 1 -maxdepth 1 -type d -printf "-l %f "`
3+
4+
localecompile:
5+
django-admin compilemessages
6+
7+
localegen:
8+
django-admin makemessages --keep-pot -i build -i dist -i "*egg*" $(LNGS)
9+
10+
.PHONY: all localecompile localegen

‎README.rst‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Advanced Stats
2+
==========================
3+
4+
This is a plugin for `pretix`_.
5+
6+
Short description
7+
8+
Development setup
9+
-----------------
10+
11+
1. Make sure that you have a working `pretix development setup`_.
12+
13+
2. Clone this repository.
14+
15+
3. Activate the virtual environment you use for pretix development.
16+
17+
4. Execute ``python setup.py develop`` within this directory to register this application with pretix's plugin registry.
18+
19+
5. Execute ``make`` within this directory to compile translations.
20+
21+
6. Restart your local pretix server. You can now use the plugin from this repository for your events by enabling it in
22+
the 'plugins' tab in the settings.
23+
24+
This plugin has CI set up to enforce a few code style rules. To check locally, you need these packages installed::
25+
26+
pip install flake8 isort black
27+
28+
To check your plugin for rule violations, run::
29+
30+
black --check .
31+
isort -c .
32+
flake8 .
33+
34+
You can auto-fix some of these issues by running::
35+
36+
isort .
37+
black .
38+
39+
To automatically check for these issues before you commit, you can run ``.install-hooks``.
40+
41+
42+
License
43+
-------
44+
45+
46+
Copyright 2025 pamaron
47+
48+
Released under the terms of the Apache License 2.0
49+
50+
51+
52+
.. _pretix: https://github.com/pretix/pretix
53+
.. _pretix development setup: https://docs.pretix.eu/en/latest/development/setup.html

0 commit comments

Comments
 (0)