diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e49e5daa9..43e354684 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,55 +2,55 @@ name: "CodeQL" on: push: - branches: [ master, 0.9.x, 1.0.x, 1.1.x ] + branches: [master, 0.9.x, 1.0.x, 1.1.x] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [master] schedule: - - cron: '45 9 * * 0' + - cron: "45 9 * * 0" jobs: analyze: name: Analyze - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - language: [ 'javascript', 'python' ] + language: ["javascript", "python"] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + - name: Checkout repository + uses: actions/checkout@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2fd0d90d8..07c06fadd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,15 +2,15 @@ name: Run tests on: push: - branches: [ master, 1.0.x, 1.1.x ] + branches: [master, 1.0.x, 1.1.x] pull_request: # The branches below must be a subset of the branches above - branches: [ master, 1.0.x, 1.1.x ] + branches: [master, 1.0.x, 1.1.x] workflow_dispatch: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 services: redis: @@ -38,13 +38,13 @@ jobs: strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + python-version: ["3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 - name: Install global dependencies run: | - sudo apt-get -y install libcairo2-dev librrd-dev libboost-python-dev redis-tools + sudo apt-get -y install libcairo2-dev librrd-dev libboost-python-dev redis-tools python3-distutils-extra - name: Verify Redis connection env: REDIS_PORT: ${{ job.services.redis.ports[6379] }} @@ -66,7 +66,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - python -m pip install --upgrade pip 'setuptools<58' --force-reinstall + python -m pip install --upgrade pip 'setuptools>=67.0.0' wheel --force-reinstall pip install 'tox<4' tox-gh-actions flake8 pytest pytz if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Test with tox @@ -102,4 +102,4 @@ jobs: codecov - name: Upload coverage to Codecov if: ${{ matrix.python-version==3.13 }} - uses: codecov/codecov-action@v5 \ No newline at end of file + uses: codecov/codecov-action@v5 diff --git a/setup.py b/setup.py index 508ae6117..ddd145e10 100644 --- a/setup.py +++ b/setup.py @@ -18,48 +18,56 @@ # required for installations from a source tarball because running # ``python setup.py sdist`` will re-add the prefix to the tarball's # ``setup.cfg``. -with open('setup.cfg', 'r') as f: +with open("setup.cfg", "r") as f: orig_setup_cfg = f.read() cf = ConfigParser() -cf.read_file(StringIO(orig_setup_cfg), 'setup.cfg') +cf.read_file(StringIO(orig_setup_cfg), "setup.cfg") -if os.environ.get('GRAPHITE_NO_PREFIX') or os.environ.get('READTHEDOCS'): - cf.remove_section('install') +if os.environ.get("GRAPHITE_NO_PREFIX") or os.environ.get("READTHEDOCS"): + cf.remove_section("install") else: try: - cf.add_section('install') + cf.add_section("install") except DuplicateSectionError: pass - if not cf.has_option('install', 'prefix'): - cf.set('install', 'prefix', '/opt/graphite') - if not cf.has_option('install', 'install-lib'): - cf.set('install', 'install_lib', '%(prefix)s/webapp') + if not cf.has_option("install", "prefix"): + cf.set("install", "prefix", "/opt/graphite") + if not cf.has_option("install", "install-lib"): + cf.set("install", "install_lib", "%(prefix)s/webapp") -with open('setup.cfg', 'w') as f: +with open("setup.cfg", "w") as f: cf.write(f) -if os.environ.get('USE_DISTUTILS'): +if os.environ.get("USE_DISTUTILS"): # skipcq: PYL-W0402 from distutils.core import setup + setup_kwargs = dict() else: from setuptools import setup + setup_kwargs = dict(zip_safe=0) storage_dirs = [] -for subdir in ('whisper/dummy.txt', 'ceres/dummy.txt', 'rrd/dummy.txt', 'log/dummy.txt', 'log/webapp/dummy.txt'): - storage_dirs.append( ('storage/%s' % subdir, []) ) +for subdir in ( + "whisper/dummy.txt", + "ceres/dummy.txt", + "rrd/dummy.txt", + "log/dummy.txt", + "log/webapp/dummy.txt", +): + storage_dirs.append(("storage/%s" % subdir, [])) webapp_content = defaultdict(list) -for root, dirs, files in os.walk('webapp/content'): +for root, dirs, files in os.walk("webapp/content"): for filename in files: filepath = os.path.join(root, filename) webapp_content[root].append(filepath) -conf_files = [('conf', glob('conf/*.example'))] -examples = [('examples', glob('examples/example-*'))] +conf_files = [("conf", glob("conf/*.example"))] +examples = [("examples", glob("examples/example-*"))] def read(fname): @@ -70,60 +78,67 @@ def read(fname): try: setup( - name='graphite-web', - version='1.2.0', - url='http://graphiteapp.org/', - author='Chris Davis', - author_email='chrismd@gmail.com', - license='Apache Software License 2.0', - description='Enterprise scalable realtime graphing', - long_description=read('README.md'), - long_description_content_type='text/markdown', - package_dir={'' : 'webapp'}, - packages=[ - 'graphite', - 'graphite.account', - 'graphite.account.migrations', - 'graphite.browser', - 'graphite.composer', - 'graphite.dashboard', - 'graphite.dashboard.migrations', - 'graphite.events', - 'graphite.events.migrations', - 'graphite.finders', - 'graphite.functions', - 'graphite.functions.custom', - 'graphite.metrics', - 'graphite.readers', - 'graphite.render', - 'graphite.tags', - 'graphite.tags.migrations', - 'graphite.url_shortener', - 'graphite.url_shortener.migrations', - 'graphite.version', - 'graphite.whitelist', - 'graphite.worker_pool', - ], - package_data={'graphite': ['templates/*', 'local_settings.py.example']}, - scripts=glob('bin/*'), - data_files=list(webapp_content.items()) + storage_dirs + conf_files + examples, - install_requires=['Django>=4.2,<6', 'django-tagging', 'pytz', - 'pyparsing', 'cairocffi', 'urllib3', 'six'], - classifiers=[ - 'Intended Audience :: Developers', - 'Natural Language :: English', - 'License :: OSI Approved :: Apache Software License', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: Implementation :: CPython', - 'Programming Language :: Python :: Implementation :: PyPy', - ], - **setup_kwargs + name="graphite-web", + version="1.2.0", + url="http://graphiteapp.org/", + author="Chris Davis", + author_email="chrismd@gmail.com", + license="Apache Software License 2.0", + description="Enterprise scalable realtime graphing", + long_description=read("README.md"), + long_description_content_type="text/markdown", + package_dir={"": "webapp"}, + packages=[ + "graphite", + "graphite.account", + "graphite.account.migrations", + "graphite.browser", + "graphite.composer", + "graphite.dashboard", + "graphite.dashboard.migrations", + "graphite.events", + "graphite.events.migrations", + "graphite.finders", + "graphite.functions", + "graphite.functions.custom", + "graphite.metrics", + "graphite.readers", + "graphite.render", + "graphite.tags", + "graphite.tags.migrations", + "graphite.url_shortener", + "graphite.url_shortener.migrations", + "graphite.version", + "graphite.whitelist", + "graphite.worker_pool", + ], + package_data={"graphite": ["templates/*", "local_settings.py.example"]}, + scripts=glob("bin/*"), + data_files=list(webapp_content.items()) + storage_dirs + conf_files + examples, + install_requires=[ + "Django>=4.2,<6", + "django-tagging", + "pytz", + "pyparsing", + "cairocffi", + "urllib3", + "six", + ], + classifiers=[ + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + ], + **setup_kwargs ) finally: - with open('setup.cfg', 'w') as f: + with open("setup.cfg", "w") as f: f.write(orig_setup_cfg) diff --git a/tox.ini b/tox.ini index 26b50f68c..b7cb0b352 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,5 @@ [gh-actions] python = - 3.9: py39 3.10: py310 3.11: py311 3.12: py312 @@ -8,7 +7,7 @@ python = [tox] envlist = - py{39,310,311,312,313},lint,docs + py{310,311,312,313},lint,docs [testenv] whitelist_externals =