Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Packaging modernization & cleanup #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 45 additions & 50 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ jobs:
- name: Checkout working copy
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.11"
- name: Install checkers
run: |
python -mpip install --upgrade pip
Expand All @@ -28,58 +28,52 @@ jobs:
- name: black
run: black --check --diff --color --quiet .

# REPLACE BY: job which python -mbuild, and uploads the sdist and wheel to artifacts
# build is not binary so can just build the one using whatever python version
compile:
strategy:
fail-fast: false
matrix:
python-version:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12.0-alpha - 3.12"
- "pypy-3.8"
- "pypy-3.9"
pyyaml-version: ["5.1.*", "5.4.*", "6.0.*", "6.*"]
include:
- python-version: 3.6
os: ubuntu-20.04
exclude:
- python-version: 2.7
pyyaml-version: 6.0.*
- python-version: 2.7
pyyaml-version: 6.*
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
runs-on: ubuntu-latest

steps:
- name: Checkout working copy
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
submodules: true
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependency
run: |
python -mpip install --upgrade pip
python -mpip install pyyaml==${{ matrix.pyyaml-version }}
- name: Build regexes.py
run: python setup.py build_regexes -i
- name: Check results
python -mpip install build
- name: Build sdist and wheel
run: |
# check that _regexes exists, and .eggs does not (== setuptools used our dependency)
test -e src/ua_parser/_regexes.py -a ! -e .eggs
python -mbuild
- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz
retention-days: 1

- name: Upload wheel
uses: actions/upload-artifact@v3
with:
name: wheel
path: dist/*.whl
retention-days: 1

test:
runs-on: ubuntu-latest
needs: compile
strategy:
fail-fast: false
matrix:
source:
- wheel
- sdist
- source
python-version:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
Expand All @@ -88,17 +82,17 @@ jobs:
- "pypy-3.8"
- "pypy-3.9"
include:
- python-version: 3.6
os: ubuntu-20.04
runs-on: ${{ matrix.os || 'ubuntu-latest' }}

- source: sdist
artifact: dist/*.tar.gz
- source: wheel
artifact: dist/*.whl
steps:
- name: Checkout working copy
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
Expand All @@ -112,13 +106,14 @@ jobs:
fi
fi
python -mpip install -r requirements_dev.txt
- name: download ${{ matrix.source }} artifact
if: matrix.artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.source }}
path: dist/
- name: install package in environment
run: pip install .
run: |
pip install ${{ matrix.artifact || '.' }}
- name: run tests
if: ${{ matrix.python-version != '2.7' }}
run: pytest -v -Werror -Wignore::ImportWarning --doctest-glob="*.rst"
- name: run tests
# pprint formatting was widely altered in 3.5, so can't run
# doctests before then
if: ${{ matrix.python-version == '2.7' }}
run: pytest -v -Werror -Wignore::ImportWarning
8 changes: 7 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
exclude .*
prune .github
global-exclude *~

include README.rst
include LICENSE
global-exclude *~
graft uap-core
exclude uap-core/.*
recursive-exclude uap-core *.js
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ format:
@black .

release: clean
python setup.py sdist bdist_wheel
pyproject-build
twine upload -s dist/*

.PHONY: all test clean format release
44 changes: 44 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[build-system]
requires = ["setuptools", "setuptools-scm", "PyYaml"]
build-backend = "setuptools.build_meta"

[project]
name = "ua-parser"
description = "Python port of Browserscope's user agent parser"
version = "1.0.0a"
readme = "README.rst"
requires-python = ">=3.8"
dependencies = []
optional-dependencies = { yaml = ["PyYaml"] }

license = {text = "Apache 2.0"}
urls = {repository = "https://github.com/ua-parser/uap-python"}

authors = [
{ name = "Stephen Lamm", email = "[email protected]"},
{ name = "PBS", email = "[email protected]" },
{ name = "Selwin Ong", email = "[email protected]" },
{ name = "Matt Robenolt", email = "[email protected]" },
{ name = "Lindsey Simon", email = "[email protected]" },
]
maintainers = [
{ name = "masklinn", email = "[email protected]" }
]

classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy"
]
10 changes: 8 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
[bdist_wheel]
universal = 1
[options]
packages = find:
package_dir =
=src
setup_requires = pyyaml

[options.packages.find]
where = src
Loading