Skip to content

Commit c3d7cd5

Browse files
author
Zoran Simic
committed
Initial commit
0 parents  commit c3d7cd5

26 files changed

+1616
-0
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v[0-9]*'
7+
8+
jobs:
9+
publish:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.9'
18+
19+
- run: pip install -U pip setuptools wheel twine tox
20+
- run: tox -e py,docs,style
21+
- run: python setup.py sdist bdist_wheel
22+
23+
- name: Create Release
24+
id: create_release
25+
uses: actions/create-release@v1
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
with:
29+
tag_name: ${{ github.ref }}
30+
draft: false
31+
prerelease: false
32+
33+
- name: Publish sdist and wheel
34+
env:
35+
TWINE_USERNAME: __token__
36+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
37+
run: twine upload dist/*

.github/workflows/tests.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
python-version: [3.6, 3.9]
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- run: pip install -U pip tox
25+
- run: tox -e py
26+
- uses: codecov/codecov-action@v1
27+
with:
28+
file: .tox/test-reports/coverage.xml
29+
30+
linters:
31+
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
- uses: actions/setup-python@v2
37+
with:
38+
python-version: '3.9'
39+
40+
- run: pip install -U pip tox
41+
- run: tox -e docs,style,security

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Various
2+
*~
3+
\#*#
4+
.\#*
5+
.*cache
6+
.DS_Store*
7+
*.lock
8+
*.swp
9+
.*version
10+
.idea/
11+
.vscode/
12+
ehthumbs.db
13+
Icon?
14+
Thumbs.db
15+
16+
# Build artifacts
17+
_Dockerfile*
18+
__pycache__/
19+
*.py[cod]
20+
*.egg*
21+
.tox/
22+
.venv*/
23+
build/
24+
dist/
25+
root/
26+
venv*/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Zoran Simic
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include LICENSE
2+
include README.rst
3+
include SECURITY.md

README.rst

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
Portable python binaries
2+
========================
3+
4+
.. image:: https://img.shields.io/pypi/v/portable-python.svg
5+
:target: https://pypi.org/project/portable-python/
6+
:alt: Version on pypi
7+
8+
.. image:: https://github.com/codrsquad/portable-python/workflows/Tests/badge.svg
9+
:target: https://github.com/codrsquad/portable-python/actions
10+
:alt: Tested with Github Actions
11+
12+
.. image:: https://codecov.io/gh/codrsquad/portable-python/branch/main/graph/badge.svg
13+
:target: https://codecov.io/gh/codrsquad/portable-python
14+
:alt: Test code codecov
15+
16+
.. image:: https://img.shields.io/pypi/pyversions/portable-python.svg
17+
:target: https://github.com/codrsquad/portable-python
18+
:alt: Python versions tested (link to github project)
19+
20+
21+
This project is a python CLI that aims to make compiling portable python binaries automatable.
22+
23+
What is a "portable python"?
24+
----------------------------
25+
26+
It's a binary python distribution (``.tar.gz`` or ``.zip``) that can be decompressed
27+
in any folder, and used from there without further ado (ie: no need to run an "installer"
28+
and things like that).
29+
30+
The idea here is to allow for automated systems to:
31+
32+
- Easily obtain a python binary, and use it in their sandbox.
33+
34+
- Install versions of python from binary distributions on laptops/workstations,
35+
similarly to how pyenv_ does it, but without having to compile on target system.
36+
37+
38+
39+
40+
How it works
41+
------------
42+
43+
``portable-python`` is a regular python CLI, it can be installed with:
44+
45+
- With pickley_::
46+
47+
pickley install portable-python
48+
portable-python --help
49+
50+
- Using ``pip install``::
51+
52+
/usr/bin/python3 -mvenv pp
53+
./pp/bin/portable-python --help
54+
55+
- From source::
56+
57+
git clone https://github.com/codrsquad/portable-python.git
58+
cd portable-python
59+
tox -e venv
60+
.venv/bin/portable-python --help
61+
62+
63+
Once you've installed ``portable-python``, you can get going like so::
64+
65+
# Build a binary (for current platform)
66+
cd some-temp-folder
67+
portable-python build 3.9.6
68+
ls -l dist/3.9.6.tar.gz
69+
70+
# Unpack it somewhere
71+
tar -C ~/.pyenv/versions/ -xf dist/3.9.6.tar.gz
72+
ls -l ~/.pyenv/versions/
73+
74+
# It's ready to be used
75+
~/.pyenv/versions/3.9.6/bin/python --version
76+
77+
78+
Note that you can use ``--dryrun`` mode to inspect what would be done without doing it::
79+
80+
$ portable-python --dryrun build 3.9.6
81+
82+
Would create build/cpython-3.9.2
83+
...
84+
Would untar build/downloads/readline-8.1.tar.gz -> build/cpython-3.9.2/build/readline
85+
INFO CFLAGS=-fPIC
86+
...
87+
Would run: ./configure --prefix=/deps --disable-shared --with-curses
88+
Would run: /usr/bin/make
89+
Would run: /usr/bin/make install DESTDIR=build/cpython-3.9.2
90+
...
91+
92+
93+
Build folder structure
94+
----------------------
95+
96+
``portable-python`` uses this file structure (build/ and dist/ folders configurable)::
97+
98+
build/
99+
cpython-3.9.6/ # Build artifacts for corresponding version are here
100+
3.9.6/ # Full installation (after build completes)
101+
build/ # Source code of various modules are here
102+
deps/ # --prefix=/deps passed to all ./configure scripts
103+
logs/ # Logs for each module build are here, in order of build
104+
downloads/
105+
openssl-1.1.1k.tar.gz # Downloaded artifacts (downloaded only once)
106+
dist/
107+
3.9.6.tar.gz # Ready-to-go binary tarball
108+
109+
110+
111+
.. _pyenv: https://github.com/pyenv/pyenv
112+
113+
.. _pickley: https://pypi.org/project/pickley/

SECURITY.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 1.x | :white_check_mark: |
8+
9+
## Reporting a Vulnerability
10+
11+
To report any bug, please open an issue in our [issue tracker](https://github.com/codrsquad/portable-python/issues).

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# pinned
2+
click==8.0.1
3+
requests==2.26.0
4+
runez==3.1.5

setup.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from setuptools import setup
2+
3+
4+
setup(
5+
name="portable-python",
6+
setup_requires="setupmeta",
7+
versioning="dev",
8+
author="Zoran Simic [email protected]",
9+
keywords="newt, python, app-type",
10+
url="https://github.com/codrsquad/portable-python",
11+
python_requires='>=3.6',
12+
entry_points={
13+
"console_scripts": [
14+
"portable-python = portable_python.__main__:main",
15+
],
16+
},
17+
classifiers=[
18+
"Development Status :: 5 - Production/Stable",
19+
"Environment :: Console",
20+
"Intended Audience :: Developers",
21+
"Operating System :: MacOS :: MacOS X",
22+
"Operating System :: POSIX",
23+
"Operating System :: Unix",
24+
"Programming Language :: Python",
25+
"Programming Language :: Python :: 3",
26+
"Programming Language :: Python :: 3.6",
27+
"Programming Language :: Python :: 3.7",
28+
"Programming Language :: Python :: 3.8",
29+
"Programming Language :: Python :: 3.9",
30+
"Programming Language :: Python :: Implementation :: CPython",
31+
"Topic :: Software Development :: Build Tools",
32+
"Topic :: System :: Installation/Setup",
33+
"Topic :: System :: Software Distribution",
34+
"Topic :: Utilities",
35+
],
36+
project_urls={
37+
"Documentation": "https://github.com/codrsquad/portable-python/wiki",
38+
"Release notes": "https://github.com/codrsquad/portable-python/wiki/Release-notes",
39+
"Source": "https://github.com/codrsquad/portable-python",
40+
},
41+
)

src/portable_python/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import logging
2+
3+
4+
LOG = logging.getLogger(__name__)

0 commit comments

Comments
 (0)