backports-httpmethod 0.0.1a1__tar.gz → 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,3 +34,7 @@ updates:
34
34
  - "edgarrmondragon"
35
35
  commit-message:
36
36
  prefix: "ci: "
37
+ groups:
38
+ actions:
39
+ patterns:
40
+ - "*"
@@ -0,0 +1 @@
1
+ hatch==1.9.3
@@ -0,0 +1,37 @@
1
+ name: Build
2
+
3
+ on:
4
+ push:
5
+
6
+ permissions:
7
+ contents: write
8
+ id-token: write
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: hynek/build-and-inspect-python-package@v2
16
+
17
+ publish:
18
+ runs-on: ubuntu-latest
19
+ needs: build
20
+ environment: publish
21
+ if: startsWith(github.ref, 'refs/tags/')
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ - uses: actions/download-artifact@v4
25
+ with:
26
+ name: Packages
27
+ path: dist
28
+ - name: Upload wheel to release
29
+ uses: svenstaro/upload-release-action@v2
30
+ with:
31
+ file: dist/*.whl
32
+ tag: ${{ github.ref }}
33
+ overwrite: true
34
+ file_glob: true
35
+
36
+ - name: Publish
37
+ uses: pypa/gh-action-pypi-publish@v1.8.11
@@ -7,7 +7,7 @@ on:
7
7
  - src/**
8
8
  - tests/**
9
9
  - pyproject.toml
10
- - .github/workflows/test.yml
10
+ - .github/workflows/test.yaml
11
11
  - .github/workflows/constraints.txt
12
12
  pull_request:
13
13
  branches: [ main ]
@@ -15,7 +15,7 @@ on:
15
15
  - src/**
16
16
  - tests/**
17
17
  - pyproject.toml
18
- - .github/workflows/test.yml
18
+ - .github/workflows/test.yaml
19
19
  - .github/workflows/constraints.txt
20
20
  workflow_dispatch: {}
21
21
  schedule:
@@ -25,21 +25,25 @@ concurrency:
25
25
  cancel-in-progress: true
26
26
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
27
27
 
28
+ env:
29
+ FORCE_COLOR: "1"
30
+
28
31
  jobs:
29
32
  lint:
30
33
  name: Lint
31
34
  runs-on: ubuntu-latest
32
35
  steps:
33
36
  - uses: actions/checkout@v4
34
- - uses: actions/setup-python@v4
37
+ - uses: actions/setup-python@v5
38
+ id: setup-python
35
39
  with:
36
- cache: pip
37
- python-version: "3.10"
40
+ cache: pip
41
+ python-version: "3.12"
38
42
  - name: Install dependencies
39
43
  env:
40
44
  PIP_CONSTRAINT: .github/workflows/constraints.txt
41
45
  run: |
42
- pipx install hatch
46
+ pipx install --python '${{ steps.setup-python.outputs.python-path }}' hatch
43
47
  - name: Run lint
44
48
  env:
45
49
  HATCH_ENV: lint
@@ -49,12 +53,12 @@ jobs:
49
53
  test:
50
54
  name: Pytest (Python ${{ matrix.python-version }}, ${{ matrix.os }})
51
55
  runs-on: ${{ matrix.os }}
52
- continue-on-error: ${{ matrix.python-version == '3.12' }}
56
+ continue-on-error: ${{ matrix.python-version == '3.13' }}
53
57
  strategy:
54
58
  fail-fast: false
55
59
  matrix:
56
60
  os: ["ubuntu-latest"]
57
- python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
61
+ python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
58
62
  include:
59
63
  - python-version: "3.12"
60
64
  os: "windows-latest"
@@ -62,19 +66,12 @@ jobs:
62
66
  os: "macos-latest"
63
67
  steps:
64
68
  - uses: actions/checkout@v4
65
- - uses: actions/setup-python@v4
69
+ - uses: actions/setup-python@v5
70
+ id: setup-python
66
71
  with:
67
- cache: pip
68
- python-version: ${{ matrix.python-version }}
69
- allow-prereleases: true
70
- architecture: x64
71
- - name: Install dependencies
72
- env:
73
- PIP_CONSTRAINT: .github/workflows/constraints.txt
74
- run: |
75
- pipx install hatch
76
- - name: Run tests
77
- env:
78
- HATCH_ENV: test
79
- run: |
80
- hatch run test
72
+ cache: pip
73
+ python-version: ${{ matrix.python-version }}
74
+ allow-prereleases: true
75
+ architecture: x64
76
+ - run: pip install .
77
+ - run: python -Im unittest -v
@@ -0,0 +1,31 @@
1
+ ci:
2
+ autofix_commit_msg: "chore: Fix lint errors"
3
+ autofix_prs: true
4
+ autoupdate_branch: main
5
+ autoupdate_commit_msg: "chore: Update pre-commit hooks"
6
+ autoupdate_schedule: weekly
7
+ submodules: false
8
+
9
+ repos:
10
+ - repo: https://github.com/pre-commit/pre-commit-hooks
11
+ rev: v4.5.0
12
+ hooks:
13
+ - id: check-merge-conflict
14
+ - id: check-toml
15
+ - id: end-of-file-fixer
16
+ - id: no-commit-to-branch
17
+ args: [--branch, main]
18
+ - id: trailing-whitespace
19
+
20
+ - repo: https://github.com/astral-sh/ruff-pre-commit
21
+ rev: v0.2.0
22
+ hooks:
23
+ - id: ruff
24
+ args: [--fix, --exit-non-zero-on-fix, --show-fixes]
25
+ - id: ruff
26
+ entry: ruff format
27
+
28
+ - repo: https://github.com/tox-dev/pyproject-fmt
29
+ rev: "1.7.0"
30
+ hooks:
31
+ - id: pyproject-fmt
@@ -1,12 +1,21 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: backports-httpmethod
3
- Version: 0.0.1a1
3
+ Version: 0.2.0
4
4
  Summary: A backport of Python 3.11+ `http.HTTPMethod` enum
5
5
  Project-URL: Documentation, https://github.com/edgarrmondragon/backports.httpmethod#readme
6
6
  Project-URL: Issues, https://github.com/edgarrmondragon/backports.httpmethod/issues
7
7
  Project-URL: Source, https://github.com/edgarrmondragon/backports.httpmethod
8
8
  Author-email: Edgar Ramírez-Mondragón <edgarrmondragon@hey.com>
9
- License-Expression: MIT
9
+ Maintainer-email: Edgar Ramírez-Mondragón <edgarrmondragon@hey.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2023-present Edgar Ramírez-Mondragón <edgarrmondragon@hey.com>
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10
19
  License-File: LICENSE
11
20
  Keywords: backports,enum,http,httpmethod
12
21
  Classifier: Development Status :: 4 - Beta
@@ -18,14 +27,11 @@ Classifier: Programming Language :: Python :: 3.9
18
27
  Classifier: Programming Language :: Python :: 3.10
19
28
  Classifier: Programming Language :: Python :: 3.11
20
29
  Classifier: Programming Language :: Python :: 3.12
30
+ Classifier: Programming Language :: Python :: 3.13
21
31
  Classifier: Programming Language :: Python :: Implementation :: CPython
22
32
  Classifier: Programming Language :: Python :: Implementation :: PyPy
23
33
  Requires-Python: >=3.7
24
- Requires-Dist: backports-strenum
25
- Provides-Extra: dev
26
- Requires-Dist: backports-httpmethod[test]; extra == 'dev'
27
- Provides-Extra: test
28
- Requires-Dist: pytest; extra == 'test'
34
+ Requires-Dist: backports-strenum; python_version < '3.11'
29
35
  Description-Content-Type: text/markdown
30
36
 
31
37
  # backports.httpmethod
@@ -15,7 +15,10 @@ keywords = [
15
15
  "http",
16
16
  "httpmethod",
17
17
  ]
18
- license = "MIT"
18
+ license.file = "LICENSE"
19
+ maintainers = [
20
+ { name = "Edgar Ramírez-Mondragón", email = "edgarrmondragon@hey.com" },
21
+ ]
19
22
  authors = [
20
23
  { name = "Edgar Ramírez-Mondragón", email = "edgarrmondragon@hey.com" },
21
24
  ]
@@ -30,6 +33,7 @@ classifiers = [
30
33
  "Programming Language :: Python :: 3.10",
31
34
  "Programming Language :: Python :: 3.11",
32
35
  "Programming Language :: Python :: 3.12",
36
+ "Programming Language :: Python :: 3.13",
33
37
  "Programming Language :: Python :: Implementation :: CPython",
34
38
  "Programming Language :: Python :: Implementation :: PyPy",
35
39
  ]
@@ -37,19 +41,11 @@ dynamic = [
37
41
  "version",
38
42
  ]
39
43
  dependencies = [
40
- "backports.strenum",
41
- ]
42
- [project.optional-dependencies]
43
- dev = [
44
- "backports.httpmethod[test]",
45
- ]
46
- test = [
47
- "pytest",
44
+ 'backports.strenum; python_version < "3.11"',
48
45
  ]
49
- [project.urls]
50
- Documentation = "https://github.com/edgarrmondragon/backports.httpmethod#readme"
51
- Issues = "https://github.com/edgarrmondragon/backports.httpmethod/issues"
52
- Source = "https://github.com/edgarrmondragon/backports.httpmethod"
46
+ urls.Documentation = "https://github.com/edgarrmondragon/backports.httpmethod#readme"
47
+ urls.Issues = "https://github.com/edgarrmondragon/backports.httpmethod/issues"
48
+ urls.Source = "https://github.com/edgarrmondragon/backports.httpmethod"
53
49
 
54
50
  [tool.hatch.build.targets.wheel]
55
51
  packages = ["src/backports"]
@@ -57,13 +53,17 @@ packages = ["src/backports"]
57
53
  [tool.hatch.version]
58
54
  source = "vcs"
59
55
 
60
- [tool.hatch.envs.test]
61
- features = ["test"]
62
- [tool.hatch.envs.test.scripts]
63
- test = "pytest {args:tests}"
56
+ [tool.hatch.envs.default]
57
+ [tool.hatch.envs.default.overrides]
58
+ env.GITHUB_ACTIONS.dev-mode = { value = false, if = ["true"] }
59
+ matrix.python.env-vars = [
60
+ { key = "COVERAGE_CORE", value = "sysmon", if = ["3.12", "3.13"] }
61
+ ]
62
+ [tool.hatch.envs.default.scripts]
63
+ test = "python -Im unittest {args}"
64
64
 
65
- [[tool.hatch.envs.test.matrix]]
66
- python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
65
+ [[tool.hatch.envs.all.matrix]]
66
+ python = ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
67
67
 
68
68
  [tool.hatch.envs.lint]
69
69
  dependencies = [
@@ -88,6 +88,7 @@ all = [
88
88
 
89
89
  [tool.ruff]
90
90
  line-length = 120
91
+ preview = true
91
92
  target-version = "py37"
92
93
 
93
94
  [tool.ruff.lint]
@@ -120,14 +121,6 @@ select = [
120
121
  "YTT",
121
122
  ]
122
123
  ignore = [
123
- # Allow non-abstract empty methods in abstract base classes
124
- "B027",
125
- # Allow boolean positional values in function calls, like `dict.get(... True)`
126
- "FBT003",
127
- # Ignore checks for possible passwords
128
- "S105", "S106", "S107",
129
- # Ignore complexity
130
- "C901", "PLR0911", "PLR0912", "PLR0913", "PLR0915",
131
124
  # Conflict with the Ruff formatter
132
125
  "COM812", "ISC001",
133
126
  ]
@@ -136,27 +129,16 @@ unfixable = [
136
129
  "F401",
137
130
  ]
138
131
 
139
- [tool.ruff.lint.isort]
140
- known-first-party = ["backports_httpmethod"]
141
-
142
132
  [tool.ruff.lint.flake8-tidy-imports]
143
133
  ban-relative-imports = "all"
144
134
 
145
- [tool.ruff.lint.per-file-ignores]
146
- # Tests can use magic values, assertions, and relative imports
147
- "tests/**/*" = ["PLR2004", "S101", "TID252"]
148
-
149
- [tool.coverage.run]
150
- source_pkgs = ["backports", "tests"]
151
- branch = true
152
- parallel = true
153
-
154
- [tool.coverage.paths]
155
- backports_httpmethod = ["src/backports/httpmethod", "*/backports.httpmethod/src/backports/httpmethod"]
156
- tests = ["tests", "*/backports.httpmethod/tests"]
135
+ [tool.pyproject-fmt]
136
+ indent = 2
137
+ keep_full_version = true
138
+ max_supported_python = "3.13"
157
139
 
158
140
  [tool.coverage.report]
159
- exclude_lines = [
141
+ exclude_also = [
160
142
  "no cov",
161
143
  "if __name__ == .__main__.:",
162
144
  "if TYPE_CHECKING:",
@@ -1,4 +1,9 @@
1
- from backports.strenum import StrEnum
1
+ import sys
2
+
3
+ if sys.version_info < (3, 11):
4
+ from backports.strenum import StrEnum
5
+ else:
6
+ from enum import StrEnum
2
7
 
3
8
  __all__ = ["HTTPMethod"]
4
9
 
@@ -0,0 +1,37 @@
1
+ import sys
2
+ import unittest
3
+
4
+ from backports.httpmethod import HTTPMethod
5
+
6
+
7
+ class TestHTTPMethod(unittest.TestCase):
8
+ def test_equals_string(self):
9
+ self.assertEqual(HTTPMethod.GET, "GET")
10
+
11
+ def test_value(self):
12
+ self.assertEqual(HTTPMethod.GET.value, "GET")
13
+
14
+ def test_description(self):
15
+ self.assertEqual(HTTPMethod.GET.description, "Retrieve the target.")
16
+
17
+ def test_available_methods(self):
18
+ self.assertListEqual(
19
+ list(HTTPMethod),
20
+ [
21
+ HTTPMethod.CONNECT,
22
+ HTTPMethod.DELETE,
23
+ HTTPMethod.GET,
24
+ HTTPMethod.HEAD,
25
+ HTTPMethod.OPTIONS,
26
+ HTTPMethod.PATCH,
27
+ HTTPMethod.POST,
28
+ HTTPMethod.PUT,
29
+ HTTPMethod.TRACE,
30
+ ],
31
+ )
32
+
33
+ @unittest.skipIf(sys.version_info < (3, 11), "requires Python 3.11+")
34
+ def test_equality(self):
35
+ from http import HTTPMethod as PyHTTPMethod # noqa: PLC0415
36
+
37
+ self.assertEqual(HTTPMethod.__members__, PyHTTPMethod.__members__)
@@ -1 +0,0 @@
1
- hatch==1.7.0
@@ -1,51 +0,0 @@
1
- name: Publish to PyPI
2
-
3
- on:
4
- release:
5
- types: [published]
6
-
7
- permissions:
8
- contents: write
9
- id-token: write
10
-
11
- jobs:
12
- build:
13
- runs-on: ubuntu-latest
14
- steps:
15
- - uses: actions/checkout@v4
16
- - uses: actions/setup-python@v4
17
- with:
18
- python-version: 3.12
19
- - name: Install dependencies
20
- env:
21
- PIP_CONSTRAINT: .github/workflows/constraints.txt
22
- run: |
23
- pipx install hatch
24
- - name: Build
25
- run: |
26
- hatch build
27
- - uses: actions/upload-artifact@v3
28
- with:
29
- name: dist
30
- path: dist
31
-
32
- upload:
33
- runs-on: ubuntu-latest
34
- needs: build
35
- environment: publish
36
- steps:
37
- - uses: actions/checkout@v4
38
- - uses: actions/download-artifact@v3
39
- with:
40
- name: dist
41
- path: dist
42
- - name: Upload wheel to release
43
- uses: svenstaro/upload-release-action@v2
44
- with:
45
- file: dist/*.whl
46
- tag: ${{ github.ref }}
47
- overwrite: true
48
- file_glob: true
49
-
50
- - name: Publish
51
- uses: pypa/gh-action-pypi-publish@v1.8.10
@@ -1,31 +0,0 @@
1
- ci:
2
- autofix_commit_msg: "chore: Fix lint errors"
3
- autofix_prs: true
4
- autoupdate_branch: main
5
- autoupdate_commit_msg: "chore: Update pre-commit hooks"
6
- autoupdate_schedule: weekly
7
- submodules: false
8
-
9
- repos:
10
- - repo: https://github.com/pre-commit/pre-commit-hooks
11
- rev: v4.5.0
12
- hooks:
13
- - id: check-merge-conflict
14
- - id: check-toml
15
- - id: end-of-file-fixer
16
- - id: no-commit-to-branch
17
- args: [--branch, main]
18
- - id: trailing-whitespace
19
-
20
- - repo: https://github.com/astral-sh/ruff-pre-commit
21
- rev: v0.1.5
22
- hooks:
23
- - id: ruff
24
- args: [--fix, --preview, --exit-non-zero-on-fix, --show-fixes]
25
- - id: ruff
26
- entry: ruff format
27
-
28
- - repo: https://github.com/tox-dev/pyproject-fmt
29
- rev: "1.5.1"
30
- hooks:
31
- - id: pyproject-fmt
@@ -1,27 +0,0 @@
1
- from backports.httpmethod import HTTPMethod
2
-
3
-
4
- def test_equals_string():
5
- assert HTTPMethod.GET == "GET"
6
-
7
-
8
- def test_value():
9
- assert HTTPMethod.GET.value == "GET"
10
-
11
-
12
- def test_description():
13
- assert HTTPMethod.GET.description == "Retrieve the target."
14
-
15
-
16
- def test_available_methods():
17
- assert list(HTTPMethod) == [
18
- HTTPMethod.CONNECT,
19
- HTTPMethod.DELETE,
20
- HTTPMethod.GET,
21
- HTTPMethod.HEAD,
22
- HTTPMethod.OPTIONS,
23
- HTTPMethod.PATCH,
24
- HTTPMethod.POST,
25
- HTTPMethod.PUT,
26
- HTTPMethod.TRACE,
27
- ]