未提供项目说明
c2f的Python项目详细描述
Python是解释语言还是编译语言?诡计问题。实际上是 两者兼而有之。有了Cython这样的工具,我们可以进一步编译 几乎完全移除解释器循环。Cython生成的二进制文件与 C++,GO和RISD做。现在有了GitHub操作,跨平台构建和 对于开源项目,发布过程可以免费自动化。这是一个 这是一个巨大的机会,可以让Python生态系统的速度提高20-50% 拉取请求。这个闪电般的谈话通过一个GitHub工作流 将Cython优化的轮子发布到PyPI。了解Cython如何进行涡轮增压 Python代码和GitHub操作可以简化跨平台发布 免费处理。在
旧金山Python假日派对2019
Python是解释的还是编译的?在
?
?
?
c2f.py公司
"Celsius to Fahrenheit Library"defconvert(celsius:float)->float:"Convert Celsius to Fahrenheit"fahrenheit=celsius*1.8+32returnfahrenheit
c2f.cpython-38.pyc
^{pr2}$在设置.py在
fromsetuptoolsimportsetupfromCython.Buildimportcythonizesetup(name='c2f',version='0.0.0',py_modules=['c2f'],ext_modules=cythonize('c2f.py'),)
c2f.c.公司
$ cython c2f.py
staticPyObject*__pyx_convert(double__pyx_v_celsius){double__pyx_v_fahrenheit;PyObject*__pyx_r=NULL;__pyx_v_fahrenheit=((__pyx_v_celsius*1.8)+32.0);__pyx_r=PyFloat_FromDouble(__pyx_v_fahrenheit);return__pyx_r;}
c2f.so.公司
$ python setup.py bdist_wheel
___pyx_convert:pushrbpmovrbp,rspsubrsp,16movsdxmm0,qwordptr[rbp-8]mulsdxmm0,qwordptr[rip+1379]addsdxmm0,qwordptr[rip+1379]call502<PyFloat_FromDouble...>addrsp,16poprbpret
.github/工作流/释放.yml在
name:releaseon:push:tags:-v*jobs:build-linux-cp38:runs-on:ubuntu-latestcontainer:quay.io/pypa/manylinux2014_x86_64steps:...
矩阵构建
build-macos:runs-on:macos-lateststrategy:max-parallel:4matrix:python-version:[3.5,3.6,3.7,3.8]steps:...
Mac构建步骤
-name:Set up Python ${{ matrix.python-version }} x64uses:actions/setup-python@v1with:python-version:${{ matrix.python-version }}architecture:x64-name:Install package dependenciesrun:pip install cython wheel-name:Build binary wheelrun:python setup.py bdist_wheel
Linux auditwheel工具
-name:Build binary wheelrun:/opt/python/cp38-cp38/bin/python setup.py bdist_wheel-name:Apply auditwheel for manylinux wheelrun:auditwheel repair -w dist dist/*-name:Remove linux wheelrun:rm dist/*-linux_x86_64.whl
Windows生成步骤
-name:Download Build Tools for Visual Studio 2019run:Invoke-WebRequest -Uri https://aka.ms/vs/16/rel...-name:Run vs_buildtools.exe installrun:./vs_buildtools.exe --quiet --wait --norestart ...
存储生成工件
-name:Archive dist artifactsuses:actions/upload-artifact@v1with:name:dist-macos-${{ matrix.python-version }}path:dist
放射源分布
upload:needs:[build-linux-cp35,...]runs-on:ubuntu-lateststeps:...-name:Install dependenciesrun:pip install -r requirements.txt-name:Create source distrun:python setup.py sdist
分级二元轮
-name:Stage linux 3.8uses:actions/download-artifact@v1with:name:dist-linux-3.8-run:mv -v dist-linux-3.8/* dist/-name:Stage macos 3.8uses:actions/download-artifact@v1with:name:dist-macos-3.8-run:mv -v dist-macos-3.8/* dist/...
用绳线上传
-name:Upload with twineenv:TWINE_USERNAME:${{ secrets.TWINE_USERNAME }}TWINE_PASSWORD:${{ secrets.TWINE_PASSWORD }}run:|ls -l dist/*pip install twinetwine upload dist/*
把所有事情都搞定!在
请偷密码!在
Cythonize所有的东西!
Cythonize所有的东西!
Cythonize所有的东西!
Cythonize所有的东西!
Cythonize所有的东西!
Cythonize所有的东西!
附录
倾卸组件
$ gcc -g -shared -pthread -fPIC -fwrapv -O2 -Wall -fno-strict-aliasing -I/Library/Frameworks/Python.framework/Versions/3.8/include/python3.8 -L/Library/Frameworks/Python.framework/Versions/3.8/lib -o c2f.so c2f.c -lpython3.8
$ objdump -S -df=___pyx_pw_3c2f_1convert c2f.so
Git标记
$ git tag -a v0.0.2 -m v0.0.2 $ git push $ git push --tags
- 项目
标签: