Skip to content

Commit 99baec4

Browse files
committed
fix to uv
0 parents  commit 99baec4

File tree

12 files changed

+299
-0
lines changed

12 files changed

+299
-0
lines changed

.github/workflows/pyci.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Python CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: '3.12'
16+
# make depends on uv
17+
- name: Install dependencies
18+
run: |
19+
pip install uv
20+
make install
21+
- name: Run linter and pytest
22+
run: |
23+
make check
24+
- name: Test & publish code coverage
25+
uses: paambaati/[email protected]
26+
if: github.ref_name == 'main'
27+
env:
28+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
29+
with:
30+
coverageCommand: make test-coverage
31+
debug: true

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
*.egg-info
2+
__pycache__
3+
dist/
4+
*.pyc
5+
.venv
6+
.coverage
7+
coverage.xml
8+
*_cache/

Makefile

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
install:
2+
uv sync
3+
4+
run:
5+
uv run hexlet-python-package
6+
7+
test:
8+
uv run pytest
9+
10+
test-coverage:
11+
uv run pytest --cov=hexlet_python_package --cov-report xml
12+
13+
lint:
14+
uv run ruff check
15+
16+
check: test lint
17+
18+
build:
19+
uv build
20+
21+
.PHONY: install test lint selfcheck check build

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# python-package
2+
3+
[![Github Actions Status](https://github.com/hexlet-boilerplates/python-package/workflows/Python%20CI/badge.svg)](https://github.com/hexlet-boilerplates/python-package/actions)
4+
[![Maintainability](https://api.codeclimate.com/v1/badges/df66c0cbbeca7d822f23/maintainability)](https://codeclimate.com/github/hexlet-boilerplates/python-package/maintainability)
5+
[![Test Coverage](https://api.codeclimate.com/v1/badges/df66c0cbbeca7d822f23/test_coverage)](https://codeclimate.com/github/hexlet-boilerplates/python-package/test_coverage)
6+
7+
### Links
8+
9+
This project was built using these tools:
10+
11+
| Tool | Description |
12+
|------------------------------------------------------------------------|---------------------------------------------------------|
13+
| [uv](https://docs.astral.sh/uv/) | "An extremely fast Python package and project manager, written in Rust" |
14+
| [Pytest](https://pytest.org) | "A mature full-featured Python testing tool" |
15+
| [ruff](https://docs.astral.sh/ruff/) | "An extremely fast Python linter and code formatter, written in Rust" |
16+
17+
---
18+
19+
### Setup
20+
21+
```bash
22+
make install
23+
```
24+
25+
26+
### Run tests
27+
28+
```bash
29+
make test
30+
```
31+
32+
[![Hexlet Ltd. logo](https://raw.githubusercontent.com/Hexlet/assets/master/images/hexlet_logo128.png)](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=python-package)
33+
34+
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io/?utm_source=github&utm_medium=link&utm_campaign=python-package).
35+
36+
See most active contributors on [hexlet-friends](https://friends.hexlet.io/).

hexlet_python_package/__init__.py

Whitespace-only changes.

hexlet_python_package/half.py

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def half(num):
2+
return num / 2

hexlet_python_package/scripts/main.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import sys
2+
3+
from hexlet_python_package.half import half
4+
5+
6+
def main():
7+
print(half(float(sys.argv[-1])))
8+
9+
10+
if __name__ == "__main__":
11+
main()

pyproject.toml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[project]
2+
authors = [
3+
{name = "Hexlet team", email = "[email protected]"},
4+
]
5+
requires-python = "<4.0,>=3.12"
6+
name = "python-example-app"
7+
version = "0.1.0"
8+
description = "Example application"
9+
readme = "README.md"
10+
11+
[tool.uv]
12+
dev-dependencies = [
13+
"ruff>=0.7.1",
14+
"pytest>=8.3.3",
15+
"pytest-cov>=5.0.0",
16+
]
17+
18+
[project.scripts]
19+
hexlet-python-package = "hexlet_python_package.scripts.main:main"
20+
21+
[build-system]
22+
requires = ["hatchling"]
23+
build-backend = "hatchling.build"
24+
25+
[tool.hatch.build.targets.wheel]
26+
packages = ["hexlet_python_package"]

ruff.toml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
line-length = 80
2+
3+
[lint.per-file-ignores]
4+
# init modules can contain the local imports, logic, unused imports
5+
"__init__.py" = ["F401"]
6+
7+
[lint]
8+
preview = true
9+
select = ["E", "F", "I"]

tests/__init__.py

Whitespace-only changes.

tests/test_half.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from hexlet_python_package.half import half
2+
3+
4+
def test_half():
5+
assert half(6) == 3

uv.lock

+150
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)