Skip to content
Merged
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
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# badge: https://github.com/xstatic-py/xstatic/workflows/CI/badge.svg?branch=master

name: CI

on:
push:
branches: [ master ]
paths:
- '**.py'
- '**.yml'
- '**.toml'
- '!docs/**'
pull_request:
branches: [ master ]
paths:
- '**.py'
- '**.yml'
- '**.toml'
- '!docs/**'

jobs:
lint:

runs-on: ubuntu-24.04
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1

CI:

needs: lint
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
python-version: '3.9'
- os: ubuntu-24.04
python-version: '3.10'
- os: ubuntu-24.04
python-version: '3.11'
- os: ubuntu-24.04
python-version: '3.12'
- os: ubuntu-24.04
python-version: '3.13'

env:
TOXENV: ${{ matrix.toxenv }}

runs-on: ${{ matrix.os }}
timeout-minutes: 10

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python requirements
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: try building a package
run: python -m build
- name: Install and import xstatic packages (modernize branch)
run: |
python -m venv venv
. venv/bin/activate
pip install .
pip install git+https://github.com/xstatic-py/xstatic-bootstrap.git@modernize
pip install git+https://github.com/xstatic-py/xstatic-font-awesome.git@modernize
python -c "import xstatic; print('Importing...')"
python -c "from xstatic.pkg import bootstrap as xs; assert xs.NAME == 'bootstrap'"
python -c "from xstatic.pkg import font_awesome as xs; assert xs.NAME == 'font_awesome'"
deactivate
rm -rf venv
File renamed without changes.
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
The MIT License (MIT)

Copyright (c) 2011-2018 Thomas Waldmann <tw AT waldmann-edv DOT de> and
other contributors, see AUTHORS.txt.
Copyright (c) 2011-2025 Thomas Waldmann <tw AT waldmann-edv DOT de> and
other contributors, see AUTHORS.rst.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
include README.txt
include README.rst
include LICENSE.txt
include AUTHORS.txt
include AUTHORS.rst

recursive-include docs *.rst

Expand Down
File renamed without changes.
25 changes: 12 additions & 13 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# XStatic documentation build configuration file, created by
# sphinx-quickstart on Fri Jun 24 01:34:29 2011.
Expand All @@ -11,12 +10,12 @@
# All configuration values have a default; values that are commented out
# serve to show the default.

import sys, os

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#sys.path.insert(0, os.path.abspath('.'))
# import sys
# import os
# sys.path.insert(0, os.path.abspath('.'))

# -- General configuration -----------------------------------------------------

Expand All @@ -40,17 +39,17 @@
master_doc = 'index'

# General information about the project.
project = u'XStatic'
copyright = u'2011-2018, Thomas Waldmann'
project = 'XStatic'
copyright = '2011-2025, Thomas Waldmann'

# 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 = '1.0'
version = '2.0'
# The full version, including alpha/beta/rc tags.
release = '1.0.1'
release = '2.0.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down Expand Up @@ -178,8 +177,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'XStatic.tex', u'XStatic Documentation',
u'Thomas Waldmann', 'manual'),
('index', 'XStatic.tex', 'XStatic Documentation',
'Thomas Waldmann', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -211,8 +210,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'xstatic', u'XStatic Documentation',
[u'Thomas Waldmann'], 1)
('index', 'xstatic', 'XStatic Documentation',
['Thomas Waldmann'], 1)
]

# -- Options for Texinfo output ------------------------------------------------
Expand All @@ -221,7 +220,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'XStatic', u'XStatic Documentation', u'Thomas Waldmann',
('index', 'XStatic', 'XStatic Documentation', 'Thomas Waldmann',
'XStatic', 'One line description of project.', 'Miscellaneous'),
]

Expand Down
2 changes: 1 addition & 1 deletion docs/source/license.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ License
Authors
=======

.. include:: ../../AUTHORS.txt
.. include:: ../../AUTHORS.rst

8 changes: 4 additions & 4 deletions docs/source/packaging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ You, as a package maintainer are interested in avoiding duplication, so that
if you need to do a security update, you only need to fix in one place.

XStatic-* packages support this. If you do not want to heavily patch some
Python software that uses XStatic ressource packages, you can alternatively
Python software that uses XStatic resource packages, you can alternatively
just package the XStatic resource packages for your package system.

In case that would add duplication (because you already have a package that
provides the same static files), you can simply remove the static files below
data/ from the XStatic ressource package and adjust the path/filename so it
data/ from the XStatic resource package and adjust the path/filename so it
points to the files provided by that other package.

E.g. for the XStatic-jQuery package, change::
Expand All @@ -139,9 +139,9 @@ To::
BASE_DIR = '/usr/share/javascript/jquery'

Of course you need to make sure that the files at the location you point to
are the same as the ones the XStatic ressource package provides below the
are the same as the ones the XStatic resource package provides below the
data/ directory.

In your package dependencies for your repackaged XStatic ressource package
In your package dependencies for your repackaged XStatic resource package
you would then just require (depend on) the package providing these files.

40 changes: 40 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright: 2011-2025 by the XStatic authors, see AUTHORS.rst for details.
# License: MIT license, see LICENSE.txt for details.

[project]
name = "XStatic"
version = "2.0.0"
description = "XStatic base package with minimal support code"
readme = {file="README.rst", content-type="text/x-rst"}
authors = [{name="Thomas Waldmann", email="tw@waldmann-edv.de"}, ]
maintainers = [{name="Thomas Waldmann", email="tw@waldmann-edv.de"}, ]
requires-python = ">=3.9"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Topic :: Software Development :: Libraries",
"Topic :: System :: Archiving :: Packaging",
"Topic :: System :: Installation/Setup",
"Topic :: System :: Software Distribution",
]
keywords = ["xstatic", "static", "file", "resource", "python", "packages", "pypi", "require"]
license = "MIT"
dependencies = [] # there should never be a dependency!

[project.urls]
"Homepage" = "https://github.com/xstatic-py/xstatic"

[tool.setuptools]
# See also the MANIFEST.in file.
# We want to install all the files in the package directories.
include-package-data = true

[tool.setuptools.packages.find]
where = ["src"]

[build-system]
requires = ["setuptools", "wheel", ]
build-backend = "setuptools.build_meta"
48 changes: 0 additions & 48 deletions setup.py

This file was deleted.

2 changes: 2 additions & 0 deletions src/xstatic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright: 2011-2025 by the XStatic authors, see AUTHORS.rst for details.
# License: MIT license, see LICENSE.txt for details.
8 changes: 4 additions & 4 deletions xstatic/main.py → src/xstatic/main.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Copyright: 2011-2018 by the XStatic authors, see AUTHORS.txt for details.
# Copyright: 2011-2025 by the XStatic authors, see AUTHORS.rst for details.
# License: MIT license, see LICENSE.txt for details.

"""
XStatic - main package with minimal support code to work with static file packages
"""

class XStatic(object):
class XStatic:
"""
minimal support code to access resources from xstatic.pkg.* files
or CDN locations.
Expand All @@ -25,7 +25,7 @@ def __init__(self, module, root_url='/xstatic', provider='local', protocol='http
])
self.provider = provider
if provider == 'local':
self.base_url = "%s/%s" % (root_url, self.name)
self.base_url = f"{root_url}/{self.name}"
else:
self.base_url = self.locations[(provider, protocol)]

Expand All @@ -45,7 +45,7 @@ def url_for(self, path):
"""
loc = self.base_url
if isinstance(loc, str):
loc = "%s/%s" % (loc, path)
loc = f"{loc}/{path}"
elif isinstance(loc, dict):
loc = loc[path]
return loc
Expand Down
4 changes: 0 additions & 4 deletions xstatic/__init__.py

This file was deleted.

4 changes: 0 additions & 4 deletions xstatic/pkg/__init__.py

This file was deleted.