Skip to content

Commit

Permalink
Remove python 3.5 and manylinux1, add python 3.9 and default to manyl…
Browse files Browse the repository at this point in the history
…inux2010 (#361)
  • Loading branch information
konstin authored Oct 9, 2020
1 parent e98bc14 commit 14c4f5c
Show file tree
Hide file tree
Showing 19 changed files with 52 additions and 1,501 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: 3.6
python-version: 3.8
- name: Build Docker container
run: docker build --cache-from konstin2/maturin -t maturin .
- name: Test the Docker container
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.5
- uses: actions/setup-python@v2
with:
python-version: 3.6
Expand All @@ -28,6 +25,9 @@ jobs:
- uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install cffi and virtualenv
run: pip install cffi virtualenv
- uses: actions-rs/toolchain@v1
Expand Down
7 changes: 2 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ addons:
- libdbus-1-dev
- musl-tools
- fakeroot
- python3.5-dev
- python3.5-venv
- python3.6-dev
- python3.6-venv
- python3.7-dev
Expand All @@ -53,7 +51,6 @@ jobs:
packages:
- fakeroot

- python3.5-dev
- python3.6-dev
- python3.6-venv
- python3.7-dev
Expand All @@ -74,13 +71,13 @@ install:
# is the source of this mess
- |
if [ "$TRAVIS_OS_NAME" == "osx" ]; then
python3 -m pip install cffi virtualenv
python3 -m pip install -U cffi virtualenv
fi
- |
if [ "$TRAVIS_OS_NAME" == "linux" ]; then
python3.6 -m venv venv
source venv/bin/activate
pip install cffi virtualenv
pip install -U cffi virtualenv
fi
script:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
authors = ["konstin <[email protected]>"]
name = "maturin"
version = "0.9.0-alpha.1"
version = "0.9.0-alpha.2"
description = "Build and publish crates with pyo3, rust-cpython and cffi bindings as well as rust binaries as python packages"
exclude = ["test-crates/**/*", "sysconfig/*", "test-data/*", "ci/*", "tests/*"]
readme = "Readme.md"
Expand Down
6 changes: 4 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## 0.9.0 - Unreleased

### Added

* Added support for building abi3 wheels with pyo3 0.13
* Python 3.9 is supported (it should have worked before, but it is now tested on ci)
* Removed Python 3.5 since it is unsupported
* The default and minimum manylinux version is now manylinux2010
* restructured text (rst) readmes are now supported, by clbarnes in [#360](https://github.com/PyO3/maturin/pull/360)

## 0.8.3 - 2020-08-17

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM quay.io/pypa/manylinux1_x86_64
FROM quay.io/pypa/manylinux2010_x86_64

ENV PATH /root/.cargo/bin:$PATH
# Add all supported python versions
ENV PATH /opt/python/cp35-cp35m/bin/:/opt/python/cp36-cp36m/bin/:/opt/python/cp37-cp37m/bin/:/opt/python/cp38-cp38/bin/:$PATH
ENV PATH /opt/python/cp36-cp36m/bin/:/opt/python/cp37-cp37m/bin/:/opt/python/cp38-cp38/bin/:/opt/python/cp39-cp39/bin/:$PATH
# Otherwise `cargo new` errors
ENV USER root

Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ There's a `cargo sdist` command for only building a source distribution as worka

## Manylinux and auditwheel

For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux. The pypa offers a special docker image and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://www.python.org/dev/peps/pep-0513/#the-manylinux1-policy). If you want to publish wheels for linux pypi, **you need to use the manylinux docker image**.
For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux. The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://www.python.org/dev/peps/pep-0571/#the-manylinux2010-policy). If you want to publish wheels for linux pypi, **you need to use a manylinux docker image**. The rust compiler since version 1.47 [requires at least glibc 2.11](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1470-2020-10-08), so you need to use at least manylinux2010.

maturin contains a reimplementation of a major part of auditwheel automatically checking the generated library. If you want to disable those checks or build for native linux target, use the `--manylinux` flag.

For full manylinux compliance you need to compile in a cent os 5 docker container. The [konstin2/maturin](https://hub.docker.com/r/konstin2/maturin) image is based on the official manylinux image. You can use it like this:
For full manylinux compliance you need to compile in a CentOS 6 docker container. The [konstin2/maturin](https://hub.docker.com/r/konstin2/maturin) image is based on the official manylinux image. You can use it like this:

```
docker run --rm -v $(pwd):/io konstin2/maturin build
Expand Down
18 changes: 1 addition & 17 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,4 @@ build-backend = "setuptools.build_meta"
bindings = "bin"

[tool.black]
target_version = ['py35']
include = '\.pyi?$'
exclude = '''
(
/(
\.eggs
| \.git
| \.mypy_cache
| \.tox
| \.venv
| venv
| .*/venv.*
| target
| dist
)/
)
'''
target_version = ['py36']
30 changes: 2 additions & 28 deletions src/auditwheel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,6 @@ use std::io;
use std::io::Read;
use std::path::Path;
use thiserror::Error;
/// As specified in "PEP 513 -- A Platform Tag for Portable Linux Built
/// Distributions"
const MANYLINUX1: &[&str] = &[
"libpanelw.so.5",
"libncursesw.so.5",
"libgcc_s.so.1",
"libstdc++.so.6",
"libm.so.6",
"libdl.so.2",
"librt.so.1",
"libcrypt.so.1",
"libc.so.6",
"libnsl.so.1",
"libutil.so.1",
"libpthread.so.0",
"libresolv.so.2",
"libX11.so.6",
"libXext.so.6",
"libXrender.so.1",
"libICE.so.6",
"libSM.so.6",
"libGL.so.1",
"libgobject-2.0.so.0",
"libgthread-2.0.so.0",
"libglib-2.0.so.0",
];

/// As specified in "PEP 571 -- The manylinux2010 Platform Tag"
///
/// Currently unused since the python ecosystem is still on manylinux 1
Expand All @@ -60,6 +33,8 @@ const MANYLINUX2010: &[&str] = &[
"libglib-2.0.so.0",
];

// TODO: Add manylinux2014

/// Error raised during auditing an elf file for manylinux compatibility
#[derive(Error, Debug)]
#[error("Ensuring manylinux compliance failed")]
Expand Down Expand Up @@ -93,7 +68,6 @@ pub fn auditwheel_rs(
}
let reference: &[&str];
match *manylinux {
Manylinux::Manylinux1 => reference = MANYLINUX1,
Manylinux::Manylinux2010 => reference = MANYLINUX2010,
_ => return Ok(()),
};
Expand Down
12 changes: 5 additions & 7 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ pub struct BuildOptions {
// The {n} are workarounds for https://github.com/TeXitoi/structopt/issues/163
/// Control the platform tag on linux.
///
/// - `1`: Use the manylinux1 tag and check for compliance{n}
/// - `1-unchecked`: Use the manylinux1 tag without checking for compliance{n}
/// - `2010`: Use the manylinux2010 tag and check for compliance{n}
/// - `2010-unchecked`: Use the manylinux2010 tag without checking for compliance{n}
/// - `2014`: Use the manylinux2010 tag and check for compliance{n}
Expand All @@ -31,9 +29,9 @@ pub struct BuildOptions {
/// This option is ignored on all non-linux platforms
#[structopt(
long,
possible_values = &["1", "1-unchecked", "2010", "2010-unchecked", "2014", "2014-unchecked", "off"],
possible_values = &["2010", "2010-unchecked", "2014", "2014-unchecked", "off"],
case_insensitive = true,
default_value = "1"
default_value = "2010"
)]
pub manylinux: Manylinux,
#[structopt(short, long)]
Expand Down Expand Up @@ -77,7 +75,7 @@ pub struct BuildOptions {
impl Default for BuildOptions {
fn default() -> Self {
BuildOptions {
manylinux: Manylinux::Manylinux1,
manylinux: Manylinux::Manylinux2010,
interpreter: Some(vec![]),
bindings: None,
manifest_path: PathBuf::from("Cargo.toml"),
Expand Down Expand Up @@ -164,8 +162,8 @@ impl BuildOptions {
let rustc_extra_args = split_extra_args(&self.rustc_extra_args)?;

let manylinux = if self.skip_auditwheel {
eprintln!("⚠ --skip-auditwheel is deprecated, use --manylinux=1-unchecked");
Manylinux::Manylinux1Unchecked
eprintln!("⚠ --skip-auditwheel is deprecated, use --manylinux=2010-unchecked");
Manylinux::Manylinux2010Unchecked
} else {
self.manylinux
};
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! Run with --help for usage information

use anyhow::{bail, Context, Result};
#[cfg(feature = "upload")]
use bytesize::ByteSize;
use cargo_metadata::MetadataCommand;
#[cfg(feature = "human-panic")]
Expand Down
20 changes: 10 additions & 10 deletions src/python_interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ fn windows_interpreter_no_build(
return true;
}

// Ignore python 3.0 - 3.4
if major == 3 && minor < 5 {
// Ignore python 3.0 - 3.5
if major == 3 && minor < 6 {
return true;
}

Expand Down Expand Up @@ -270,8 +270,8 @@ pub struct PythonInterpreter {
/// Python's minor version
pub minor: usize,
/// For linux and mac, this contains the value of the abiflags, e.g. "m"
/// for python3.5m or "dm" for python3.6dm. On windows, the value is
/// always "".
/// for python3.7m or "dm" for python3.6dm. Since python3.8, the value is
/// empty. On windows, the value was always "".
///
/// See PEP 261 and PEP 393 for details
pub abiflags: String,
Expand Down Expand Up @@ -418,16 +418,16 @@ impl PythonInterpreter {
/// For CPython, generate extensions as follows:
///
/// For python 3, there is PEP 3149, but
/// that is only valid for 3.2 - 3.4. Since only 3.5+ is supported, the
/// that is only valid for 3.2 - 3.4. Since only 3.6+ is supported, the
/// templates are adapted from the (also
/// incorrect) release notes of CPython 3.5:
/// https://docs.python.org/3/whatsnew/3.5.html#build-and-c-api-changes
///
/// Examples for 64-bit on CPython 3.5m:
/// Linux: foobar.cpython-35m-x86_64-linux-gnu.so
/// Windows: foobar.cp35-win_amd64.pyd
/// Mac: foobar.cpython-35m-darwin.so
/// FreeBSD: foobar.cpython-35m.so
/// Examples for 64-bit on CPython 3.6m:
/// Linux: foobar.cpython-36m-x86_64-linux-gnu.so
/// Windows: foobar.cp36-win_amd64.pyd
/// Mac: foobar.cpython-36m-darwin.so
/// FreeBSD: foobar.cpython-36m.so
///
/// For pypy3, we read sysconfig.get_config_var("EXT_SUFFIX").
///
Expand Down
8 changes: 0 additions & 8 deletions src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ enum OS {
/// Decides how to handle manylinux compliance
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
pub enum Manylinux {
/// Use the manylinux1 tag and check for compliance
Manylinux1,
/// Use the manylinux1 tag but don't check for compliance
Manylinux1Unchecked,
/// Use manylinux2010 tag and check for compliance
Manylinux2010,
/// Use the manylinux2010 tag but don't check for compliance
Expand All @@ -39,8 +35,6 @@ pub enum Manylinux {
impl fmt::Display for Manylinux {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Manylinux::Manylinux1 => write!(f, "manylinux1"),
Manylinux::Manylinux1Unchecked => write!(f, "manylinux1"),
Manylinux::Manylinux2010 => write!(f, "manylinux2010"),
Manylinux::Manylinux2010Unchecked => write!(f, "manylinux2010"),
Manylinux::Manylinux2014 => write!(f, "manylinux2014"),
Expand All @@ -55,8 +49,6 @@ impl FromStr for Manylinux {

fn from_str(value: &str) -> Result<Self, Self::Err> {
match value {
"1" => Ok(Manylinux::Manylinux1),
"1-unchecked" => Ok(Manylinux::Manylinux1Unchecked),
"2010" => Ok(Manylinux::Manylinux2010),
"2010-unchecked" => Ok(Manylinux::Manylinux2010Unchecked),
"2014" => Ok(Manylinux::Manylinux2014Unchecked),
Expand Down
Loading

0 comments on commit 14c4f5c

Please sign in to comment.