Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Python 3.11/pyproject.toml/current django versions #180

Merged
merged 6 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ survey.db
django_survey_and_report.egg-info/
survey_test/static/
venv/
.direnv/
.envrc
.idea/
.project
.pydevproject
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: check-merge-conflict
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-json
- repo: https://github.com/myint/autoflake
rev: v1.4
rev: v2.0.1
hooks:
- id: autoflake
args:
Expand All @@ -20,30 +20,30 @@ repos:
- --remove-duplicate-keys
- --remove-unused-variables
- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.3.1
hooks:
- id: pyupgrade
args: [--py36-plus]
- repo: https://github.com/psf/black
rev: 22.6.0
rev: 23.1.0
hooks:
- id: black
args: [--line-length, "120"]
- repo: https://github.com/Pierre-Sassoulas/black-disable-checker/
rev: v1.1.1
rev: v1.1.3
hooks:
- id: black-disable-checker
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8
additional_dependencies: [flake8-bugbear, flake8-typing-imports==1.12.0]
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v3.0.0-alpha.6
hooks:
- id: prettier
args: [--prose-wrap=always, --print-width=88]
Expand Down
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[build-system]
requires = ["setuptools>=67.5.1", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "django-survey-and-report"
description = "A django survey app that can export results as CSV or PDF using your native language."
version = "1.4.7"
readme = "README.md"
authors = [
{email="[email protected]", name="Pierre SASSOULAS"}
]
license = {text = "AGPL-3.0"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Natural Language :: English",
"Natural Language :: Russian",
"Natural Language :: Spanish",
"Natural Language :: French",
"Natural Language :: Japanese",
"Natural Language :: Dutch",
"Natural Language :: Chinese (Traditional)",
"Natural Language :: German",
"Natural Language :: Indonesian",
"Natural Language :: Portuguese",
"Natural Language :: Polish",
"Topic :: Utilities",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Framework :: Django"
]
dynamic = ["dependencies"]

[project.urls]
repository = "https://github.com/Pierre-Sassoulas/django-survey"

[project.optional-dependencies]
dev = [
"pySankeyBeta~=1.3.0",
"django-rosetta",
"coverage",
"python-coveralls",
"coveralls",
"colorama",
"pylint",
"flake8",
"pre-commit"
]
sankey = [
"pySankeyBeta~=1.3.0",
]
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
django>=2.2,<5
django-bootstrap-form>=3.4
django-tastypie>=0.14.2
django-registration>=3.0
pytz>=2018.9
ordereddict>=1.1
pyyaml>=4.2b1
58 changes: 0 additions & 58 deletions setup.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from setuptools import setup
from setuptools import find_packages, setup

setup()
setup(include_package_data=True, packages=find_packages())
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can also go in pyproject.toml, (or it become useless), no ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, however, I saw this listed as still "beta" in the documentation as of today, which is why I moved it back into setup.py. I did the same for my own projects 1-2 months ago. It's possible that it will just work and that we can ignore the beta note in the documentation. https://setuptools.pypa.io/en/latest/userguide/package_discovery.html

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, thank you for the explanation :)

1 change: 0 additions & 1 deletion survey/exporter/tex/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class Configuration:

DEFAULT_PATH = Path(HERE, "default_conf.yaml")

def __init__(self, configuration_file=None):
Expand Down
3 changes: 2 additions & 1 deletion survey/exporter/tex/question2tex_sankey.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
warnings.warn(
"Cannot import 'sankey', please install the package using"
"the sankey extra. (pip install django-survey-and-report[sankey])"
": '{}'".format(e)
": '{}'".format(e),
stacklevel=2,
)
SANKEY = False

Expand Down
1 change: 0 additions & 1 deletion survey/exporter/tex/survey2tex.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def __init__(self):


class Survey2Tex(Survey2X):

ANALYSIS_FUNCTION = []
PGF_PIE_STY = Path(STATIC, "survey", "sty", "pgf-pie.sty")
PGF_PLOT_STY = Path(STATIC, "survey", "sty", "pgfplots.sty")
Expand Down
15 changes: 5 additions & 10 deletions survey/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from django.conf import settings
from django.forms import models
from django.urls import reverse
from django.utils.text import slugify

from survey.models import Answer, Category, Question, Response, Survey
from survey.signals import survey_completed
Expand All @@ -15,7 +14,6 @@


class ResponseForm(models.ModelForm):

FIELDS = {
Question.TEXT: forms.CharField,
Question.SHORT_TEXT: forms.CharField,
Expand Down Expand Up @@ -165,18 +163,15 @@ def get_question_initial(self, question, data):
if answer:
# Initialize the field with values from the database if any
if question.type == Question.SELECT_MULTIPLE:
initial = []
if answer.body == "[]":
pass
elif "[" in answer.body and "]" in answer.body:
initial = []
unformated_choices = answer.body[1:-1].strip()
for unformated_choice in unformated_choices.split(settings.CHOICES_SEPARATOR):
choice = unformated_choice.split("'")[1]
initial.append(slugify(choice))
elif answer.body[0] == "[" and answer.body[-1] == "]":
initial = [
choice.strip(" '") for choice in answer.body.strip("[]").split(settings.CHOICES_SEPARATOR)
]
else:
# Only one element
initial.append(slugify(answer.body))
initial = [answer.body]
else:
initial = answer.body
if data:
Expand Down
1 change: 0 additions & 1 deletion survey/management/survey_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


class SurveyCommand(BaseCommand):

requires_system_checks = []

def add_arguments(self, parser):
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0002_survey_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0001_initial")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0003_auto_20170320_0337.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0002_survey_template")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0004_polymorphic_answers_to_kiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def migrate_answers(apps, schema_editor):


class Migration(migrations.Migration):

dependencies = [("survey", "0003_auto_20170320_0337")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0005_rename_question_related_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0004_polymorphic_answers_to_kiss")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0006_add_related_name_for_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0005_rename_question_related_name")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0007_auto_20180217_1515.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0006_add_related_name_for_categories")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0008_translated_name_for_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0007_auto_20180217_1515")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0009_auto_20181211_1908.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0008_translated_name_for_models")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0010_survey_editable_answers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0009_auto_20181211_1908")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0011_survey_publish_duration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0010_survey_editable_answers")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0012_add_display_by_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def convert_bool_to_small_int(apps, _schema_editor):


class Migration(migrations.Migration):

dependencies = [("survey", "0011_survey_publish_duration")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0013_auto_20200609_0748.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [("survey", "0012_add_display_by_category")]

operations = [
Expand Down
1 change: 0 additions & 1 deletion survey/migrations/0014_survey_redirect_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
("survey", "0013_auto_20200609_0748"),
]
Expand Down
1 change: 0 additions & 1 deletion survey/models/answer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class Answer(models.Model):

question = models.ForeignKey(Question, on_delete=models.CASCADE, verbose_name=_("Question"), related_name="answers")
response = models.ForeignKey(Response, on_delete=models.CASCADE, verbose_name=_("Response"), related_name="answers")
created = models.DateTimeField(_("Creation date"), auto_now_add=True)
Expand Down
1 change: 0 additions & 1 deletion survey/models/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


class Category(models.Model):

name = models.CharField(_("Name"), max_length=400)
survey = models.ForeignKey(Survey, on_delete=models.CASCADE, verbose_name=_("Survey"), related_name="categories")
order = models.IntegerField(_("Display order"), blank=True, null=True)
Expand Down
Loading