Skip to content

Commit ba99e35

Browse files
authored
Update pixi.toml and pyproject.toml (#1209)
Remove upper version limit for scipy and JAX, remove jaxlib as separate dependency. Close #1131 The previous restriction scipy<1.16 is not necessary when lifting the restriction jax = ">=0.4.38, <0.8".
1 parent 4b729a4 commit ba99e35

File tree

7 files changed

+2726
-2754
lines changed

7 files changed

+2726
-2754
lines changed

pixi.lock

Lines changed: 2645 additions & 2311 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pixi.toml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
authors = [
33
"Alexander Fischer <alexander-fischer1801@t-online.de>",
44
"Styfen Schär"
5-
]
5+
]
66
description = "Fast high dimensional fixed effect estimation following syntax of the fixest R package."
77
channels = ["conda-forge"]
88
name = "pyfixest"
@@ -13,16 +13,16 @@ version = "0.50.0a1"
1313

1414

1515
[dependencies]
16-
scipy=">=1.6,<1.16"
17-
formulaic=">=1.1.0"
18-
pandas=">=1.1.0"
19-
numba=">=0.58.0"
20-
seaborn=">=0.13.2"
21-
tabulate=">=0.9.0"
22-
tqdm=">=4.0.0"
23-
numpy=">=1.25.2"
24-
narwhals=">=1.13.3"
25-
joblib=">=1.4.2,<2"
16+
scipy = ">=1.6"
17+
formulaic = ">=1.1.0"
18+
pandas = ">=1.1.0"
19+
numba = ">=0.58.0"
20+
seaborn = ">=0.13.2"
21+
tabulate = ">=0.9.0"
22+
tqdm = ">=4.0.0"
23+
numpy = ">=1.25.2"
24+
narwhals = ">=1.13.3"
25+
joblib = ">=1.4.2"
2626

2727
[pypi-dependencies]
2828
maketables = ">=0.1.0"
@@ -45,10 +45,9 @@ duckdb = ">=1.1.3"
4545
polars = ">=1.0.0"
4646
pyarrow = ">=14.0"
4747
rpy2 = "==3.5.11"
48-
pixi-pycharm = ">=0.0.8,<0.0.9"
4948
r-base = "*"
5049
r-fixest = ">=0.13.2,<0.14"
51-
r-stringmagic=">=1.2.0"
50+
r-stringmagic = ">=1.2.0"
5251
r-sandwich = ">=3.0_2,<4"
5352
r-broom = ">=1.0.5,<2"
5453
r-car = ">=3.1_2,<4"
@@ -58,13 +57,12 @@ pytest-sugar = ">=1.1.1,<2"
5857

5958
[feature.dev.pypi-dependencies]
6059
wildboottest = ">=0.3.2, <0.4"
61-
jax = ">=0.4.38, <0.8"
62-
jaxlib = ">=0.4.38, <0.8"
60+
jax = ">=0.4.38"
6361

6462
[feature.dev.tasks]
6563
"tests" = "pytest -rs -n 9 --cov-report=term tests"
6664
"tests-against-r-core" = 'pytest -rs tests -n 9 -m "against_r_core" --cov=pyfixest --cov-report=xml'
67-
"tests-against-r-extended" = 'pytest -rs tests -n 9 -m "against_r_extended" --cov=pyfixest --cov-report=xml'
65+
"tests-against-r-extended" = 'pytest -rs tests -n 9 -m "against_r_extended" --cov=pyfixest --cov-report=xml'
6866
"tests-regular" = 'pytest tests -n 9 -m "not (extended or against_r_core or against_r_extended or plots or hac)" --cov=pyfixest --cov-report=xml'
6967
"tests-extended" = 'pytest tests -n 9 -m "extended" --cov=pyfixest --cov-report=xml'
7068
"tests-fixest" = "pytest -rs tests/test_vs_fixest.py -n 9 --cov=pyfixest --cov-report=xml"
@@ -80,19 +78,19 @@ jupytext = "==1.16.1"
8078
watermark = "==2.4.3"
8179
pylatex = ">=1.4.2,<2"
8280
pyarrow = ">=14.0"
83-
quartodoc =">=0.11.0,<0.12"
81+
quartodoc = ">=0.11.0,<0.12"
8482
rpy2 = "==3.5.11"
8583
r-base = "*"
8684
r-fixest = ">=0.13.2,<0.14"
87-
r-stringmagic=">=1.2.0"
85+
r-stringmagic = ">=1.2.0"
8886
r-broom = ">=1.0.5,<2"
8987
quarto = ">=1.8.25,<2"
9088

9189
[feature.docs.pypi-dependencies]
9290
wildboottest = ">=0.3.2"
9391
causaldata = ">=0.1.4,<0.2"
94-
marginaleffects= ">=0.0.10"
95-
lets-plot =">=4.0.0"
92+
marginaleffects = ">=0.0.10"
93+
lets-plot = ">=4.0.0"
9694

9795
[feature.docs.tasks]
9896
docs-build = "quartodoc build --verbose --config docs/_quarto.yml"
@@ -102,8 +100,7 @@ docs-preview = { cmd = "quarto preview docs", env = { PYTHONWARNINGS = "ignore",
102100
[feature.jax.dependencies]
103101

104102
[feature.jax.pypi-dependencies]
105-
jax = ">=0.4.15"
106-
jaxlib= ">=0.4.15"
103+
jax = ">=0.4.29"
107104

108105
[feature.plots.pypi-dependencies]
109106
lets-plot = ">=4.0.0"

pyfixest/estimation/post_estimation/prediction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def _get_fixed_effects_prediction_component(
139139
fdict.update({x: 0 for x in omitted_cat})
140140
fixef_dicts[f"C({f})"] = fdict
141141

142-
_fixef_mat = _apply_fixef_numpy(df_fe.values, fixef_dicts)
142+
_fixef_mat = _apply_fixef_numpy(df_fe.values.astype(str), fixef_dicts)
143143
fe_hat += np.sum(_fixef_mat, axis=1)
144144

145145
return fe_hat

pyproject.toml

Lines changed: 54 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ readme = "README.md"
1010
requires-python = ">=3.9"
1111
license = { text = "MIT" }
1212
dependencies = [
13-
"scipy>=1.6,<1.16",
13+
"scipy>=1.6",
1414
"formulaic>=1.1.0",
1515
"pandas>=1.1.0",
1616
"numba>=0.58.0",
@@ -20,13 +20,12 @@ dependencies = [
2020
"maketables>=0.1.0",
2121
"numpy>=1.25.2",
2222
"narwhals>=1.13.3",
23-
"joblib>=1.4.2,<2",
23+
"joblib>=1.4.2",
2424
]
2525

2626
[project.optional-dependencies]
2727
jax = [
2828
"jax>=0.4.15",
29-
"jaxlib>=0.4.15",
3029
]
3130
plots = [
3231
"lets-plot>=4.0.0",
@@ -43,25 +42,25 @@ python-source = "."
4342

4443
[tool.pytest.ini_options]
4544
addopts = [
46-
"-v",
47-
"--strict-markers",
48-
"--strict-config",
49-
"--cov=pyfixest",
50-
"--cov-report=term-missing",
51-
"--color=yes",
45+
"-v",
46+
"--strict-markers",
47+
"--strict-config",
48+
"--cov=pyfixest",
49+
"--cov-report=term-missing",
50+
"--color=yes",
5251
]
5352

5453
markers = [
55-
"against_r_core: mark test to be part of the test suite that depends on conda available R modules",
56-
"against_r_extended: mark test to be part of the test suite that depends on other R modules",
57-
"extended: mark test to be part of the extended test suite",
58-
"plots: marks all tests for plotting functionality, tests only triggered when using tag in github issue",
59-
"hac: marks all tests for HAC SEs"
54+
"against_r_core: mark test to be part of the test suite that depends on conda available R modules",
55+
"against_r_extended: mark test to be part of the test suite that depends on other R modules",
56+
"extended: mark test to be part of the extended test suite",
57+
"plots: marks all tests for plotting functionality, tests only triggered when using tag in github issue",
58+
"hac: marks all tests for HAC SEs"
6059
]
6160

6261
filterwarnings = [
63-
"ignore::FutureWarning:rpy2",
64-
"ignore::DeprecationWarning:rpy2",
62+
"ignore::FutureWarning:rpy2",
63+
"ignore::DeprecationWarning:rpy2",
6564
]
6665

6766
[tool.ruff]
@@ -74,37 +73,37 @@ target-version = "py39"
7473
[tool.ruff.lint]
7574
# docs: https://docs.astral.sh/ruff/rules/
7675
select = [
77-
"B", # bugbear
78-
"F", # Pyflakes
79-
"E", # pycodestyle errors
80-
"W", # pycodestyle warnings
81-
"I", # isort
82-
"D", # flake8-docstrings
83-
"UP", # pyupgrade
84-
"SIM", # flake8-simplify
85-
"RUF", # ruff,
86-
"TRY", # tryceratops
76+
"B", # bugbear
77+
"F", # Pyflakes
78+
"E", # pycodestyle errors
79+
"W", # pycodestyle warnings
80+
"I", # isort
81+
"D", # flake8-docstrings
82+
"UP", # pyupgrade
83+
"SIM", # flake8-simplify
84+
"RUF", # ruff,
85+
"TRY", # tryceratops
8786
]
8887

8988
ignore = [
90-
# do not enable if formatting
91-
# docs: https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
92-
"B028", # No explicit `stacklevel` keyword argument found
93-
"B904", # Better exception handling
94-
"W191", # tab indentation
95-
"E111", # indentation
96-
"E114", # indentation
97-
"E117", # over indented
98-
"D206", # indent with spaces
99-
"D300", # triple single quotes
100-
"E501", # line length regulated by formatter
101-
"D105", # missing docstring in magic method
102-
"D100", # missing docstring in public module
103-
"D104", # missing docstring in public package
104-
"SIM110", # Use all instead of `for` loop
105-
"TRY003", # Avoid specifying long messages outside the exception class
106-
"D205", # 1 blank line required between summary line and description
107-
"W505", # Doc line too long
89+
# do not enable if formatting
90+
# docs: https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
91+
"B028", # No explicit `stacklevel` keyword argument found
92+
"B904", # Better exception handling
93+
"W191", # tab indentation
94+
"E111", # indentation
95+
"E114", # indentation
96+
"E117", # over indented
97+
"D206", # indent with spaces
98+
"D300", # triple single quotes
99+
"E501", # line length regulated by formatter
100+
"D105", # missing docstring in magic method
101+
"D100", # missing docstring in public module
102+
"D104", # missing docstring in public package
103+
"SIM110", # Use all instead of `for` loop
104+
"TRY003", # Avoid specifying long messages outside the exception class
105+
"D205", # 1 blank line required between summary line and description
106+
"W505", # Doc line too long
108107
]
109108

110109
[tool.ruff.lint.per-file-ignores]
@@ -129,16 +128,16 @@ docstring-code-line-length = 88
129128

130129
[[tool.mypy.overrides]]
131130
module = [
132-
"pandas.*",
133-
"numpy.*",
134-
"scipy.*",
135-
"numba.*",
136-
"lets_plot.*",
137-
"formulaic.*",
138-
"wildboottest.*",
139-
"tabulate.*",
140-
"joblib.*",
141-
"narwhals.*",
142-
"tqdm.*",
131+
"pandas.*",
132+
"numpy.*",
133+
"scipy.*",
134+
"numba.*",
135+
"lets_plot.*",
136+
"formulaic.*",
137+
"wildboottest.*",
138+
"tabulate.*",
139+
"joblib.*",
140+
"narwhals.*",
141+
"tqdm.*",
143142
]
144143
ignore_missing_imports = true

tests/test_did.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ def test_event_study(data):
7676
r_df = pd.DataFrame(r_df)
7777

7878
np.testing.assert_allclose(fit_did2s.coef(), r_df[1], atol=1e-05, rtol=1e-05)
79-
np.testing.assert_allclose(fit_did2s.se(), float(r_df[2]), atol=1e-05, rtol=1e-05)
79+
np.testing.assert_allclose(
80+
fit_did2s.se(), r_df[2].squeeze(), atol=1e-05, rtol=1e-05
81+
)
8082

8183

8284
@pytest.mark.against_r_core
@@ -119,7 +121,7 @@ def test_did2s(data, weights):
119121
)
120122

121123
np.testing.assert_allclose(
122-
fit_did2s_py1.se(), float(fit_did2s_r1.iloc[:, 3]), atol=1e-05, rtol=1e-05
124+
fit_did2s_py1.se(), fit_did2s_r1.iloc[:, 3].squeeze(), atol=1e-05, rtol=1e-05
123125
)
124126

125127
# Model 2

0 commit comments

Comments
 (0)