Skip to content
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

Replace numpy.core.distutils with mesonpy #6

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
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
18 changes: 9 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ workflows:
version: 2
test:
jobs:
- test-3.6
- test-3.7
- test-3.8
- test-3.10
- test-3.11
- test-3.12

jobs:
test-3.8: &unit-tests
test-3.11: &unit-tests
working_directory: ~/python-glmnet
docker:
- image: circleci/python:3.8
- image: circleci/python:3.11
steps:
- checkout
- restore_cache:
Expand Down Expand Up @@ -48,11 +48,11 @@ jobs:
. venv/bin/activate
cd ~
pytest -v python-glmnet/glmnet
test-3.6:
test-3.10:
<<: *unit-tests
docker:
- image: circleci/python:3.6
test-3.7:
- image: circleci/python:3.10
test-3.12:
<<: *unit-tests
docker:
- image: circleci/python:3.7
- image: circleci/python:3.12
174 changes: 168 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,170 @@
build/
*.pyc
*.so
*.egg-info
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so.dSYM
_glmnetmodule.c
dist
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.pdm-python
.Rproj.user/
.pdm-build/
.ruff_cache/
**/*.Rproj
.DS_Store
**/*.ipynb
**/.vscode
**/builddir
1 change: 1 addition & 0 deletions .pdm-python
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/home/milo/workspace/python-glmnet/.venv/bin/python
81 changes: 81 additions & 0 deletions .sourcery.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# 🪄 This is your project's Sourcery configuration file.

# You can use it to get Sourcery working in the way you want, such as
# ignoring specific refactorings, skipping directories in your project,
# or writing custom rules.

# 📚 For a complete reference to this file, see the documentation at
# https://docs.sourcery.ai/Configuration/Project-Settings/

# This file was auto-generated by Sourcery on 2024-06-09 at 11:54.

version: '1' # The schema version of this config file

ignore: # A list of paths or files which Sourcery will ignore.
- .git
- env
- .env
- .tox
- node_modules
- vendor
- venv
- .venv
- ~/.pyenv
- ~/.rye
- ~/.vscode
- .vscode
- ~/.cache
- ~/.config
- ~/.local

rule_settings:
enable:
- default
disable: [] # A list of rule IDs Sourcery will never suggest.
rule_types:
- refactoring
- suggestion
- comment
python_version: '3.9' # A string specifying the lowest Python version your project supports. Sourcery will not suggest refactorings requiring a higher Python version.

# rules: # A list of custom rules Sourcery will include in its analysis.
# - id: no-print-statements
# description: Do not use print statements in the test directory.
# pattern: print(...)
# language: python
# replacement:
# condition:
# explanation:
# paths:
# include:
# - test
# exclude:
# - conftest.py
# tests: []
# tags: []

# rule_tags: {} # Additional rule tags.

# metrics:
# quality_threshold: 25.0

# github:
# labels: []
# ignore_labels:
# - sourcery-ignore
# request_review: author
# sourcery_branch: sourcery/{base_branch}

# clone_detection:
# min_lines: 3
# min_duplicates: 2
# identical_clones_only: false

# proxy:
# url:
# ssl_certs_file:
# no_ssl_verify: false

# coding_assistant:
# project_description: ''
# enabled:
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## 2.6.1 - 2024-11-18
### Changed
* Parameterized unit tests in nox to test a range of python versions > 3.10 and
numpy >1.26
* Trying to get 3.9 to work is a bust

## 2.6.0 - 2024-11-16
### Changed
* In root `meson.build`, replace `import numpy` and `numpy.f2py.get_include()` to
`from numpy import f2py` and `f2py.get_include()` to allow numpy < 2.0 to work
* Rewrote unittest-style tests as pytest-style tests
* Add Nox
* Formatting and linting using Ruff
* Revert usage of structural pattern matching so earlier versions of python work

## 2.5.0 - 2024-11-13

### Changed
* Python version support: Allow 3.12 and newer versions of numpy
that lack numpy.code.distutils
* Replace Numpy-based build system with Meson
* Remove setup.py and move all information into pyproject.toml
* Formatting and linting using Ruff
* Changed package layout to src-type, moved tests outside

## Unreleased

## 2.2.2 - 2024-05-09
Expand Down
6 changes: 0 additions & 6 deletions MANIFEST.in

This file was deleted.

9 changes: 9 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
comment: false
coverage:
status:
project:
default:
target: "100"
patch:
default:
target: "100"
11 changes: 11 additions & 0 deletions debug.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import numpy as np
from sklearn.datasets import make_regression

from glmnet import ElasticNet

if __name__ == "__main__":
np.random.seed(488881)
X, y = make_regression(n_samples=1000, random_state=561)
m = ElasticNet()
m.fit(X, y)
p = m.predict(X[0].reshape((1, -1)), lamb=[20, 10])
5 changes: 0 additions & 5 deletions dev-requirements.txt

This file was deleted.

Loading