diff --git a/.codecov.yml b/.codecov.yml deleted file mode 100644 index f1a155a8c9..0000000000 --- a/.codecov.yml +++ /dev/null @@ -1,9 +0,0 @@ -coverage: - status: - patch: - default: - target: 100% - project: - default: - target: auto - threshold: 0.1% diff --git a/.github/actions/python-cache-requirements/action.yml b/.github/actions/python-cache-requirements/action.yml index 496a2820d1..42e3d90cf5 100644 --- a/.github/actions/python-cache-requirements/action.yml +++ b/.github/actions/python-cache-requirements/action.yml @@ -12,12 +12,12 @@ runs: - uses: actions/checkout@v3 - uses: actions/setup-python@v5 with: + python-version: '3.8' cache: 'pip' cache-dependency-path: | requirements.txt dev-requirements.txt docs/requirements.txt - - run: | pip install -r ${{ inputs.requirements }} shell: bash diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index b9aa5f3700..80fd07b258 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -3,7 +3,7 @@ name: Check deps on: pull_request: paths: - - setup.py + - pyproject.toml.py - requirements.txt - dev-requirements.txt - docs/requirements.txt @@ -31,13 +31,11 @@ jobs: - name: Install dependencies run: | - pip3 install -c dev-requirements.txt pip-tools + pip install uv - name: Check dependency graph run: | - pip-compile -q --strip-extras - pip-compile -q --strip-extras dev-requirements.in - pip-compile -q --strip-extras docs/requirements.in + make ci_check_deps - name: Verify dependency graph is ok uses: tj-actions/verify-changed-files@v17 diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml index 119219d05a..e81a4f17b3 100644 --- a/.github/workflows/doc.yml +++ b/.github/workflows/doc.yml @@ -20,10 +20,6 @@ jobs: doc: name: Documentation runs-on: ubuntu-latest - container: - image: python:3.8 - env: - LANG: C.UTF-8 steps: - uses: actions/checkout@v3 - uses: ./.github/actions/python-cache-requirements diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 758254c7f1..af100b5450 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -31,7 +31,7 @@ jobs: - name: Install dependencies run: | - pip3 install -c dev-requirements.txt flake8 + pip3 install -c dev-requirements.txt flake8 flake8-pyproject - name: Flake8 run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ceb9dd243f..9c32337659 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Test CI on: @@ -75,11 +72,12 @@ jobs: with: path: | ./venv + ~/.cache/uv - key: pip-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} + key: uv-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} restore-keys: | - pip-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} - pip-${{ matrix.python-version }}-${{ matrix.os }} + uv-${{ matrix.python-version }}-${{ matrix.os }}-${{ hashFiles('./requirements.txt', './dev-requirements.txt', './docs/requirements.txt') }} + uv-${{ matrix.python-version }}-${{ matrix.os }} - name: Prepare test env run: | @@ -112,10 +110,10 @@ jobs: - name: Install python dependencies run: | - python3.8 -m venv ./venv - ./venv/bin/pip3 install --upgrade pip wheel setuptools -c requirements.txt -c dev-requirements.txt - ./venv/bin/pip3 install -r requirements.txt -U - ./venv/bin/pip3 install -r dev-requirements.txt -U + pip install uv + uv venv -p /usr/bin/python${{ matrix.python-version }} venv + . venv/bin/activate + uv pip install -r dev-requirements.txt -U - name: Create test required directories run: | @@ -174,6 +172,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: ./.github/actions/python-cache-requirements + with: + requirements: requirements.txt + + - name: Compile translations + run: | + pip3 install django -c requirements.txt + sudo apt-get -qqy install gettext + django-admin compilemessages + - name: Prepare debian 18.04 versioning run: | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+$' VERSION || sed -i 's/+dev/.ubuntu18.04~dev'$GITHUB_RUN_ID'/' debian/changelog @@ -196,6 +204,16 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - uses: ./.github/actions/python-cache-requirements + with: + requirements: requirements.txt + + - name: Compile translations + run: | + pip3 install django -c requirements.txt + sudo apt-get -qqy install gettext + django-admin compilemessages + - name: Prepare debian 20.04 versioning run: | sed -i 's/+dev/.ubuntu20.04~dev'$GITHUB_RUN_ID'/' debian/changelog diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 7878cc2a25..0000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -graft geotrek -graft mapentity -global-exclude *.py[cod] __pycache__ *.so diff --git a/Makefile b/Makefile index 097f730325..e29e4ee160 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,8 @@ else docker_compose=docker-compose endif +dep_update = uv pip compile -q --strip-extras pyproject.toml --output-file requirements.txt && uv pip compile pyproject.toml -c requirements.txt -q --strip-extras --extra dev --output-file dev-requirements.txt && uv pip compile --strip-extras -q docs/requirements.in --output-file docs/requirements.txt + -include Makefile.perso.mk ########################### @@ -32,7 +34,10 @@ serve: $(docker_compose) up deps: - $(docker_compose) run --rm web bash -c "pip-compile -q --strip-extras && pip-compile -q --strip-extras dev-requirements.in && pip-compile -q --strip-extras docs/requirements.in" + $(docker_compose) run --rm web bash -c "$(dep_update)" + +ci_check_deps: + $(dep_update) flake8: $(docker_compose) run --rm web flake8 geotrek diff --git a/debian/geotrek-admin.links b/debian/geotrek-admin.links index ecf628cf74..85af7cb0e5 100644 --- a/debian/geotrek-admin.links +++ b/debian/geotrek-admin.links @@ -1 +1 @@ -opt/geotrek-admin/bin/manage.py usr/sbin/geotrek \ No newline at end of file +/opt/geotrek-admin/bin/manage.py /usr/sbin/geotrek \ No newline at end of file diff --git a/debian/geotrek-admin.triggers b/debian/geotrek-admin.triggers index 9410395a07..8962f21aa5 100644 --- a/debian/geotrek-admin.triggers +++ b/debian/geotrek-admin.triggers @@ -1,8 +1,6 @@ # Register interest in Python interpreter changes; and # don't make the Python package dependent on the virtualenv package # processing (noawait) -interest-noawait /usr/bin/python3.5 -interest-noawait /usr/bin/python3.6 interest-noawait /usr/bin/python3.8 # Also provide a symbolic trigger for all dh-virtualenv packages diff --git a/dev-requirements.in b/dev-requirements.in deleted file mode 100644 index da5811486b..0000000000 --- a/dev-requirements.in +++ /dev/null @@ -1,11 +0,0 @@ --c requirements.txt - -pip-tools -lxml -tblib -flake8 -freezegun -coverage -factory_boy -django-extensions -django-debug-toolbar \ No newline at end of file diff --git a/dev-requirements.txt b/dev-requirements.txt index 6096e3c253..199c2866ec 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,101 +1,390 @@ -# -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: -# -# pip-compile --strip-extras dev-requirements.in -# +# This file was autogenerated by uv via the following command: +# uv pip compile pyproject.toml -c requirements.txt --strip-extras --extra dev --output-file dev-requirements.txt +amqp==5.1.1 + # via kombu +appy==1.0.15 + # via django-appypod asgiref==3.7.2 + # via django +async-timeout==4.0.3 + # via redis +attrs==23.1.0 + # via fiona +backports-zoneinfo==0.2.1 # via - # -c requirements.txt - # django -build==1.0.0 - # via pip-tools + # celery + # kombu +beautifulsoup4==4.12.2 + # via mapentity +billiard==4.1.0 + # via celery +btrees==5.0 + # via zodb +cachetools==5.3.1 + # via large-image +cairocffi==0.9.0 + # via + # cairosvg + # mapentity + # weasyprint +cairosvg==2.7.1 + # via weasyprint +celery==5.3.4 + # via django-celery-results +certifi==2023.7.22 + # via + # fiona + # requests + # sentry-sdk +cffi==1.16.0 + # via + # cairocffi + # persistent + # pyvips + # weasyprint +chardet==5.2.0 + # via reportlab +charset-normalizer==3.2.0 + # via requests click==8.1.3 # via - # -c requirements.txt - # pip-tools + # celery + # click-didyoumean + # click-plugins + # click-repl + # cligj + # fiona +click-didyoumean==0.3.0 + # via celery +click-plugins==1.1.1 + # via + # celery + # fiona +click-repl==0.3.0 + # via celery +cligj==0.7.2 + # via fiona +coreapi==2.3.3 + # via drf-yasg +coreschema==0.0.4 + # via + # coreapi + # drf-yasg coverage==7.3.1 - # via -r dev-requirements.in +cssselect2==0.7.0 + # via + # cairosvg + # svglib + # weasyprint +datetime==5.2 + # via appy +defusedxml==0.7.1 + # via cairosvg django==3.2.25 # via - # -c requirements.txt + # django-appconf + # django-appypod + # django-celery-results + # django-clearcache # django-debug-toolbar + # django-embed-video # django-extensions + # django-filter + # django-js-asset + # django-large-image + # django-leaflet + # django-modelcluster + # django-modeltranslation + # django-treebeard + # django-weasyprint + # djangorestframework + # drf-yasg + # easy-thumbnails + # mapentity + # paperclip +django-appconf==1.0.5 + # via django-compressor +django-appypod==2.0.7 + # via mapentity +django-celery-results==2.5.1 +django-clearcache==1.2.1 +django-colorfield==0.10.1 +django-compressor==4.3.1 + # via mapentity +django-crispy-forms==1.13.0 + # via mapentity django-debug-toolbar==4.3.0 - # via -r dev-requirements.in +django-embed-video==1.4.9 + # via + # mapentity + # paperclip +django-extended-choices==1.3.3 django-extensions==3.2.3 - # via -r dev-requirements.in +django-filter==22.1 + # via mapentity +django-js-asset==2.0.0 + # via django-mptt +django-large-image==0.8.1 +django-leaflet==0.19.post9 + # via mapentity +django-modelcluster==6.0 +django-modeltranslation==0.18.11 + # via mapentity +django-mptt==0.14.0 +django-tinymce==3.5.0 + # via mapentity +django-treebeard==4.7.1 +django-weasyprint==1.1.0.post2 + # via mapentity +djangorestframework==3.14.0 + # via + # django-large-image + # djangorestframework-datatables + # djangorestframework-gis + # drf-extensions + # drf-yasg + # mapentity +djangorestframework-datatables==0.7.0 + # via mapentity +djangorestframework-gis==1.0 + # via mapentity +docutils==0.20.1 +drf-dynamic-fields==0.4.0 +drf-extensions==0.7.1 +drf-yasg==1.21.5 + # via django-large-image +easy-thumbnails==2.8.5 + # via + # mapentity + # paperclip +env-file==2020.12.3 factory-boy==3.3.0 - # via -r dev-requirements.in faker==19.3.1 # via factory-boy +filelock==3.8.0 + # via django-large-image +fiona==1.9.4.post1 + # via mapentity flake8==6.1.0 - # via -r dev-requirements.in + # via flake8-pyproject +flake8-pyproject==1.2.3 freezegun==1.2.2 - # via -r dev-requirements.in +geojson==2.5.0 + # via tif2geojson +gpxpy==1.5.0 + # via mapentity +gunicorn==21.2.0 +html5lib==1.1 + # via weasyprint +idna==3.4 + # via requests importlib-metadata==6.8.0 # via - # -c requirements.txt - # build + # fiona + # markdown +inflection==0.5.1 + # via drf-yasg +itypes==1.2.0 + # via coreapi +jinja2==3.1.3 + # via coreschema +kombu==5.3.2 + # via celery +landez==2.5.0 +large-image==1.20.3 + # via + # django-large-image + # large-image-source-vips +large-image-source-vips==1.17.2 lxml==4.9.3 # via - # -c requirements.txt - # -r dev-requirements.in + # mapentity + # svglib +mapentity==8.8.0 +markdown==3.4.4 +markupsafe==2.1.3 + # via jinja2 +mbutil==0.3.0 + # via landez mccabe==0.7.0 # via flake8 +numpy==1.23.4 + # via + # large-image + # large-image-source-vips + # shapely packaging==21.3 # via - # -c requirements.txt - # build -pip-tools==7.3.0 - # via -r dev-requirements.in + # drf-yasg + # gunicorn + # large-image-source-vips +palettable==3.3.0 + # via large-image +paperclip==2.7.2 + # via mapentity +papersize==1.3.0 + # via pdfimpose +pdfimpose==1.1.0 +persistent==5.0 + # via + # btrees + # zodb +pillow==10.3.0 + # via + # cairosvg + # django-colorfield + # easy-thumbnails + # large-image + # paperclip + # reportlab + # weasyprint +prompt-toolkit==3.0.39 + # via click-repl +psutil==5.9.5 + # via large-image +psycopg2==2.9.7 pycodestyle==2.11.0 # via flake8 +pycparser==2.21 + # via cffi pyflakes==3.1.0 # via flake8 +pygal==3.0.0 +pymemcache==4.0.0 +pyopenair==1.2.1 pyparsing==3.1.1 - # via - # -c requirements.txt - # packaging -pyproject-hooks==1.0.0 - # via build + # via packaging +pypdf2==1.27.5 + # via pdfimpose +pyphen==0.11.0 + # via weasyprint python-dateutil==2.8.2 # via - # -c requirements.txt + # celery # faker # freezegun +python-magic==0.4.27 + # via paperclip pytz==2023.3.post1 # via - # -c requirements.txt + # datetime # django + # django-modelcluster + # djangorestframework + # djangorestframework-datatables + # drf-yasg +pyvips==2.2.1 + # via large-image-source-vips +rcssmin==1.1.1 + # via django-compressor +redis==4.5.4 +reportlab==4.1.0 + # via + # easy-thumbnails + # svglib +requests==2.31.0 + # via + # coreapi + # django-embed-video + # landez + # mapentity +rjsmin==1.2.1 + # via django-compressor +ruamel-yaml==0.17.35 + # via drf-yasg +ruamel-yaml-clib==0.2.7 + # via ruamel-yaml +sentry-sdk==1.30.0 +setuptools==69.2.0 + # via + # weasyprint + # zc-lockfile + # zodbpickle + # zope-interface +shapely==2.0.2 + # via pyopenair +simplekml==1.3.6 six==1.16.0 # via - # -c requirements.txt + # django-extended-choices + # fiona + # html5lib # python-dateutil + # zodb +soupsieve==2.5 + # via beautifulsoup4 sqlparse==0.4.4 # via - # -c requirements.txt # django # django-debug-toolbar +svglib==1.5.1 + # via easy-thumbnails tblib==3.0.0 - # via -r dev-requirements.in -tomli==2.0.1 +tif2geojson==0.1.3 +tinycss2==1.2.1 # via - # build - # pip-tools - # pyproject-hooks + # cairosvg + # cssselect2 + # svglib + # weasyprint +tomli==2.0.1 + # via flake8-pyproject +transaction==3.1.0 + # via zodb typing-extensions==4.8.0 # via - # -c requirements.txt # asgiref + # django-modeltranslation # faker -wheel==0.41.2 - # via pip-tools + # kombu +tzdata==2023.3 + # via + # backports-zoneinfo + # celery + # mapentity +uritemplate==4.1.1 + # via + # coreapi + # drf-yasg +urllib3==1.26.18 + # via + # requests + # sentry-sdk +values==2020.12.3 + # via env-file +vine==5.0.0 + # via + # amqp + # celery + # kombu +wcwidth==0.2.6 + # via prompt-toolkit +weasyprint==52.5 + # via + # django-weasyprint + # mapentity +webencodings==0.5.1 + # via + # cssselect2 + # html5lib + # tinycss2 +xlrd==2.0.1 +xmltodict==0.13.0 + # via tif2geojson +zc-lockfile==3.0.post1 + # via zodb +zconfig==4.0 + # via zodb zipp==3.17.0 + # via importlib-metadata +zodb==5.8.1 + # via appy +zodbpickle==3.0.1 + # via zodb +zope-interface==6.0 # via - # -c requirements.txt - # importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# pip -# setuptools + # btrees + # datetime + # persistent + # transaction + # zodb diff --git a/docker/Dockerfile b/docker/Dockerfile index a4238717e4..77f0751e1a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -65,23 +65,24 @@ USER root RUN apt-get update -qq && apt-get install -y -qq \ git \ python3.8-dev \ - python3.8-venv \ + python3-pip \ build-essential \ libpq-dev &&\ apt-get clean all && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/* +RUN pip install --no-cache-dir uv + USER geotrek -RUN python3.8 -m venv /opt/venv -RUN /opt/venv/bin/pip install --no-cache-dir -U pip setuptools wheel + +RUN uv venv /opt/venv COPY requirements.txt requirements.txt -RUN /opt/venv/bin/pip install --no-cache-dir -r requirements.txt -U +RUN . /opt/venv/bin/activate && uv pip install -r requirements.txt FROM build as dev COPY dev-requirements.txt dev-requirements.txt -RUN /opt/venv/bin/pip install --no-cache-dir -r dev-requirements.txt COPY ./docs/requirements.txt doc-requirements.txt -RUN /opt/venv/bin/pip install --no-cache-dir -r doc-requirements.txt +RUN . /opt/venv/bin/activate && uv pip sync dev-requirements.txt && uv pip install -r doc-requirements.txt CMD ["./manage.py", "runserver", "0.0.0.0:8000"] @@ -93,7 +94,7 @@ COPY --chown=geotrek:geotrek --from=build /opt/venv /opt/venv COPY --chown=geotrek:geotrek geotrek/ geotrek/ COPY --chown=geotrek:geotrek manage.py manage.py COPY --chown=geotrek:geotrek VERSION VERSION -COPY --chown=geotrek:geotrek setup.cfg setup.cfg +COPY --chown=geotrek:geotrek pyproject.toml pyproject.toml RUN CUSTOM_SETTINGS_FILE= SECRET_KEY=tmp /opt/venv/bin/python ./manage.py compilemessages diff --git a/docs/conf.py b/docs/conf.py index b294f3a58c..4c95034c54 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,63 +1,44 @@ -import sphinx_rtd_theme # noqa import datetime -extensions = [ - 'sphinx.ext.todo', - 'sphinx_rtd_theme', -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = 'Geotrek' -copyright = f'2013-{datetime.date.today().year}, Makina Corpus' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '2.104' -# The full version, including alpha/beta/rc tags. -release = '2.104.2+dev' - -exclude_patterns = ['_build'] - -pygments_style = 'sphinx' - -html_theme = 'sphinx_rtd_theme' - -html_logo = "_static/logo.svg" -html_theme_options = { - "logo_only": True, - 'style_external_links': True, -} -html_favicon = "_static/favicon.png" - -html_static_path = ['_static'] - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Geotrekdoc' - -latex_documents = [ - ('index', 'Geotrek.tex', 'Geotrek Documentation', - 'Makina Corpus', 'manual'), -] - -man_pages = [ - ('index', 'geotrek', 'Geotrek Documentation', - ['Makina Corpus'], 1) -] - -texinfo_documents = [ - ('index', 'Geotrek', 'Geotrek Documentation', - 'Makina Corpus', 'Geotrek', 'One line description of project.', - 'Miscellaneous'), -] +from sphinx_pyproject import SphinxConfig + + +with open("../geotrek/VERSION") as f: + version = f.read().strip() + +config = SphinxConfig( + "../pyproject.toml", + globalns=globals(), + config_overrides={ + "version": version, + "copyright": f"2013-{datetime.date.today().year}, Makina Corpus", + + "html_theme_options": { + "logo_only": True, + "style_external_links": True, + }, + "latex_documents": [ + ( + "index", + "Geotrek.tex", + "Geotrek Documentation", + "Makina Corpus", + "manual", + ), + ], + "man_pages": [ + ("index", "geotrek", "Geotrek Documentation", ["Makina Corpus"], 1) + ], + "texinfo_documents": [ + ( + "index", + "Geotrek", + "Geotrek Documentation", + "Makina Corpus", + "Geotrek", + "One line description of project.", + "Miscellaneous", + ), + ], + }, +) diff --git a/docs/contribute/contributing.rst b/docs/contribute/contributing.rst index 47a37182bc..87c71f0d73 100644 --- a/docs/contribute/contributing.rst +++ b/docs/contribute/contributing.rst @@ -103,12 +103,12 @@ Release On master branch: -* Update files *VERSION*, *docs/conf.py* and *docs/changelog.rst* to remove ``+dev`` suffix and increment version (please use semver rules) +* Update files *pyproject.toml* and *docs/changelog.rst* to remove ``+dev`` suffix and increment version (please use semver rules) * Run ``dch -r -D RELEASED``, update version in the same way and save * Commit with message 'Release x.y.z' and push to ``master`` * Create new release on Github, with tag X.Y.Z, click on "Generate release notes" * Wait for release to be published through CI -* Update files *VERSION*, *docs/conf.py* and *docs/changelog.rst* to add ``+dev`` suffix +* Update files *pyproject.toml* and *docs/changelog.rst* to add ``+dev`` suffix * Run ``dch -v +dev --no-force-save-on-release`` and save * Commit with message 'Back to development' and push to ```master`` diff --git a/docs/contribute/development.rst b/docs/contribute/development.rst index e77ffa228c..6834cc3f65 100644 --- a/docs/contribute/development.rst +++ b/docs/contribute/development.rst @@ -43,19 +43,12 @@ Adding or upgrade dependencies Consider using pip-tools to manage dependencies. -* add your dependencies in ``setup.py`` for general dependencies, ``dev-requirements.in`` for dev dependencies, then run: +* add your dependency in `[project] dependencies` section of `pyproject.toml` file for general dependency, and in `[project.optional-dependencies] dev` for dev dependency, then run : :: make deps -or - -:: - - docker compose run --rm web pip-compile - docker compose run --rm web pip-compile dev-requirements.in - Model modification ================== @@ -138,14 +131,14 @@ run: :: - make flake8 + docker-compose run --rm web flake8 geotrek or :: - docker compose run --rm web flake8 geotrek + make flake8 Run tests diff --git a/docs/requirements.in b/docs/requirements.in index 777752c45e..4eec4fad77 100644 --- a/docs/requirements.in +++ b/docs/requirements.in @@ -1,6 +1,7 @@ --c ../dev-requirements.in +-c ../dev-requirements.txt sphinx-rtd-theme>=1.0.0 sphinx>=4.0.0 sphinx-autobuild -sphinx-intl \ No newline at end of file +sphinx-intl +sphinx-pyproject \ No newline at end of file diff --git a/docs/requirements.txt b/docs/requirements.txt index 4d441ff5c6..6b4ce32d45 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,9 +1,5 @@ -# -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: -# -# pip-compile --strip-extras docs/requirements.in -# +# This file was autogenerated by uv via the following command: +# uv pip compile --strip-extras docs/requirements.in --output-file docs/requirements.txt alabaster==0.7.13 # via sphinx babel==2.14.0 @@ -11,81 +7,65 @@ babel==2.14.0 # sphinx # sphinx-intl certifi==2023.7.22 - # via - # -c docs/../requirements.txt - # requests + # via requests charset-normalizer==3.2.0 - # via - # -c docs/../requirements.txt - # requests + # via requests click==8.1.3 - # via - # -c docs/../requirements.txt - # sphinx-intl + # via sphinx-intl colorama==0.4.6 # via sphinx-autobuild docutils==0.20.1 # via - # -c docs/../requirements.txt # sphinx # sphinx-rtd-theme -idna==3.4 +dom-toml==0.6.1 + # via sphinx-pyproject +domdf-python-tools==3.8.0.post2 # via - # -c docs/../requirements.txt - # requests + # dom-toml + # sphinx-pyproject +idna==3.4 + # via requests imagesize==1.4.1 # via sphinx importlib-metadata==6.8.0 # via - # -c docs/../requirements.txt + # domdf-python-tools # sphinx jinja2==3.1.3 - # via - # -c docs/../requirements.txt - # sphinx + # via sphinx livereload==2.6.3 # via sphinx-autobuild markupsafe==2.1.3 - # via - # -c docs/../requirements.txt - # jinja2 + # via jinja2 +natsort==8.4.0 + # via domdf-python-tools packaging==21.3 - # via - # -c docs/../requirements.txt - # sphinx + # via sphinx pygments==2.17.2 # via sphinx pyparsing==3.1.1 - # via - # -c docs/../requirements.txt - # packaging + # via packaging pytz==2023.3.post1 - # via - # -c docs/../requirements.txt - # babel + # via babel requests==2.31.0 - # via - # -c docs/../requirements.txt - # sphinx + # via sphinx +setuptools==69.2.0 + # via sphinx-intl six==1.16.0 - # via - # -c docs/../requirements.txt - # livereload + # via livereload snowballstemmer==2.2.0 # via sphinx sphinx==7.1.2 # via - # -r docs/requirements.in # sphinx-autobuild # sphinx-intl # sphinx-rtd-theme # sphinxcontrib-jquery sphinx-autobuild==2021.3.14 - # via -r docs/requirements.in sphinx-intl==2.1.0 - # via -r docs/requirements.in +sphinx-pyproject==0.3.0 sphinx-rtd-theme==2.0.0 - # via -r docs/requirements.in sphinxcontrib-applehelp==1.0.4 # via sphinx sphinxcontrib-devhelp==1.0.2 @@ -100,16 +80,13 @@ sphinxcontrib-qthelp==1.0.3 # via sphinx sphinxcontrib-serializinghtml==1.1.5 # via sphinx +toml==0.10.2 + # via dom-toml tornado==6.4 # via livereload +typing-extensions==4.8.0 + # via domdf-python-tools urllib3==1.26.18 - # via - # -c docs/../requirements.txt - # requests + # via requests zipp==3.17.0 - # via - # -c docs/../requirements.txt - # importlib-metadata - -# The following packages are considered to be unsafe in a requirements file: -# setuptools + # via importlib-metadata diff --git a/geotrek/VERSION b/geotrek/VERSION deleted file mode 120000 index 6ff19de4b8..0000000000 --- a/geotrek/VERSION +++ /dev/null @@ -1 +0,0 @@ -../VERSION \ No newline at end of file diff --git a/geotrek/VERSION b/geotrek/VERSION new file mode 100644 index 0000000000..127ad7460d --- /dev/null +++ b/geotrek/VERSION @@ -0,0 +1 @@ +2.103.2+dev \ No newline at end of file diff --git a/geotrek/__init__.py b/geotrek/__init__.py index ac3c3c6f01..40967ee1ab 100755 --- a/geotrek/__init__.py +++ b/geotrek/__init__.py @@ -1,6 +1,27 @@ import os +import pwd +import sys here = os.path.abspath(os.path.dirname(__file__)) -with open(os.path.join(here, 'VERSION')) as file_version: - __version__ = file_version.read().strip() +with open(os.path.join(here, "VERSION")) as file_version: + VERSION = file_version.read().strip() + +__version__ = VERSION + + +def django_manage(): # pragma: no cover + """Use by geotrek command in debian based installations""" + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "geotrek.settings") + + from django.core.management import execute_from_command_line + + if sys.argv[0].endswith("geotrek"): + if os.getuid() != 0: + print("ERROR! This command should be run as root") + sys.exit(1) + user = pwd.getpwnam("geotrek") + os.setgid(user.pw_gid) + os.setuid(user.pw_uid) + + execute_from_command_line(sys.argv) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000000..dc64399e7a --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,157 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +dynamic = ["version"] +name = "geotrek" +description = "Geotrek" +requires-python = ">= 3.8" +authors = [ + { name = "Makina Corpus", email = 'geobi@makina-corpus.com' }, +] + +dependencies = [ + 'Django==3.2.*', + 'mapentity', + 'chardet', + 'cairosvg', + 'cairocffi', + 'env_file', + 'pymemcache', + 'coreschema', + 'coreapi', + 'psycopg2', + 'pdfimpose', + 'docutils', + 'Pillow', + 'simplekml', + 'pygal', + 'paperclip', + 'django-extended-choices', + 'django-modelcluster', + 'django-mptt', + 'geojson', + 'tif2geojson', + 'drf-dynamic-fields', + 'drf-yasg', + 'xlrd', + 'landez', + 'large-image-source-vips', + 'django-large-image', + 'celery', + 'redis', + 'django-celery-results', + 'drf-extensions', + 'django-colorfield', + 'Fiona', + 'markdown', + "weasyprint==52.5", + 'django-weasyprint<2.0.0', + "django-clearcache", + 'django-treebeard', + "easy-thumbnails[svg]", + "pyopenair", + 'gunicorn', + 'sentry-sdk', +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Web Environment", + "Framework :: Django", + "Natural Language :: English", + "Programming Language :: Python :: 3", +] +readme = "README.rst" +license = {file = "LICENSE"} +keywords = ["Python", "Django", "GIS", "Tourism", "Trekking"] + +[project.optional-dependencies] +dev = [ + "tblib", + "lxml", + "flake8", + "flake8-pyproject", + "freezegun", + "coverage", + "factory_boy", + "django-extensions", + "django-debug-toolbar", +] + +[project.urls] +Homepage = "https://geotrek.fr" +Documentation = "https://geotrek.readthedocs.org" +Repository = "https://github.com/GeotrekCE/Geotrek-admin.git" +Issues = "https://github.com/GeotrekCE/Geotrek-admin/issues" +Changelog = "https://github.com/GeotrekCE/Geotrek-admin/docs/changelog.rst" + +[project.scripts] +"manage.py" = "geotrek:django_manage" + +[tool.sphinx-pyproject] +github_repository = "https://github.com/GeotrekCE/Geotrek-admin.git" +author = "Makina Corpus" +project = "Geotrek-admin" +extensions = [ + 'sphinx.ext.todo', + 'sphinx_rtd_theme' +] +templates_path = [ "_templates",] +html_static_path = [ "_static",] +html_favicon = "_static/favicon.png" +source_suffix = ".rst" +master_doc = "index" +exclude_patterns = ['_build'] +suppress_warnings = [ "image.nonlocal_uri",] +pygments_style = "sphinx" +html_theme = 'sphinx_rtd_theme' +html_logo = "_static/logo.svg" + +[tool.coverage.run] +source = [ + 'geotrek' +] + +omit = [ + '*/tests/*', + '*/migrations/*', + '*/settings/*', + '*/test_runner.py', + '*/test_global.py', + 'wsgi.py' +] +data_file = "var/.coverage" + +[tool.coverage.report] +ignore_errors = true +exclude_lines = [ + 'pragma: no cover', + 'if settings.DEBUG or settings.TEST:', + 'from django.contrib.admin import ModelAdmin as TabbedTranslationAdmin, TabularInline as TranslationTabularInline', + 'from django.contrib.admin import ModelAdmin as TabbedTranslationAdmin', + 'pragma: no cover' +] + +[tool.flake8] +ignore = "E501,W503" +exclude = "geotrek/settings,conf" + +[tool.hatch.version] +path = "geotrek/VERSION" +pattern = "(?P.*)" + +[tool.hatch.build] +include = [ + "geotrek", +] +exclude = [ + "*.pyc", + "test*.py", + "**/__pycache__/*", + "*.so", + "**/tests/*" +] +artifacts = [ + "*.mo", +] diff --git a/requirements.txt b/requirements.txt index ad5a0de061..09f10fb719 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,5 @@ -# -# This file is autogenerated by pip-compile with Python 3.8 -# by the following command: -# -# pip-compile --strip-extras -# +# This file was autogenerated by uv via the following command: +# uv pip compile --strip-extras pyproject.toml --output-file requirements.txt amqp==5.1.1 # via kombu appy==1.0.15 @@ -29,17 +25,12 @@ cachetools==5.3.1 cairocffi==0.9.0 # via # cairosvg - # geotrek (setup.py) # mapentity # weasyprint cairosvg==2.7.1 - # via - # geotrek (setup.py) - # weasyprint + # via weasyprint celery==5.3.4 - # via - # django-celery-results - # geotrek (setup.py) + # via django-celery-results certifi==2023.7.22 # via # fiona @@ -52,9 +43,7 @@ cffi==1.16.0 # pyvips # weasyprint chardet==5.2.0 - # via - # geotrek (setup.py) - # reportlab + # via reportlab charset-normalizer==3.2.0 # via requests click==8.1.3 @@ -76,14 +65,11 @@ click-repl==0.3.0 cligj==0.7.2 # via fiona coreapi==2.3.3 - # via - # drf-yasg - # geotrek (setup.py) + # via drf-yasg coreschema==0.0.4 # via # coreapi # drf-yasg - # geotrek (setup.py) cssselect2==0.7.0 # via # cairosvg @@ -111,7 +97,6 @@ django==3.2.25 # djangorestframework # drf-yasg # easy-thumbnails - # geotrek (setup.py) # mapentity # paperclip django-appconf==1.0.5 @@ -119,11 +104,8 @@ django-appconf==1.0.5 django-appypod==2.0.7 # via mapentity django-celery-results==2.5.1 - # via geotrek (setup.py) django-clearcache==1.2.1 - # via geotrek (setup.py) django-colorfield==0.10.1 - # via geotrek (setup.py) django-compressor==4.3.1 # via mapentity django-crispy-forms==1.13.0 @@ -133,29 +115,22 @@ django-embed-video==1.4.9 # mapentity # paperclip django-extended-choices==1.3.3 - # via geotrek (setup.py) django-filter==22.1 # via mapentity django-js-asset==2.0.0 # via django-mptt django-large-image==0.8.1 - # via geotrek (setup.py) django-leaflet==0.19.post9 # via mapentity django-modelcluster==6.0 - # via geotrek (setup.py) django-modeltranslation==0.18.11 # via mapentity django-mptt==0.14.0 - # via geotrek (setup.py) django-tinymce==3.5.0 # via mapentity django-treebeard==4.7.1 - # via geotrek (setup.py) django-weasyprint==1.1.0.post2 - # via - # geotrek (setup.py) - # mapentity + # via mapentity djangorestframework==3.14.0 # via # django-large-image @@ -169,36 +144,24 @@ djangorestframework-datatables==0.7.0 djangorestframework-gis==1.0 # via mapentity docutils==0.20.1 - # via geotrek (setup.py) drf-dynamic-fields==0.4.0 - # via geotrek (setup.py) drf-extensions==0.7.1 - # via geotrek (setup.py) drf-yasg==1.21.5 - # via - # django-large-image - # geotrek (setup.py) + # via django-large-image easy-thumbnails==2.8.5 # via - # geotrek (setup.py) # mapentity # paperclip env-file==2020.12.3 - # via geotrek (setup.py) filelock==3.8.0 # via django-large-image fiona==1.9.4.post1 - # via - # geotrek (setup.py) - # mapentity + # via mapentity geojson==2.5.0 - # via - # geotrek (setup.py) - # tif2geojson + # via tif2geojson gpxpy==1.5.0 # via mapentity gunicorn==21.2.0 - # via geotrek (setup.py) html5lib==1.1 # via weasyprint idna==3.4 @@ -216,21 +179,17 @@ jinja2==3.1.3 kombu==5.3.2 # via celery landez==2.5.0 - # via geotrek (setup.py) large-image==1.20.3 # via # django-large-image # large-image-source-vips large-image-source-vips==1.17.2 - # via geotrek (setup.py) lxml==4.9.3 # via # mapentity # svglib mapentity==8.8.0 - # via geotrek (setup.py) markdown==3.4.4 - # via geotrek (setup.py) markupsafe==2.1.3 # via jinja2 mbutil==0.3.0 @@ -248,13 +207,10 @@ packaging==21.3 palettable==3.3.0 # via large-image paperclip==2.7.2 - # via - # geotrek (setup.py) - # mapentity + # via mapentity papersize==1.3.0 # via pdfimpose pdfimpose==1.1.0 - # via geotrek (setup.py) persistent==5.0 # via # btrees @@ -264,7 +220,6 @@ pillow==10.3.0 # cairosvg # django-colorfield # easy-thumbnails - # geotrek (setup.py) # large-image # paperclip # reportlab @@ -274,15 +229,11 @@ prompt-toolkit==3.0.39 psutil==5.9.5 # via large-image psycopg2==2.9.7 - # via geotrek (setup.py) pycparser==2.21 # via cffi pygal==3.0.0 - # via geotrek (setup.py) pymemcache==4.0.0 - # via geotrek (setup.py) pyopenair==1.2.1 - # via geotrek (setup.py) pyparsing==3.1.1 # via packaging pypdf2==1.27.5 @@ -306,7 +257,6 @@ pyvips==2.2.1 rcssmin==1.1.1 # via django-compressor redis==4.5.4 - # via geotrek (setup.py) reportlab==4.1.0 # via # easy-thumbnails @@ -324,11 +274,15 @@ ruamel-yaml==0.17.35 ruamel-yaml-clib==0.2.7 # via ruamel-yaml sentry-sdk==1.30.0 - # via geotrek (setup.py) +setuptools==69.2.0 + # via + # weasyprint + # zc-lockfile + # zodbpickle + # zope-interface shapely==2.0.2 # via pyopenair simplekml==1.3.6 - # via geotrek (setup.py) six==1.16.0 # via # django-extended-choices @@ -343,7 +297,6 @@ sqlparse==0.4.4 svglib==1.5.1 # via easy-thumbnails tif2geojson==0.1.3 - # via geotrek (setup.py) tinycss2==1.2.1 # via # cairosvg @@ -382,7 +335,6 @@ wcwidth==0.2.6 weasyprint==52.5 # via # django-weasyprint - # geotrek (setup.py) # mapentity webencodings==0.5.1 # via @@ -390,7 +342,6 @@ webencodings==0.5.1 # html5lib # tinycss2 xlrd==2.0.1 - # via geotrek (setup.py) xmltodict==0.13.0 # via tif2geojson zc-lockfile==3.0.post1 @@ -410,6 +361,3 @@ zope-interface==6.0 # persistent # transaction # zodb - -# The following packages are considered to be unsafe in a requirements file: -# setuptools diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 81e191427e..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,23 +0,0 @@ -[flake8] -ignore = E501,W503 -exclude = geotrek/settings,conf - -[coverage:run] -source = - geotrek -omit = - */tests/* - */migrations/* - */settings/* - */test_runner.py - */test_global.py - wsgi.py -data_file = var/.coverage - -[coverage:report] -ignore_errors = true -exclude_lines = - if settings.DEBUG or settings.TEST: - from django.contrib.admin import ModelAdmin as TabbedTranslationAdmin, TabularInline as TranslationTabularInline - from django.contrib.admin import ModelAdmin as TabbedTranslationAdmin - pragma: no cover diff --git a/setup.py b/setup.py deleted file mode 100644 index 7025def28b..0000000000 --- a/setup.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/python3 -import os -import distutils.command.build -from pathlib import Path -from setuptools import setup, find_packages -from shutil import copy - -here = os.path.abspath(os.path.dirname(__file__)) - - -class BuildCommand(distutils.command.build.build): - def run(self): - distutils.command.build.build.run(self) - from django.core.management import call_command - curdir = os.getcwd() - for subdir in ('geotrek', ): - os.chdir(subdir) - call_command('compilemessages') - for path in Path('.').rglob('*.mo'): - copy(path, os.path.join(curdir, self.build_lib, subdir, path)) - os.chdir(curdir) - - -setup( - name='geotrek', - version=open(os.path.join(here, 'VERSION')).read().strip(), - author='Makina Corpus', - author_email='geobi@makina-corpus.com', - url='https://makina-corpus.com', - description="Geotrek", - scripts=['manage.py'], - install_requires=[ - 'Django==3.2.*', - 'mapentity', - 'chardet', - 'cairosvg', - 'cairocffi', - 'env_file', - # pinned by requirements.txt - 'pymemcache', - 'coreschema', - 'coreapi', - 'psycopg2', - 'pdfimpose', - 'docutils', - 'Pillow', - 'simplekml', - 'pygal', - 'paperclip', - 'django-extended-choices', - 'django-modelcluster', - 'django-mptt', - 'geojson', - 'tif2geojson', - 'drf-dynamic-fields', - 'drf-yasg', - 'xlrd', - 'landez', - 'large-image-source-vips', - 'django-large-image', - 'celery', - 'redis', - 'django-celery-results', - 'drf-extensions', - 'django-colorfield', - 'Fiona', - 'markdown', - "weasyprint==52.5", # newer version required libpango (not available in bionic) - 'django-weasyprint<2.0.0', # 2.10 require weasyprint > 53 - "django-clearcache", - "pyopenair", - "django-treebeard", - # prod, - 'gunicorn', - 'sentry-sdk', - 'easy-thumbnails[svg]', - ], - cmdclass={"build": BuildCommand}, - include_package_data=True, - license='BSD, see LICENSE file.', - packages=find_packages(), - classifiers=['Natural Language :: English', - 'Environment :: Web Environment', - 'Framework :: Django', - 'Development Status :: 5 - Production/Stable', - 'Programming Language :: Python :: 3'], -)