Skip to content

Commit d2b64d5

Browse files
committed
Fix: cleanup some of the readme and init files to support instals
1 parent 879950a commit d2b64d5

File tree

5 files changed

+31
-42
lines changed

5 files changed

+31
-42
lines changed

example4_pdm/examplePy/__init__.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'''
2-
The __init__.py file is required to import the directory as a package, and
3-
can start empty.
2+
The __init__.py file is required to import the directory as a package.
3+
It can start as an empty file.
44
5-
It is used for....
65
'''
76

8-
7+
from .module1 import add_values

example4_pdm/examplePy/module1.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ def add_values(num1, num2):
1919
num 1 and num 2 added together
2020
2121
"""
22+
print("Example 4 install")
2223
return num1 + num2

example4_pdm/requirements.txt

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,12 +1 @@
1-
# nbsphinx setup
2-
nbsphinx
3-
pandoc # if you don't install this tutorials wont' build
4-
5-
# for sphinx gallery only
6-
sphinx-gallery
7-
pillow
8-
seaborn
9-
10-
# theme and syntax
11-
myst_parser
12-
furo
1+
pdm
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22
[binaries]
3-
python = '/Users/leahawasser/opt/miniconda3/envs/pdm_meson/bin/python3.9'
3+
python = '/Users/leahawasser/opt/miniconda3/envs/pdm_meson/bin/python'

example6_pdm_meson/README.md

+25-25
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,28 @@
22

33

44
## Requirements
5-
When combining both pdm and meson-python, install requirements become
6-
important. this is not clearly documented so far in any of the docs.
5+
When combining `pdm` and `meson-python` install requirements become
6+
important. This is not clearly documented as far as I can tell.
77

8-
For pdm use:
8+
## Build dependencies
9+
10+
You will need to install the following dependencies to use these tools together.
11+
12+
Build is needed if you want to run `python3 -m build` to build your project.
13+
Ninja is needed for meson-python to run.
914

1015
# TODO create envt file for this?
1116
```bash
12-
conda install -c conda-forge pdm
13-
conda install -c conda-forge build
14-
# or install from main given the directory bug
15-
conda install -c conda-forge meson-python
16-
conda install -c conda-forge ninja
17-
17+
conda install -c conda-forge pdm build meson-python ninja
1818
```
1919

20-
You could use pip to install all of these tools if you are a pip user!
20+
NOTE: You can use pip to install all of these tools if you are a pip user!
2121

22-
ToO build with `build` you need to install meson python
23-
`pip install meson-python`
22+
NOTE: PEP 517?? doesn't specify whether the front end of the back end need to be aware of the dist/ directory where your build outputs will bestored. As such there is a bug using meson-python and PDM.
23+
PDM by default cleans / deletes any dist/ directory and tries to place your
24+
SDist and wheel files in that directory.
2425

25-
NOTE: currently there is a bug between meson-python and pdm.
26-
PDm by default cleans / deletes any dist/ directory and tries to place your
27-
SDist and wheel files in that directoy.
28-
29-
Meson Python by default does not create that directory for you.
26+
`Meson-Python` by default does not create that directory for you.
3027

3128
An easy work around for this is:
3229

@@ -41,22 +38,21 @@ $ pdm build --no-clean
4138
To build with meson run:
4239
`python -m build`
4340

44-
## Build and install package
45-
This creates a build using meson - to run this you need to have ninja
46-
installed in your envt.
47-
`pip install --no-build-isolation .`
41+
## Build and install package in editable mode
4842

49-
`pdm build` doesn't work currently
43+
You can also install/build using pip. This creates a build using meson.
44+
45+
`pip install --no-build-isolation .`
5046

5147

48+
Install the package from the whl.
5249
```bash
5350
python -m pip install --no-deps dist/*.whl
5451
```
5552

56-
5753
## Environments
5854

59-
Pdm has several options for managing environments.
55+
PDM has several options for managing environments.
6056
One is following pep xxx it will create a __pypackgages__ directory. it will
6157
assume that the packages needed to build and install your package are in that
6258
local directory. However, you can also set the environment that you wish to
@@ -149,4 +145,8 @@ conda create -n myenv python=3.9
149145
installed_packages = pkg_resources.working_set
150146
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
151147
for i in installed_packages])
152-
print(installed_packages_list)
148+
print(installed_packages_list)
149+
150+
151+
import os
152+
print(os.environ['CONDA_DEFAULT_ENV'])

0 commit comments

Comments
 (0)