Skip to content

Commit 96a960a

Browse files
authored
Merge pull request #991 from compas-dev/move_data
Move data files
2 parents d18c74b + 5d5d0a0 commit 96a960a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+202283
-202285
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ src/.build/**
127127
data/bunny
128128
data/models
129129
data/ctralie
130-
*.ply
131130
*.tar.gz
132131

133132
data/models

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
* Fixed symlink expansion for directories relative to the COMPAS installation folder, eg. `compas.DATA` when used from IronPython.
1717
* Fixed the result of `compas.__version__` on dev installs to properly include git hash.
18+
* Move `data` files inside the folder included in the source distribution (ie. non-dev installs).
1819

1920
### Removed
2021

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
graft src
22

33
prune .github
4-
prune data
54
prune docs
65
prune libs
6+
prune samples
77
prune tests
88
prune temp
99

samples/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
This folder contains larger sample files that are not included in the `pip` releases
2+
to keep the distribution size small. Instead of being copied locally, they are intended
3+
to be accessed via the raw user content server of Github.
4+
5+
The `compas.get()` function can be used to retrieve the path to them, just like other sample
6+
files included in the source distribution.

src/compas/__init__.py

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@
5050
"""str: Path to the location of the compas package."""
5151

5252
HOME = compas._os.absjoin(HERE, '../..')
53-
"""str: Path to the root of the local repo."""
53+
"""str: Path to the root of the local installation."""
5454

55-
DATA = compas._os.absjoin(HERE, '../../data')
56-
"""str: Path to the data folder of the local repo."""
55+
DATA = compas._os.absjoin(HERE, 'data', 'samples')
56+
"""str: Path to the data folder of the local installation."""
5757

5858
TEMP = compas._os.absjoin(HERE, '../../temp')
59-
"""str: Path to the temp folder of the local repo."""
59+
"""str: Path to the temp folder of the local installation."""
6060

6161
APPDATA = compas._os.user_data_dir('COMPAS', 'compas-dev', roaming=True)
6262
"""str: Path to the COMPAS directory in APPDATA."""
@@ -172,27 +172,19 @@ def get(filename):
172172
----------
173173
filename : str
174174
The name of the data file.
175-
The following are available.
176-
177-
* boxes.obj
178-
* faces.obj
179-
* fink.obj
180-
* hypar.obj
181-
* lines.obj
182-
* saddle.obj
183175
184176
Returns
185177
-------
186178
str
187179
The full path to the specified file.
180+
The path can be local or remote depending on availability.
188181
189182
Notes
190183
-----
191184
The file name should be specified relative to the **COMPAS** sample data folder.
192-
This folder is only locally available if you installed **COMPAS** from source,
193-
or if you are working directly with the source.
194-
In all other cases, the function will get the corresponding files directly from
195-
the GitHub repo, at https://raw.githubusercontent.com/compas-dev/compas/main/data
185+
If the requested file is not locally available in the sample data folder,
186+
the function will get the corresponding file path from
187+
the GitHub repo, at https://raw.githubusercontent.com/compas-dev/compas/main/samples
196188
197189
Examples
198190
--------
@@ -217,7 +209,7 @@ def get(filename):
217209
if os.path.exists(localpath):
218210
return localpath
219211
else:
220-
return "https://github.com/compas-dev/compas/raw/main/data/{}".format(filename)
212+
return "https://github.com/compas-dev/compas/raw/main/samples/{}".format(filename)
221213

222214

223215
def get_bunny(localstorage=None):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
OFF
2-
8 6 24
3-
0 0 0
4-
0 0 1
5-
0 1 0
6-
0 1 1
7-
1 0 0
8-
1 0 1
9-
1 1 0
10-
1 1 1
11-
4 0 1 3 2
12-
4 2 3 7 6
13-
4 4 6 7 5
14-
4 0 4 5 1
15-
4 1 5 7 3
16-
4 0 2 6 4
1+
OFF
2+
8 6 24
3+
0 0 0
4+
0 0 1
5+
0 1 0
6+
0 1 1
7+
1 0 0
8+
1 0 1
9+
1 1 0
10+
1 1 1
11+
4 0 1 3 2
12+
4 2 3 7 6
13+
4 4 6 7 5
14+
4 0 4 5 1
15+
4 1 5 7 3
16+
4 0 2 6 4

0 commit comments

Comments
 (0)