Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .flake8

This file was deleted.

79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
name: "Python ${{ matrix.python-version }} / Django ${{ matrix.django-version }}"
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
include:
- python-version: "3.11"
django-version: "django5"
toxenv: "py311-django5"
- python-version: "3.12"
django-version: "django5"
toxenv: "py312-django5"
- python-version: "3.13"
django-version: "django5"
toxenv: "py313-django5"

steps:
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Install tox
run: pip install tox

- name: Run tests
run: tox -e ${{ matrix.toxenv }}

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"

- name: Install tox
run: pip install tox

- name: Run linting
run: tox -e lint

prodsettings:
name: Check production settings
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: "pip"

- name: Install tox
run: pip install tox

- name: Check deploy settings
run: tox -e prodsettings
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Dev-related files
dev/
/.ruff_cache/
/static/
/.tox/

Expand Down
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include LICENSE README.rst
include requirements_dev.txt release.txt
include requirements_dev.txt release.txt pyproject.toml

graft xorgdata

Expand All @@ -10,4 +10,4 @@ recursive-include third_party *.po

global-exclude *.py[cod] __pycache__ *.so .*.swp

exclude Makefile example_* manage.py tox.ini .flake8 .travis.yml
exclude Makefile example_* manage.py tox.ini
39 changes: 17 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
PACKAGE=xorgdata
SRC_DIR=$(PACKAGE)
TESTS_DIR=tests
DOC_DIR=docs

# Use current python binary instead of system default.
COVERAGE = python $(shell which coverage)
FLAKE8 = flake8
DJANGO_ADMIN = django-admin.py
PACKAGE = xorgdata
SRC_DIR = $(PACKAGE)
TESTS_DIR = tests

# Utilise le binaire Python courant
COVERAGE = python -m coverage
RUFF = ruff
DJANGO_ADMIN = django-admin

PO_FILES = $(shell find $(SRC_DIR) -name '*.po')
MO_FILES = $(PO_FILES:.po=.mo)

all: default


default: build


clean:
find . -type f -name '*.pyc' -delete
find $(SRC_DIR) $(TESTS_DIR) -type f -path '*/__pycache__/*' -delete
Expand Down Expand Up @@ -49,20 +47,17 @@ test: build
checkdeploy:
python manage.py check --deploy --fail-level WARNING


lint:
check-manifest
$(FLAKE8) --config .flake8 $(SRC_DIR)
$(FLAKE8) --config .flake8 $(TESTS_DIR)
$(RUFF) check $(SRC_DIR) $(TESTS_DIR)

format:
$(RUFF) format $(SRC_DIR) $(TESTS_DIR)

coverage:
$(COVERAGE) erase
$(COVERAGE) run "--include=$(SRC_DIR)/*.py,$(TESTS_DIR)/*.py" --branch manage.py test $(TESTS_DIR)
$(COVERAGE) report "--include=$(SRC_DIR)/*.py,$(TESTS_DIR)/*.py"
$(COVERAGE) html "--include=$(SRC_DIR)/*.py,$(TESTS_DIR)/*.py"

doc:
$(MAKE) -C $(DOC_DIR) html

$(COVERAGE) run --branch manage.py test $(TESTS_DIR)
$(COVERAGE) report
$(COVERAGE) html

.PHONY: all checkdeploy clean coverage createdb default doc install-deps lint poupdate test testall update
.PHONY: all checkdeploy clean coverage createdb default doc format lint poupdate test testall update
7 changes: 4 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
xorgdata
========

.. image:: https://secure.travis-ci.org/Polytechnique-org/xorgdata.png?branch=master
:target: http://travis-ci.org/Polytechnique-org/xorgdata/
.. image:: https://github.com/Polytechnique-org/xorgdata/actions/workflows/ci.yml/badge.svg?branch=master
:target: https://github.com/Polytechnique-org/xorgdata/actions/workflows/ci.yml
:alt: CI

xorgdata handles the central data store for Polytechnique.org services.
It pulls data from AX's website and pushes it to Polytechnique.org's services.
Expand All @@ -19,7 +20,7 @@ Here are some commands to set up a development environment:
.. code-block:: sh

# Create a new virtual env
pew new xorgdata
python -m venv xorgdata

# Install dependencies
make update
Expand Down
10 changes: 9 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""

import os
import sys

if __name__ == "__main__":

def main():
"""Run administrative tasks."""
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "xorgdata.settings")
try:
from django.core.management import execute_from_command_line
Expand All @@ -13,3 +17,7 @@
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)


if __name__ == "__main__":
main()
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "xorgdata"
dynamic = ["version"]
description = "Polytechnique.org central datastore"
readme = "README.rst"
license = { text = "AGPL-3.0" }
authors = [
{ name = "Polytechnique.org dev team", email = "devel+xorgdata@staff.polytechnique.org" },
]
requires-python = ">=3.11"
dependencies = [
"Django~=5.2",
"getconf",
]
classifiers = [
"Development Status :: 3 - Alpha",
"Environment :: Web Environment",
"Framework :: Django",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Natural Language :: French",
"Natural Language :: English",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Internet :: WWW/HTTP :: Session",
"Topic :: System :: Systems Administration :: Authentication/Directory",
]

[project.urls]
Homepage = "https://github.com/Polytechnique-org/xorgdata"

[tool.setuptools.dynamic]
version = { attr = "xorgdata.__version__" }

[tool.setuptools.packages.find]
include = ["xorgdata", "xorgdata.*"]

# ---------------------------------------------------------------------------
# Ruff
# ---------------------------------------------------------------------------
[tool.ruff]
line-length = 119
target-version = "py311"
exclude = ["migrations"]

[tool.ruff.lint]
select = ["E", "F", "W", "I"]
ignore = []

# ---------------------------------------------------------------------------
# Coverage
# ---------------------------------------------------------------------------
[tool.coverage.run]
source = ["xorgdata"]
branch = true

[tool.coverage.report]
show_missing = true
14 changes: 11 additions & 3 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
-e .

check_manifest
flake8
psycopg2
# Linting (remplace flake8 par ruff, plus rapide)
ruff>=0.4.0

# Vérification du MANIFEST
check-manifest>=0.49

# Base de données PostgreSQL
psycopg2>=2.9

# Tests & couverture
coverage[toml]>=7.4
Loading