Skip to content

Commit b60157c

Browse files
committed
First Commit
0 parents  commit b60157c

File tree

12 files changed

+1611
-0
lines changed

12 files changed

+1611
-0
lines changed

.gitignore

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Created by https://www.gitignore.io/api/visualstudiocode
2+
# Edit at https://www.gitignore.io/?templates=visualstudiocode
3+
4+
### VisualStudioCode ###
5+
.vscode/**/*
6+
!.vscode/settings.json
7+
!.vscode/tasks.json
8+
!.vscode/launch.json
9+
!.vscode/extensions.json
10+
11+
### VisualStudioCode Patch ###
12+
# Ignore all local history of files
13+
**/.history
14+
15+
# End of https://www.gitignore.io/api/visualstudiocode
16+
17+
# Some rules taken from https://github.com/github/gitignore/blob/master/Python.gitignore
18+
19+
# Byte-compiled / optimized / DLL files
20+
**/__pycache__/
21+
*.py[cod]
22+
*$py.class
23+
24+
# IDE's
25+
tags
26+
27+
# Distribution / packaging
28+
build/
29+
develop-eggs/
30+
dist/
31+
downloads/
32+
eggs/
33+
.eggs/
34+
lib/
35+
lib64/
36+
parts/
37+
sdist/
38+
var/
39+
wheels/
40+
share/python-wheels/
41+
*.egg-info/
42+
.installed.cfg
43+
*.egg
44+
MANIFEST
45+
46+
# PyInstaller
47+
*.manifest
48+
*.spec
49+
50+
# Installer logs
51+
pip-log.txt
52+
pip-delete-this-directory.txt
53+
54+
# Unit test / coverage reports
55+
htmlcov/
56+
.tox/
57+
.nox/
58+
.coverage
59+
.coverage.*
60+
.cache
61+
nosetests.xml
62+
coverage.xml
63+
*.cover
64+
*.py,cover
65+
.hypothesis/
66+
.pytest_cache/
67+
cover/
68+
69+
# Jupyter Notebooks
70+
.ipynb_checkpoints
71+
72+
# IPython
73+
profile_default/
74+
ipython_config.py
75+
76+
# PEP 582
77+
__pypackages__/
78+
79+
# Enviroments
80+
.env
81+
.venv
82+
env/
83+
venv/
84+
ENV/
85+
env.bak/
86+
venv.bak/
87+
88+
# mypy
89+
.mypy_cache/
90+
.dmypy.json
91+
dmypy.json
92+
93+
# pytype static type analyzer
94+
.pytype/
95+
96+
# Cython debug symbols
97+
cython_debug/
98+
99+
*.png

.vscode/extensions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"recommendations": [
3+
"ms-python.python",
4+
"charliermarsh.ruff",
5+
"tamasfe.even-better-toml",
6+
"streetsidesoftware.code-spell-checker",
7+
]
8+
}

.vscode/launch.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python: main.py",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "src/main.py",
12+
"console": "integratedTerminal"
13+
},
14+
{
15+
"name": "Python: pytest",
16+
"type": "debugpy",
17+
"request": "launch",
18+
"program": "${file}",
19+
"purpose": [
20+
"debug-test"
21+
],
22+
"env": {
23+
"PYTEST_ADDOPTS": "--no-cov",
24+
},
25+
"justMyCode": false
26+
}
27+
]
28+
}

.vscode/settings.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"python.testing.pytestArgs": [
3+
"tests",
4+
"--cov=src",
5+
"--cov=branch"
6+
],
7+
"python.testing.unittestEnabled": false,
8+
"python.testing.pytestEnabled": true,
9+
"[python]": {
10+
"editor.defaultFormatter": "charliermarsh.ruff"
11+
}
12+
}

Makefile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
setup:
3+
poetry install
4+
5+
build: setup
6+
poetry build
7+
8+
install: build
9+
/usr/bin/python3 -m pip install dist/$$(ls dist | grep .whl | tail -n 1)
10+
11+
checks: lint test
12+
13+
lint:
14+
poetry run ruff check .
15+
16+
format:
17+
poetry run ruff check --fix .
18+
19+
test:
20+
poetry run pytest tests
21+
22+
.PHONY: setup build install checks lint format test

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Code Pic
2+
3+
Capture code in a picture.
4+
5+
Generate an image of code using pygments syntax highlighting.
6+
7+
For example:
8+
9+
![](docs/test.png)
10+
11+
## Usage
12+
13+
```text
14+
$ codepic --help
15+
Usage: codepic [OPTIONS] SOURCE_FILE
16+
17+
Options:
18+
-w, --width TEXT Fixed width in pixels or percent
19+
-h, --height TEXT Fixed hight in pixels or percent
20+
--line_numbers Show line numbers
21+
-p, --pad INTEGER Padding in pixels
22+
-f, --font_name TEXT Font size in pt
23+
-s, --font_size INTEGER Font size in pt
24+
-a, --aa_factor FLOAT Antialias factor
25+
-s, --style TEXT
26+
-l, --lang TEXT
27+
-f, --image_format [png|jpeg|bmp|gif]
28+
Antialias factor
29+
-o, --output FILE Output path for image
30+
--help Show this message and exit.
31+
```
32+
33+
### Install
34+
35+
```sh
36+
make install
37+
```
38+
39+
### Develop
40+
41+
```sh
42+
make setup
43+
```
44+
45+
#### Lint / Formatting
46+
47+
```sh
48+
make lint
49+
make format
50+
```
51+
52+
53+
#### Testing
54+
55+
```sh
56+
make test
57+
```

0 commit comments

Comments
 (0)