• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

badges / shields / 45774165149

22 Nov 2026 09:43PM UTC coverage: 79.735% (-18.4%) from 98.17%
45774165149

push

github

web-flow
[Endpoint] Support message override and position it after label in API docs (#12235)

* [Endpoint] Support message override and position it after label in API docs

* Preserve error message when a message override is provided

3371 of 3616 branches covered (93.22%)

43 of 53 new or added lines in 3 files covered. (81.13%)

9589 existing lines in 490 files now uncovered.

41514 of 52065 relevant lines covered (79.73%)

51.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

79.41
/services/python/python-version-from-toml.service.js
1
import Joi from 'joi'
2 ✔
2
import BaseTomlService from '../../core/base-service/base-toml.js'
2 ✔
3
import { queryParams } from '../index.js'
2 ✔
4
import { url } from '../validators.js'
2 ✔
5

2 ✔
6
const queryParamSchema = Joi.object({
2 ✔
7
  tomlFilePath: url,
2 ✔
8
}).required()
2 ✔
9

2 ✔
10
const schema = Joi.object({
2 ✔
11
  project: Joi.object({
2 ✔
12
    'requires-python': Joi.string().required(),
2 ✔
13
  }).required(),
2 ✔
14
}).required()
2 ✔
15

2 ✔
16
const description = `Shows the required python version for a package based on the values in the requires-python field in PEP 621 compliant pyproject.toml \n
2 ✔
17
a URL of the toml is required, please note that when linking to files in github or similar sites, provide URL to raw file, for example:
2 ✔
18

2 ✔
19
Use https://raw.githubusercontent.com/numpy/numpy/main/pyproject.toml \n
2 ✔
20
And not https://github.com/numpy/numpy/blob/main/pyproject.toml
2 ✔
21
`
2 ✔
22

2 ✔
23
class PythonVersionFromToml extends BaseTomlService {
2 ✔
24
  static category = 'platform-support'
2 ✔
25

2 ✔
26
  static route = {
2 ✔
27
    base: '',
2 ✔
28
    pattern: 'python/required-version-toml',
2 ✔
29
    queryParamSchema,
2 ✔
30
  }
2 ✔
31

2 ✔
32
  static openApi = {
2 ✔
33
    '/python/required-version-toml': {
2 ✔
34
      get: {
2 ✔
35
        summary: 'Python Version from PEP 621 TOML',
2 ✔
36
        description,
2 ✔
37
        parameters: queryParams({
2 ✔
38
          name: 'tomlFilePath',
2 ✔
39
          example:
2 ✔
40
            'https://raw.githubusercontent.com/numpy/numpy/main/pyproject.toml',
2 ✔
41
          required: true,
2 ✔
42
        }),
2 ✔
43
      },
2 ✔
44
    },
2 ✔
45
  }
2 ✔
46

2 ✔
47
  static defaultBadgeData = { label: 'python' }
2 ✔
48

2 ✔
49
  static render({ requiresPythonString }) {
2 ✔
UNCOV
50
    // we only show requries-python as is
×
UNCOV
51
    // for more info read the following issues:
×
UNCOV
52
    // https://github.com/badges/shields/issues/9410
×
UNCOV
53
    // https://github.com/badges/shields/issues/5551
×
UNCOV
54
    return {
×
UNCOV
55
      message: requiresPythonString,
×
UNCOV
56
      color: 'blue',
×
UNCOV
57
    }
×
UNCOV
58
  }
×
59

2 ✔
60
  async handle(namedParams, { tomlFilePath }) {
2 ✔
UNCOV
61
    const tomlData = await this._requestToml({ url: tomlFilePath, schema })
×
UNCOV
62
    const requiresPythonString = tomlData.project['requires-python']
×
UNCOV
63

×
UNCOV
64
    return this.constructor.render({ requiresPythonString })
×
UNCOV
65
  }
×
66
}
2 ✔
67

2 ✔
68
export { PythonVersionFromToml }
2 ✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc